Changeset 141681 in webkit
- Timestamp:
- Feb 1, 2013 7:57:42 PM (11 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r141677 r141681 1 2013-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 1 29 2013-02-01 Roger Fong <roger_fong@apple.com> 2 30 -
trunk/Source/JavaScriptCore/runtime/JSPropertyNameIterator.h
r130359 r141681 74 74 StructureChain* cachedPrototypeChain() { return m_cachedPrototypeChain.get(); } 75 75 76 static const ClassInfo s_info;76 static JS_EXPORTDATA const ClassInfo s_info; 77 77 78 78 protected: … … 99 99 }; 100 100 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 112 101 ALWAYS_INLINE JSPropertyNameIterator* Register::propertyNameIterator() const 113 102 { … … 115 104 } 116 105 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 117 116 } // namespace JSC 118 117 -
trunk/Source/JavaScriptCore/runtime/Structure.cpp
r141651 r141681 646 646 PropertyOffset Structure::addPropertyWithoutTransition(JSGlobalData& globalData, PropertyName propertyName, unsigned attributes, JSCell* specificValue) 647 647 { 648 ASSERT(! m_enumerationCache);648 ASSERT(!enumerationCache()); 649 649 650 650 if (m_specificFunctionThrashCount == maxSpecificFunctionThrashCount) … … 661 661 { 662 662 ASSERT(isUncacheableDictionary()); 663 ASSERT(! m_enumerationCache);663 ASSERT(!enumerationCache()); 664 664 665 665 materializePropertyMapIfNecessaryForPinning(globalData); … … 860 860 visitor.append(&thisObject->m_previousOrRareData); 861 861 visitor.append(&thisObject->m_specificValueInPrevious); 862 visitor.append(&thisObject->m_enumerationCache);863 862 if (thisObject->m_propertyTable) { 864 863 PropertyTable::iterator end = thisObject->m_propertyTable->end(); -
trunk/Source/JavaScriptCore/runtime/Structure.h
r141651 r141681 477 477 StructureTransitionTable m_transitionTable; 478 478 479 WriteBarrier<JSPropertyNameIterator> m_enumerationCache;480 481 479 OwnPtr<PropertyTable> m_propertyTable; 482 480 … … 585 583 } 586 584 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 587 600 } // namespace JSC 588 601 -
trunk/Source/JavaScriptCore/runtime/StructureRareData.cpp
r141651 r141681 80 80 visitor.append(&thisObject->m_previous); 81 81 visitor.append(&thisObject->m_objectToStringValue); 82 visitor.append(&thisObject->m_enumerationCache); 82 83 } 83 84 -
trunk/Source/JavaScriptCore/runtime/StructureRareData.h
r141651 r141681 33 33 namespace JSC { 34 34 35 class JSPropertyNameIterator; 35 36 class Structure; 36 37 … … 52 53 void setObjectToStringValue(JSGlobalData&, const JSCell* owner, JSString* value); 53 54 55 JSPropertyNameIterator* enumerationCache(); 56 void setEnumerationCache(JSGlobalData&, const Structure* owner, JSPropertyNameIterator* value); 57 54 58 static JS_EXPORTDATA const ClassInfo s_info; 55 59 … … 62 66 WriteBarrier<Structure> m_previous; 63 67 WriteBarrier<JSString> m_objectToStringValue; 68 WriteBarrier<JSPropertyNameIterator> m_enumerationCache; 64 69 }; 65 70
Note: See TracChangeset
for help on using the changeset viewer.