summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/bytecode/ArrayProfile.h
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@digia.com>2013-09-13 12:51:20 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-19 20:50:05 +0200
commitd441d6f39bb846989d95bcf5caf387b42414718d (patch)
treee367e64a75991c554930278175d403c072de6bb8 /Source/JavaScriptCore/bytecode/ArrayProfile.h
parent0060b2994c07842f4c59de64b5e3e430525c4b90 (diff)
downloadqtwebkit-d441d6f39bb846989d95bcf5caf387b42414718d.tar.gz
Import Qt5x2 branch of QtWebkit for Qt 5.2
Importing a new snapshot of webkit. Change-Id: I2d01ad12cdc8af8cb015387641120a9d7ea5f10c Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
Diffstat (limited to 'Source/JavaScriptCore/bytecode/ArrayProfile.h')
-rw-r--r--Source/JavaScriptCore/bytecode/ArrayProfile.h34
1 files changed, 28 insertions, 6 deletions
diff --git a/Source/JavaScriptCore/bytecode/ArrayProfile.h b/Source/JavaScriptCore/bytecode/ArrayProfile.h
index 5116cd36f..384275689 100644
--- a/Source/JavaScriptCore/bytecode/ArrayProfile.h
+++ b/Source/JavaScriptCore/bytecode/ArrayProfile.h
@@ -67,7 +67,8 @@ inline ArrayModes arrayModeFromStructure(Structure* structure)
return asArrayModes(structure->indexingType());
}
-const char* arrayModesToString(ArrayModes);
+void dumpArrayModes(PrintStream&, ArrayModes);
+MAKE_PRINT_ADAPTOR(ArrayModesDump, ArrayModes, dumpArrayModes);
inline bool mergeArrayModes(ArrayModes& left, ArrayModes right)
{
@@ -114,14 +115,24 @@ inline bool shouldUseInt32(ArrayModes arrayModes)
return arrayModesInclude(arrayModes, Int32Shape);
}
+inline bool hasSeenArray(ArrayModes arrayModes)
+{
+ return arrayModes & ALL_ARRAY_ARRAY_MODES;
+}
+
+inline bool hasSeenNonArray(ArrayModes arrayModes)
+{
+ return arrayModes & ALL_NON_ARRAY_ARRAY_MODES;
+}
+
class ArrayProfile {
public:
ArrayProfile()
: m_bytecodeOffset(std::numeric_limits<unsigned>::max())
, m_lastSeenStructure(0)
, m_expectedStructure(0)
- , m_structureIsPolymorphic(false)
, m_mayStoreToHole(false)
+ , m_outOfBounds(false)
, m_mayInterceptIndexedAccesses(false)
, m_usesOriginalArrayStructures(true)
, m_observedArrayModes(0)
@@ -132,8 +143,8 @@ public:
: m_bytecodeOffset(bytecodeOffset)
, m_lastSeenStructure(0)
, m_expectedStructure(0)
- , m_structureIsPolymorphic(false)
, m_mayStoreToHole(false)
+ , m_outOfBounds(false)
, m_mayInterceptIndexedAccesses(false)
, m_usesOriginalArrayStructures(true)
, m_observedArrayModes(0)
@@ -145,6 +156,7 @@ public:
Structure** addressOfLastSeenStructure() { return &m_lastSeenStructure; }
ArrayModes* addressOfArrayModes() { return &m_observedArrayModes; }
bool* addressOfMayStoreToHole() { return &m_mayStoreToHole; }
+ bool* addressOfOutOfBounds() { return &m_outOfBounds; }
void observeStructure(Structure* structure)
{
@@ -153,10 +165,15 @@ public:
void computeUpdatedPrediction(CodeBlock*, OperationInProgress = NoOperation);
- Structure* expectedStructure() const { return m_expectedStructure; }
+ Structure* expectedStructure() const
+ {
+ if (structureIsPolymorphic())
+ return 0;
+ return m_expectedStructure;
+ }
bool structureIsPolymorphic() const
{
- return m_structureIsPolymorphic;
+ return m_expectedStructure == polymorphicStructure();
}
bool hasDefiniteStructure() const
{
@@ -167,17 +184,22 @@ public:
bool mayInterceptIndexedAccesses() const { return m_mayInterceptIndexedAccesses; }
bool mayStoreToHole() const { return m_mayStoreToHole; }
+ bool outOfBounds() const { return m_outOfBounds; }
bool usesOriginalArrayStructures() const { return m_usesOriginalArrayStructures; }
+ CString briefDescription(CodeBlock*);
+
private:
friend class LLIntOffsetsExtractor;
+ static Structure* polymorphicStructure() { return static_cast<Structure*>(reinterpret_cast<void*>(1)); }
+
unsigned m_bytecodeOffset;
Structure* m_lastSeenStructure;
Structure* m_expectedStructure;
- bool m_structureIsPolymorphic;
bool m_mayStoreToHole; // This flag may become overloaded to indicate other special cases that were encountered during array access, as it depends on indexing type. Since we currently have basically just one indexing type (two variants of ArrayStorage), this flag for now just means exactly what its name implies.
+ bool m_outOfBounds;
bool m_mayInterceptIndexedAccesses;
bool m_usesOriginalArrayStructures;
ArrayModes m_observedArrayModes;