Changeset 171115 in webkit


Ignore:
Timestamp:
Jul 15, 2014, 2:05:43 PM (11 years ago)
Author:
mhahnenberg@apple.com
Message:

Stores to PropertyTable use the Structure as the owner
https://bugs.webkit.org/show_bug.cgi?id=134595

Reviewed by Darin Adler.

Since PropertyTable is the object that does the marking of these references, it should be the owner.

Also removed some unused parameters to other methods that historically used the Structure as the owner.

  • runtime/JSPropertyNameIterator.h:

(JSC::StructureRareData::setEnumerationCache):

  • runtime/ObjectPrototype.cpp:

(JSC::objectProtoFuncToString):

  • runtime/PropertyMapHashTable.h:

(JSC::PropertyTable::copy):

  • runtime/PropertyTable.cpp:

(JSC::PropertyTable::clone):
(JSC::PropertyTable::PropertyTable):

  • runtime/Structure.cpp:

(JSC::Structure::Structure):
(JSC::Structure::materializePropertyMap):
(JSC::Structure::addPropertyTransition):
(JSC::Structure::changePrototypeTransition):
(JSC::Structure::despecifyFunctionTransition):
(JSC::Structure::attributeChangeTransition):
(JSC::Structure::toDictionaryTransition):
(JSC::Structure::preventExtensionsTransition):
(JSC::Structure::takePropertyTableOrCloneIfPinned):
(JSC::Structure::nonPropertyTransition):
(JSC::Structure::copyPropertyTable):
(JSC::Structure::copyPropertyTableForPinning):
(JSC::Structure::putSpecificValue):

  • runtime/Structure.h:

(JSC::Structure::setObjectToStringValue):
(JSC::Structure::setPreviousID):

  • runtime/StructureInlines.h:

(JSC::Structure::setEnumerationCache):

  • runtime/StructureRareData.h:
  • runtime/StructureRareDataInlines.h:

(JSC::StructureRareData::setPreviousID):
(JSC::StructureRareData::setObjectToStringValue):

Location:
trunk/Source/JavaScriptCore
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r171108 r171115  
     12014-07-15  Mark Hahnenberg  <mhahnenberg@apple.com>
     2
     3        Stores to PropertyTable use the Structure as the owner
     4        https://bugs.webkit.org/show_bug.cgi?id=134595
     5
     6        Reviewed by Darin Adler.
     7
     8        Since PropertyTable is the object that does the marking of these references, it should be the owner.
     9
     10        Also removed some unused parameters to other methods that historically used the Structure as the owner.
     11
     12        * runtime/JSPropertyNameIterator.h:
     13        (JSC::StructureRareData::setEnumerationCache):
     14        * runtime/ObjectPrototype.cpp:
     15        (JSC::objectProtoFuncToString):
     16        * runtime/PropertyMapHashTable.h:
     17        (JSC::PropertyTable::copy):
     18        * runtime/PropertyTable.cpp:
     19        (JSC::PropertyTable::clone):
     20        (JSC::PropertyTable::PropertyTable):
     21        * runtime/Structure.cpp:
     22        (JSC::Structure::Structure):
     23        (JSC::Structure::materializePropertyMap):
     24        (JSC::Structure::addPropertyTransition):
     25        (JSC::Structure::changePrototypeTransition):
     26        (JSC::Structure::despecifyFunctionTransition):
     27        (JSC::Structure::attributeChangeTransition):
     28        (JSC::Structure::toDictionaryTransition):
     29        (JSC::Structure::preventExtensionsTransition):
     30        (JSC::Structure::takePropertyTableOrCloneIfPinned):
     31        (JSC::Structure::nonPropertyTransition):
     32        (JSC::Structure::copyPropertyTable):
     33        (JSC::Structure::copyPropertyTableForPinning):
     34        (JSC::Structure::putSpecificValue):
     35        * runtime/Structure.h:
     36        (JSC::Structure::setObjectToStringValue):
     37        (JSC::Structure::setPreviousID):
     38        * runtime/StructureInlines.h:
     39        (JSC::Structure::setEnumerationCache):
     40        * runtime/StructureRareData.h:
     41        * runtime/StructureRareDataInlines.h:
     42        (JSC::StructureRareData::setPreviousID):
     43        (JSC::StructureRareData::setObjectToStringValue):
     44
    1452014-07-15  Mark Hahnenberg  <mhahnenberg@apple.com>
    246
  • trunk/Source/JavaScriptCore/runtime/JSPropertyNameIterator.h

    r165676 r171115  
    111111    }
    112112   
    113     inline void StructureRareData::setEnumerationCache(VM& vm, const Structure*, JSPropertyNameIterator* value)
     113    inline void StructureRareData::setEnumerationCache(VM& vm, JSPropertyNameIterator* value)
    114114    {
    115115        m_enumerationCache.set(vm, this, value);
  • trunk/Source/JavaScriptCore/runtime/ObjectPrototype.cpp

    r169316 r171115  
    226226
    227227        result = jsNontrivialString(&vm, newString.release());
    228         thisObject->structure(vm)->setObjectToStringValue(vm, thisObject, result);
     228        thisObject->structure(vm)->setObjectToStringValue(vm, result);
    229229    }
    230230    return JSValue::encode(result);
  • trunk/Source/JavaScriptCore/runtime/PropertyMapHashTable.h

    r169824 r171115  
    164164    // Constructor is passed an initial capacity, a PropertyTable to copy, or both.
    165165    static PropertyTable* create(VM&, unsigned initialCapacity);
    166     static PropertyTable* clone(VM&, JSCell* owner, const PropertyTable&);
    167     static PropertyTable* clone(VM&, JSCell* owner, unsigned initialCapacity, const PropertyTable&);
     166    static PropertyTable* clone(VM&, const PropertyTable&);
     167    static PropertyTable* clone(VM&, unsigned initialCapacity, const PropertyTable&);
    168168    ~PropertyTable();
    169169
     
    203203
    204204    // Copy this PropertyTable, ensuring the copy has at least the capacity provided.
    205     PropertyTable* copy(VM&, JSCell* owner, unsigned newCapacity);
     205    PropertyTable* copy(VM&, unsigned newCapacity);
    206206
    207207#ifndef NDEBUG
     
    215215private:
    216216    PropertyTable(VM&, unsigned initialCapacity);
    217     PropertyTable(VM&, JSCell*, const PropertyTable&);
    218     PropertyTable(VM&, JSCell*, unsigned initialCapacity, const PropertyTable&);
     217    PropertyTable(VM&, const PropertyTable&);
     218    PropertyTable(VM&, unsigned initialCapacity, const PropertyTable&);
    219219
    220220    PropertyTable(const PropertyTable&);
     
    499499}
    500500
    501 inline PropertyTable* PropertyTable::copy(VM& vm, JSCell* owner, unsigned newCapacity)
     501inline PropertyTable* PropertyTable::copy(VM& vm, unsigned newCapacity)
    502502{
    503503    ASSERT(newCapacity >= m_keyCount);
     
    506506    // save rehashing all keys.
    507507    if (sizeForCapacity(newCapacity) == m_indexSize)
    508         return PropertyTable::clone(vm, owner, *this);
    509     return PropertyTable::clone(vm, owner, newCapacity, *this);
     508        return PropertyTable::clone(vm, *this);
     509    return PropertyTable::clone(vm, newCapacity, *this);
    510510}
    511511
  • trunk/Source/JavaScriptCore/runtime/PropertyTable.cpp

    r165676 r171115  
    4545}
    4646
    47 PropertyTable* PropertyTable::clone(VM& vm, JSCell* owner, const PropertyTable& other)
     47PropertyTable* PropertyTable::clone(VM& vm, const PropertyTable& other)
    4848{
    49     PropertyTable* table = new (NotNull, allocateCell<PropertyTable>(vm.heap)) PropertyTable(vm, owner, other);
     49    PropertyTable* table = new (NotNull, allocateCell<PropertyTable>(vm.heap)) PropertyTable(vm, other);
    5050    table->finishCreation(vm);
    5151    return table;
    5252}
    5353
    54 PropertyTable* PropertyTable::clone(VM& vm, JSCell* owner, unsigned initialCapacity, const PropertyTable& other)
     54PropertyTable* PropertyTable::clone(VM& vm, unsigned initialCapacity, const PropertyTable& other)
    5555{
    56     PropertyTable* table = new (NotNull, allocateCell<PropertyTable>(vm.heap)) PropertyTable(vm, owner, initialCapacity, other);
     56    PropertyTable* table = new (NotNull, allocateCell<PropertyTable>(vm.heap)) PropertyTable(vm, initialCapacity, other);
    5757    table->finishCreation(vm);
    5858    return table;
     
    7070}
    7171
    72 PropertyTable::PropertyTable(VM& vm, JSCell* owner, const PropertyTable& other)
     72PropertyTable::PropertyTable(VM& vm, const PropertyTable& other)
    7373    : JSCell(vm, vm.propertyTableStructure.get())
    7474    , m_indexSize(other.m_indexSize)
     
    8585    for (iterator iter = begin(); iter != end; ++iter) {
    8686        iter->key->ref();
    87         vm.heap.writeBarrier(owner, iter->specificValue.get());
     87        vm.heap.writeBarrier(this, iter->specificValue.get());
    8888    }
    8989
     
    9494}
    9595
    96 PropertyTable::PropertyTable(VM& vm, JSCell* owner, unsigned initialCapacity, const PropertyTable& other)
     96PropertyTable::PropertyTable(VM& vm, unsigned initialCapacity, const PropertyTable& other)
    9797    : JSCell(vm, vm.propertyTableStructure.get())
    9898    , m_indexSize(sizeForCapacity(initialCapacity))
     
    110110        reinsert(*iter);
    111111        iter->key->ref();
    112         vm.heap.writeBarrier(owner, iter->specificValue.get());
     112        vm.heap.writeBarrier(this, iter->specificValue.get());
    113113    }
    114114
  • trunk/Source/JavaScriptCore/runtime/Structure.cpp

    r171092 r171115  
    238238    if (previous->m_hasRareData && previous->rareData()->needsCloning())
    239239        cloneRareDataFrom(vm, previous);
    240     setPreviousID(vm, this, previous);
     240    setPreviousID(vm, previous);
    241241
    242242    previous->notifyTransitionFromThisStructure();
     
    294294   
    295295    if (table) {
    296         table = table->copy(vm, structure, numberOfSlotsForLastOffset(m_offset, m_inlineCapacity));
     296        table = table->copy(vm, numberOfSlotsForLastOffset(m_offset, m_inlineCapacity));
    297297        structure->m_lock.unlock();
    298298    }
     
    451451    transition->m_attributesInPrevious = attributes;
    452452    transition->m_specificValueInPrevious.setMayBeNull(vm, transition, specificValue);
    453     transition->propertyTable().set(vm, transition, structure->takePropertyTableOrCloneIfPinned(vm, transition));
     453    transition->propertyTable().set(vm, transition, structure->takePropertyTableOrCloneIfPinned(vm));
    454454    transition->m_offset = structure->m_offset;
    455455
     
    486486    DeferGC deferGC(vm.heap);
    487487    structure->materializePropertyMapIfNecessary(vm, deferGC);
    488     transition->propertyTable().set(vm, transition, structure->copyPropertyTableForPinning(vm, transition));
     488    transition->propertyTable().set(vm, transition, structure->copyPropertyTableForPinning(vm));
    489489    transition->m_offset = structure->m_offset;
    490490    transition->pin();
     
    503503    DeferGC deferGC(vm.heap);
    504504    structure->materializePropertyMapIfNecessary(vm, deferGC);
    505     transition->propertyTable().set(vm, transition, structure->copyPropertyTableForPinning(vm, transition));
     505    transition->propertyTable().set(vm, transition, structure->copyPropertyTableForPinning(vm));
    506506    transition->m_offset = structure->m_offset;
    507507    transition->pin();
     
    525525
    526526        structure->materializePropertyMapIfNecessary(vm, deferGC);
    527         transition->propertyTable().set(vm, transition, structure->copyPropertyTableForPinning(vm, transition));
     527        transition->propertyTable().set(vm, transition, structure->copyPropertyTableForPinning(vm));
    528528        transition->m_offset = structure->m_offset;
    529529        transition->pin();
     
    549549    DeferGC deferGC(vm.heap);
    550550    structure->materializePropertyMapIfNecessary(vm, deferGC);
    551     transition->propertyTable().set(vm, transition, structure->copyPropertyTableForPinning(vm, transition));
     551    transition->propertyTable().set(vm, transition, structure->copyPropertyTableForPinning(vm));
    552552    transition->m_offset = structure->m_offset;
    553553    transition->m_dictionaryKind = kind;
     
    612612    DeferGC deferGC(vm.heap);
    613613    structure->materializePropertyMapIfNecessary(vm, deferGC);
    614     transition->propertyTable().set(vm, transition, structure->copyPropertyTableForPinning(vm, transition));
     614    transition->propertyTable().set(vm, transition, structure->copyPropertyTableForPinning(vm));
    615615    transition->m_offset = structure->m_offset;
    616616    transition->m_preventExtensions = true;
     
    621621}
    622622
    623 PropertyTable* Structure::takePropertyTableOrCloneIfPinned(VM& vm, Structure* owner)
     623PropertyTable* Structure::takePropertyTableOrCloneIfPinned(VM& vm)
    624624{
    625625    DeferGC deferGC(vm.heap);
     
    627627   
    628628    if (m_isPinnedPropertyTable)
    629         return propertyTable()->copy(vm, owner, propertyTable()->size() + 1);
     629        return propertyTable()->copy(vm, propertyTable()->size() + 1);
    630630   
    631631    // Hold the lock while stealing the table - so that getConcurrently() on another thread
     
    663663    transition->m_attributesInPrevious = attributes;
    664664    transition->m_blob.setIndexingType(indexingType);
    665     transition->propertyTable().set(vm, transition, structure->takePropertyTableOrCloneIfPinned(vm, transition));
     665    transition->propertyTable().set(vm, transition, structure->takePropertyTableOrCloneIfPinned(vm));
    666666    transition->m_offset = structure->m_offset;
    667667    checkOffset(transition->m_offset, transition->inlineCapacity());
     
    865865#endif
    866866
    867 PropertyTable* Structure::copyPropertyTable(VM& vm, Structure* owner)
     867PropertyTable* Structure::copyPropertyTable(VM& vm)
    868868{
    869869    if (!propertyTable())
    870870        return 0;
    871     return PropertyTable::clone(vm, owner, *propertyTable().get());
    872 }
    873 
    874 PropertyTable* Structure::copyPropertyTableForPinning(VM& vm, Structure* owner)
     871    return PropertyTable::clone(vm, *propertyTable().get());
     872}
     873
     874PropertyTable* Structure::copyPropertyTableForPinning(VM& vm)
    875875{
    876876    if (propertyTable())
    877         return PropertyTable::clone(vm, owner, *propertyTable().get());
     877        return PropertyTable::clone(vm, *propertyTable().get());
    878878    return PropertyTable::create(vm, numberOfSlotsForLastOffset(m_offset, m_inlineCapacity));
    879879}
     
    957957    PropertyOffset newOffset = propertyTable()->nextOffset(m_inlineCapacity);
    958958
    959     propertyTable()->add(PropertyMapEntry(vm, this, rep, newOffset, attributes, specificValue), m_offset, PropertyTable::PropertyOffsetMayChange);
     959    propertyTable()->add(PropertyMapEntry(vm, propertyTable().get(), rep, newOffset, attributes, specificValue), m_offset, PropertyTable::PropertyOffsetMayChange);
    960960   
    961961    checkConsistency();
  • trunk/Source/JavaScriptCore/runtime/Structure.h

    r170256 r171115  
    316316    }
    317317
    318     void setObjectToStringValue(VM& vm, const JSCell* owner, JSString* value)
     318    void setObjectToStringValue(VM& vm, JSString* value)
    319319    {
    320320        if (!m_hasRareData)
    321321            allocateRareData(vm);
    322         rareData()->setObjectToStringValue(vm, owner, value);
     322        rareData()->setObjectToStringValue(vm, value);
    323323    }
    324324
     
    430430
    431431    WriteBarrier<PropertyTable>& propertyTable();
    432     PropertyTable* takePropertyTableOrCloneIfPinned(VM&, Structure* owner);
    433     PropertyTable* copyPropertyTable(VM&, Structure* owner);
    434     PropertyTable* copyPropertyTableForPinning(VM&, Structure* owner);
     432    PropertyTable* takePropertyTableOrCloneIfPinned(VM&);
     433    PropertyTable* copyPropertyTable(VM&);
     434    PropertyTable* copyPropertyTableForPinning(VM&);
    435435    JS_EXPORT_PRIVATE void materializePropertyMap(VM&);
    436436    ALWAYS_INLINE void materializePropertyMapIfNecessary(VM& vm, DeferGC&)
     
    462462    }
    463463
    464     void setPreviousID(VM& vm, Structure* transition, Structure* structure)
     464    void setPreviousID(VM& vm, Structure* structure)
    465465    {
    466466        if (m_hasRareData)
    467             rareData()->setPreviousID(vm, transition, structure);
     467            rareData()->setPreviousID(vm, structure);
    468468        else
    469             m_previousOrRareData.set(vm, transition, structure);
     469            m_previousOrRareData.set(vm, this, structure);
    470470    }
    471471
  • trunk/Source/JavaScriptCore/runtime/StructureInlines.h

    r169903 r171115  
    157157    if (!m_hasRareData)
    158158        allocateRareData(vm);
    159     rareData()->setEnumerationCache(vm, this, enumerationCache);
     159    rareData()->setEnumerationCache(vm, enumerationCache);
    160160}
    161161
  • trunk/Source/JavaScriptCore/runtime/StructureRareData.h

    r154038 r171115  
    5050
    5151    Structure* previousID() const;
    52     void setPreviousID(VM&, Structure* transition, Structure*);
     52    void setPreviousID(VM&, Structure*);
    5353    void clearPreviousID();
    5454
    5555    JSString* objectToStringValue() const;
    56     void setObjectToStringValue(VM&, const JSCell* owner, JSString* value);
     56    void setObjectToStringValue(VM&, JSString* value);
    5757
    5858    JSPropertyNameIterator* enumerationCache();
    59     void setEnumerationCache(VM&, const Structure* owner, JSPropertyNameIterator* value);
     59    void setEnumerationCache(VM&, JSPropertyNameIterator* value);
    6060
    6161    DECLARE_EXPORT_INFO;
  • trunk/Source/JavaScriptCore/runtime/StructureRareDataInlines.h

    r161615 r171115  
    3636}
    3737
    38 inline void StructureRareData::setPreviousID(VM& vm, Structure*, Structure* structure)
     38inline void StructureRareData::setPreviousID(VM& vm, Structure* structure)
    3939{
    4040    m_previous.set(vm, this, structure);
     
    5151}
    5252
    53 inline void StructureRareData::setObjectToStringValue(VM& vm, const JSCell*, JSString* value)
     53inline void StructureRareData::setObjectToStringValue(VM& vm, JSString* value)
    5454{
    5555    m_objectToStringValue.set(vm, this, value);
Note: See TracChangeset for help on using the changeset viewer.