Changeset 141681 in webkit


Ignore:
Timestamp:
Feb 1, 2013 7:57:42 PM (11 years ago)
Author:
mhahnenberg@apple.com
Message:

Structure::m_enumerationCache should be moved to StructureRareData
https://bugs.webkit.org/show_bug.cgi?id=108723

Reviewed by Oliver Hunt.

m_enumerationCache is only used by objects whose properties are iterated over, so not every Structure needs this
field and it can therefore be moved safely to StructureRareData to help with memory savings.

  • runtime/JSPropertyNameIterator.h:

(JSPropertyNameIterator):
(JSC::Register::propertyNameIterator):
(JSC::StructureRareData::enumerationCache): Add to JSPropertyNameIterator.h so that it can see the correct type.
(JSC::StructureRareData::setEnumerationCache): Ditto.

  • runtime/Structure.cpp:

(JSC::Structure::addPropertyWithoutTransition): Use the enumerationCache() getter rather than accessing the field.
(JSC::Structure::removePropertyWithoutTransition): Ditto.
(JSC::Structure::visitChildren): We no longer have to worry about marking the m_enumerationCache field.

  • runtime/Structure.h:

(JSC::Structure::setEnumerationCache): Move the old accessors back since we don't have to have any knowledge of
the JSPropertyNameIterator type.
(JSC::Structure::enumerationCache): Ditto.

  • runtime/StructureRareData.cpp:

(JSC::StructureRareData::visitChildren): Mark the new m_enumerationCache field.

  • runtime/StructureRareData.h: Add new functions/fields.

(StructureRareData):

Location:
trunk/Source/JavaScriptCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r141677 r141681  
     12013-02-01  Mark Hahnenberg  <mhahnenberg@apple.com>
     2
     3        Structure::m_enumerationCache should be moved to StructureRareData
     4        https://bugs.webkit.org/show_bug.cgi?id=108723
     5
     6        Reviewed by Oliver Hunt.
     7
     8        m_enumerationCache is only used by objects whose properties are iterated over, so not every Structure needs this
     9        field and it can therefore be moved safely to StructureRareData to help with memory savings.
     10
     11        * runtime/JSPropertyNameIterator.h:
     12        (JSPropertyNameIterator):
     13        (JSC::Register::propertyNameIterator):
     14        (JSC::StructureRareData::enumerationCache): Add to JSPropertyNameIterator.h so that it can see the correct type.
     15        (JSC::StructureRareData::setEnumerationCache): Ditto.
     16        * runtime/Structure.cpp:
     17        (JSC::Structure::addPropertyWithoutTransition): Use the enumerationCache() getter rather than accessing the field.
     18        (JSC::Structure::removePropertyWithoutTransition): Ditto.
     19        (JSC::Structure::visitChildren): We no longer have to worry about marking the m_enumerationCache field.
     20        * runtime/Structure.h:
     21        (JSC::Structure::setEnumerationCache): Move the old accessors back since we don't have to have any knowledge of
     22        the JSPropertyNameIterator type.
     23        (JSC::Structure::enumerationCache): Ditto.
     24        * runtime/StructureRareData.cpp:
     25        (JSC::StructureRareData::visitChildren): Mark the new m_enumerationCache field.
     26        * runtime/StructureRareData.h: Add new functions/fields.
     27        (StructureRareData):
     28
    1292013-02-01  Roger Fong  <roger_fong@apple.com>
    230
  • trunk/Source/JavaScriptCore/runtime/JSPropertyNameIterator.h

    r130359 r141681  
    7474        StructureChain* cachedPrototypeChain() { return m_cachedPrototypeChain.get(); }
    7575       
    76         static const ClassInfo s_info;
     76        static JS_EXPORTDATA const ClassInfo s_info;
    7777
    7878    protected:
     
    9999    };
    100100
    101     inline void Structure::setEnumerationCache(JSGlobalData& globalData, JSPropertyNameIterator* enumerationCache)
    102     {
    103         ASSERT(!isDictionary());
    104         m_enumerationCache.set(globalData, this, enumerationCache);
    105     }
    106 
    107     inline JSPropertyNameIterator* Structure::enumerationCache()
    108     {
    109         return m_enumerationCache.get();
    110     }
    111 
    112101    ALWAYS_INLINE JSPropertyNameIterator* Register::propertyNameIterator() const
    113102    {
     
    115104    }
    116105
     106    inline JSPropertyNameIterator* StructureRareData::enumerationCache()
     107    {
     108        return m_enumerationCache.get();
     109    }
     110   
     111    inline void StructureRareData::setEnumerationCache(JSGlobalData& globalData, const Structure* owner, JSPropertyNameIterator* value)
     112    {
     113        m_enumerationCache.set(globalData, owner, value);
     114    }
     115
    117116} // namespace JSC
    118117
  • trunk/Source/JavaScriptCore/runtime/Structure.cpp

    r141651 r141681  
    646646PropertyOffset Structure::addPropertyWithoutTransition(JSGlobalData& globalData, PropertyName propertyName, unsigned attributes, JSCell* specificValue)
    647647{
    648     ASSERT(!m_enumerationCache);
     648    ASSERT(!enumerationCache());
    649649
    650650    if (m_specificFunctionThrashCount == maxSpecificFunctionThrashCount)
     
    661661{
    662662    ASSERT(isUncacheableDictionary());
    663     ASSERT(!m_enumerationCache);
     663    ASSERT(!enumerationCache());
    664664
    665665    materializePropertyMapIfNecessaryForPinning(globalData);
     
    860860    visitor.append(&thisObject->m_previousOrRareData);
    861861    visitor.append(&thisObject->m_specificValueInPrevious);
    862     visitor.append(&thisObject->m_enumerationCache);
    863862    if (thisObject->m_propertyTable) {
    864863        PropertyTable::iterator end = thisObject->m_propertyTable->end();
  • trunk/Source/JavaScriptCore/runtime/Structure.h

    r141651 r141681  
    477477        StructureTransitionTable m_transitionTable;
    478478
    479         WriteBarrier<JSPropertyNameIterator> m_enumerationCache;
    480 
    481479        OwnPtr<PropertyTable> m_propertyTable;
    482480
     
    585583    }
    586584
     585    inline void Structure::setEnumerationCache(JSGlobalData& globalData, JSPropertyNameIterator* enumerationCache)
     586    {
     587        ASSERT(!isDictionary());
     588        if (!typeInfo().structureHasRareData())
     589            allocateRareData(globalData);
     590        rareData()->setEnumerationCache(globalData, this, enumerationCache);
     591    }
     592
     593    inline JSPropertyNameIterator* Structure::enumerationCache()
     594    {
     595        if (!typeInfo().structureHasRareData())
     596            return 0;
     597        return rareData()->enumerationCache();
     598    }
     599
    587600} // namespace JSC
    588601
  • trunk/Source/JavaScriptCore/runtime/StructureRareData.cpp

    r141651 r141681  
    8080    visitor.append(&thisObject->m_previous);
    8181    visitor.append(&thisObject->m_objectToStringValue);
     82    visitor.append(&thisObject->m_enumerationCache);
    8283}
    8384
  • trunk/Source/JavaScriptCore/runtime/StructureRareData.h

    r141651 r141681  
    3333namespace JSC {
    3434
     35class JSPropertyNameIterator;
    3536class Structure;
    3637
     
    5253    void setObjectToStringValue(JSGlobalData&, const JSCell* owner, JSString* value);
    5354
     55    JSPropertyNameIterator* enumerationCache();
     56    void setEnumerationCache(JSGlobalData&, const Structure* owner, JSPropertyNameIterator* value);
     57
    5458    static JS_EXPORTDATA const ClassInfo s_info;
    5559
     
    6266    WriteBarrier<Structure> m_previous;
    6367    WriteBarrier<JSString> m_objectToStringValue;
     68    WriteBarrier<JSPropertyNameIterator> m_enumerationCache;
    6469};
    6570
Note: See TracChangeset for help on using the changeset viewer.