Changeset 153657 in webkit


Ignore:
Timestamp:
Aug 2, 2013, 11:27:51 AM (12 years ago)
Author:
fpizlo@apple.com
Message:

hasIndexingHeader should be a property of the Structure, not just the IndexingType
https://bugs.webkit.org/show_bug.cgi?id=119422

Reviewed by Oliver Hunt.

This simplifies some code and also allows Structure to claim that an object
has an indexing header even if it doesn't have indexed properties.

I also changed some calls to use hasIndexedProperties() since in some cases,
that's what we actually meant. Currently the two are synonyms.

  • dfg/DFGRepatch.cpp:

(JSC::DFG::tryCachePutByID):
(JSC::DFG::tryBuildPutByIdList):

  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::compileAllocatePropertyStorage):
(JSC::DFG::SpeculativeJIT::compileReallocatePropertyStorage):

  • runtime/ButterflyInlines.h:

(JSC::Butterfly::create):
(JSC::Butterfly::growPropertyStorage):
(JSC::Butterfly::growArrayRight):
(JSC::Butterfly::resizeArray):

  • runtime/IndexingType.h:
  • runtime/JSObject.cpp:

(JSC::JSObject::copyButterfly):
(JSC::JSObject::visitButterfly):
(JSC::JSObject::setPrototype):

  • runtime/JSObject.h:

(JSC::JSObject::setButterfly):

  • runtime/JSPropertyNameIterator.cpp:

(JSC::JSPropertyNameIterator::create):

  • runtime/Structure.h:

(JSC::Structure::hasIndexingHeader):

Location:
trunk/Source/JavaScriptCore
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r153648 r153657  
     12013-08-01  Filip Pizlo  <fpizlo@apple.com>
     2
     3        hasIndexingHeader should be a property of the Structure, not just the IndexingType
     4        https://bugs.webkit.org/show_bug.cgi?id=119422
     5
     6        Reviewed by Oliver Hunt.
     7       
     8        This simplifies some code and also allows Structure to claim that an object
     9        has an indexing header even if it doesn't have indexed properties.
     10       
     11        I also changed some calls to use hasIndexedProperties() since in some cases,
     12        that's what we actually meant. Currently the two are synonyms.
     13
     14        * dfg/DFGRepatch.cpp:
     15        (JSC::DFG::tryCachePutByID):
     16        (JSC::DFG::tryBuildPutByIdList):
     17        * dfg/DFGSpeculativeJIT.cpp:
     18        (JSC::DFG::SpeculativeJIT::compileAllocatePropertyStorage):
     19        (JSC::DFG::SpeculativeJIT::compileReallocatePropertyStorage):
     20        * runtime/ButterflyInlines.h:
     21        (JSC::Butterfly::create):
     22        (JSC::Butterfly::growPropertyStorage):
     23        (JSC::Butterfly::growArrayRight):
     24        (JSC::Butterfly::resizeArray):
     25        * runtime/IndexingType.h:
     26        * runtime/JSObject.cpp:
     27        (JSC::JSObject::copyButterfly):
     28        (JSC::JSObject::visitButterfly):
     29        (JSC::JSObject::setPrototype):
     30        * runtime/JSObject.h:
     31        (JSC::JSObject::setButterfly):
     32        * runtime/JSPropertyNameIterator.cpp:
     33        (JSC::JSPropertyNameIterator::create):
     34        * runtime/Structure.h:
     35        (JSC::Structure::hasIndexingHeader):
     36
    1372013-08-02  Julien Brianceau  <jbrianceau@nds.com>
    238
  • trunk/Source/JavaScriptCore/dfg/DFGRepatch.cpp

    r153556 r153657  
    966966            // Skip optimizing the case where we need realloc, and the structure has
    967967            // indexing storage.
    968             if (hasIndexingHeader(oldStructure->indexingType()))
     968            if (oldStructure->hasIndexingHeader())
    969969                return false;
    970970           
     
    10411041            // Skip optimizing the case where we need realloc, and the structure has
    10421042            // indexing storage.
    1043             if (hasIndexingHeader(oldStructure->indexingType()))
     1043            if (oldStructure->hasIndexingHeader())
    10441044                return false;
    10451045           
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp

    r153500 r153657  
    42604260void SpeculativeJIT::compileAllocatePropertyStorage(Node* node)
    42614261{
    4262     if (hasIndexingHeader(node->structureTransitionData().previousStructure->indexingType())) {
     4262    if (node->structureTransitionData().previousStructure->hasIndexingHeader()) {
    42634263        SpeculateCellOperand base(this, node->child1());
    42644264       
     
    43034303    ASSERT(newSize == node->structureTransitionData().newStructure->outOfLineCapacity() * sizeof(JSValue));
    43044304
    4305     if (hasIndexingHeader(node->structureTransitionData().previousStructure->indexingType())) {
     4305    if (node->structureTransitionData().previousStructure->hasIndexingHeader()) {
    43064306        SpeculateCellOperand base(this, node->child1());
    43074307       
  • trunk/Source/JavaScriptCore/runtime/ButterflyInlines.h

    r153189 r153657  
    5959    return create(
    6060        vm, intendedOwner, 0, structure->outOfLineCapacity(),
    61         hasIndexingHeader(structure->indexingType()), IndexingHeader(), 0);
     61        structure->hasIndexingHeader(), IndexingHeader(), 0);
    6262}
    6363
     
    9797    return growPropertyStorage(
    9898        vm, intendedOwner, indexingHeader()->preCapacity(structure), oldPropertyCapacity,
    99         hasIndexingHeader(structure->indexingType()),
     99        structure->hasIndexingHeader(),
    100100        indexingHeader()->indexingPayloadSizeInBytes(structure), newPropertyCapacity);
    101101}
     
    130130{
    131131    ASSERT_UNUSED(oldStructure, !indexingHeader()->preCapacity(oldStructure));
    132     ASSERT_UNUSED(oldStructure, hadIndexingHeader == hasIndexingHeader(oldStructure->indexingType()));
     132    ASSERT_UNUSED(oldStructure, hadIndexingHeader == oldStructure->hasIndexingHeader());
    133133    void* theBase = base(0, propertyCapacity);
    134134    size_t oldSize = totalSize(0, propertyCapacity, hadIndexingHeader, oldIndexingPayloadSizeInBytes);
     
    145145    return growArrayRight(
    146146        vm, intendedOwner, oldStructure, oldStructure->outOfLineCapacity(),
    147         hasIndexingHeader(oldStructure->indexingType()),
    148         indexingHeader()->indexingPayloadSizeInBytes(oldStructure), newIndexingPayloadSizeInBytes);
     147        oldStructure->hasIndexingHeader(),
     148        indexingHeader()->indexingPayloadSizeInBytes(oldStructure),
     149        newIndexingPayloadSizeInBytes);
    149150}
    150151
     
    172173    size_t newIndexingPayloadSizeInBytes)
    173174{
    174     bool hasIndexingHeader = JSC::hasIndexingHeader(structure->indexingType());
     175    bool hasIndexingHeader = structure->hasIndexingHeader();
    175176    return resizeArray(
    176177        vm, intendedOwner, structure->outOfLineCapacity(), hasIndexingHeader,
  • trunk/Source/JavaScriptCore/runtime/IndexingType.h

    r149304 r153657  
    102102}
    103103
    104 static inline bool hasIndexingHeader(IndexingType type)
    105 {
    106     return hasIndexedProperties(type);
    107 }
    108 
    109104static inline bool hasUndecided(IndexingType indexingType)
    110105{
  • trunk/Source/JavaScriptCore/runtime/JSObject.cpp

    r153556 r153657  
    103103    size_t preCapacity;
    104104    size_t indexingPayloadSizeInBytes;
    105     bool hasIndexingHeader = JSC::hasIndexingHeader(structure->indexingType());
     105    bool hasIndexingHeader = structure->hasIndexingHeader();
    106106    if (UNLIKELY(hasIndexingHeader)) {
    107107        preCapacity = butterfly->indexingHeader()->preCapacity(structure);
     
    149149                break;
    150150            }
     151               
    151152            default:
    152                 CRASH();
    153153                currentTarget = 0;
    154154                currentSource = 0;
     
    174174    size_t preCapacity;
    175175    size_t indexingPayloadSizeInBytes;
    176     bool hasIndexingHeader = JSC::hasIndexingHeader(structure->indexingType());
     176    bool hasIndexingHeader = structure->hasIndexingHeader();
    177177    if (UNLIKELY(hasIndexingHeader)) {
    178178        preCapacity = butterfly->indexingHeader()->preCapacity(structure);
     
    11471147    }
    11481148   
    1149     if (!hasIndexingHeader(structure()->indexingType()))
     1149    if (!hasIndexedProperties(structure()->indexingType()))
    11501150        return;
    11511151   
  • trunk/Source/JavaScriptCore/runtime/JSObject.h

    r153556 r153657  
    11081108{
    11091109    ASSERT(structure);
    1110     ASSERT(!butterfly == (!structure->outOfLineCapacity() && !hasIndexingHeader(structure->indexingType())));
     1110    ASSERT(!butterfly == (!structure->outOfLineCapacity() && !structure->hasIndexingHeader()));
    11111111    setStructure(vm, structure);
    11121112    m_butterfly = butterfly;
  • trunk/Source/JavaScriptCore/runtime/JSPropertyNameIterator.cpp

    r148696 r153657  
    6666        return jsPropertyNameIterator;
    6767   
    68     if (hasIndexingHeader(o->structure()->indexingType()))
     68    if (hasIndexedProperties(o->structure()->indexingType()))
    6969        return jsPropertyNameIterator;
    7070   
  • trunk/Source/JavaScriptCore/runtime/Structure.h

    r153296 r153657  
    228228            && (offset < m_inlineCapacity || offset >= firstOutOfLineOffset);
    229229    }
     230   
     231    bool hasIndexingHeader() const
     232    {
     233        return hasIndexedProperties(indexingType());
     234    }
    230235
    231236    bool masqueradesAsUndefined(JSGlobalObject* lexicalGlobalObject);
Note: See TracChangeset for help on using the changeset viewer.