Ignore:
Timestamp:
Dec 17, 2012, 1:38:51 PM (13 years ago)
Author:
[email protected]
Message:

Rationalize array profiling for out-of-bounds and hole cases
https://bugs.webkit.org/show_bug.cgi?id=105139

Reviewed by Geoffrey Garen.

This makes ArrayProfile track whether or not we had out-of-bounds, which allows
for more precise decision-making in the DFG.

Also cleaned up ExitKinds for out-of-bounds and hole cases to make it easier to
look at them in the profiler.

Slight speed-up (5-8%) on SunSpider/crypto-md5.

  • bytecode/ArrayProfile.cpp:

(JSC::ArrayProfile::computeUpdatedPrediction):
(JSC::ArrayProfile::briefDescription):

  • bytecode/ArrayProfile.h:

(JSC::ArrayProfile::ArrayProfile):
(JSC::ArrayProfile::addressOfOutOfBounds):
(JSC::ArrayProfile::expectedStructure):
(JSC::ArrayProfile::structureIsPolymorphic):
(JSC::ArrayProfile::outOfBounds):
(JSC::ArrayProfile::polymorphicStructure):

  • bytecode/CodeBlock.cpp:

(JSC::dumpChain):

  • bytecode/ExitKind.cpp:

(JSC::exitKindToString):
(JSC::exitKindIsCountable):

  • bytecode/ExitKind.h:
  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::getArrayModeAndEmitChecks):

  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::compileDoublePutByVal):

  • dfg/DFGSpeculativeJIT32_64.cpp:

(JSC::DFG::SpeculativeJIT::compileContiguousPutByVal):
(JSC::DFG::SpeculativeJIT::compile):

  • dfg/DFGSpeculativeJIT64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

  • jit/JIT.h:
  • jit/JITInlines.h:

(JSC::JIT::emitArrayProfileOutOfBoundsSpecialCase):

  • jit/JITPropertyAccess.cpp:

(JSC::JIT::emitSlow_op_get_by_val):
(JSC::JIT::emitSlow_op_put_by_val):

  • jit/JITPropertyAccess32_64.cpp:

(JSC::JIT::emitSlow_op_get_by_val):
(JSC::JIT::emitSlow_op_put_by_val):

  • llint/LowLevelInterpreter32_64.asm:
  • llint/LowLevelInterpreter64.asm:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/bytecode/ArrayProfile.h

    r137379 r137937  
    122122        , m_lastSeenStructure(0)
    123123        , m_expectedStructure(0)
    124         , m_structureIsPolymorphic(false)
    125124        , m_mayStoreToHole(false)
     125        , m_outOfBounds(false)
    126126        , m_mayInterceptIndexedAccesses(false)
    127127        , m_usesOriginalArrayStructures(true)
     
    134134        , m_lastSeenStructure(0)
    135135        , m_expectedStructure(0)
    136         , m_structureIsPolymorphic(false)
    137136        , m_mayStoreToHole(false)
     137        , m_outOfBounds(false)
    138138        , m_mayInterceptIndexedAccesses(false)
    139139        , m_usesOriginalArrayStructures(true)
     
    147147    ArrayModes* addressOfArrayModes() { return &m_observedArrayModes; }
    148148    bool* addressOfMayStoreToHole() { return &m_mayStoreToHole; }
     149    bool* addressOfOutOfBounds() { return &m_outOfBounds; }
    149150   
    150151    void observeStructure(Structure* structure)
     
    155156    void computeUpdatedPrediction(CodeBlock*, OperationInProgress = NoOperation);
    156157   
    157     Structure* expectedStructure() const { return m_expectedStructure; }
     158    Structure* expectedStructure() const
     159    {
     160        if (structureIsPolymorphic())
     161            return 0;
     162        return m_expectedStructure;
     163    }
    158164    bool structureIsPolymorphic() const
    159165    {
    160         return m_structureIsPolymorphic;
     166        return m_expectedStructure == polymorphicStructure();
    161167    }
    162168    bool hasDefiniteStructure() const
     
    169175   
    170176    bool mayStoreToHole() const { return m_mayStoreToHole; }
     177    bool outOfBounds() const { return m_outOfBounds; }
    171178   
    172179    bool usesOriginalArrayStructures() const { return m_usesOriginalArrayStructures; }
     
    176183private:
    177184    friend class LLIntOffsetsExtractor;
     185   
     186    static Structure* polymorphicStructure() { return static_cast<Structure*>(reinterpret_cast<void*>(1)); }
    178187   
    179188    unsigned m_bytecodeOffset;
    180189    Structure* m_lastSeenStructure;
    181190    Structure* m_expectedStructure;
    182     bool m_structureIsPolymorphic;
    183191    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.
     192    bool m_outOfBounds;
    184193    bool m_mayInterceptIndexedAccesses;
    185194    bool m_usesOriginalArrayStructures;
Note: See TracChangeset for help on using the changeset viewer.