diff options
Diffstat (limited to 'Source/JavaScriptCore/bytecode/ArrayProfile.h')
-rw-r--r-- | Source/JavaScriptCore/bytecode/ArrayProfile.h | 34 |
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; |