Changeset 171115 in webkit
- Timestamp:
- Jul 15, 2014, 2:05:43 PM (11 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r171108 r171115 1 2014-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 1 45 2014-07-15 Mark Hahnenberg <mhahnenberg@apple.com> 2 46 -
trunk/Source/JavaScriptCore/runtime/JSPropertyNameIterator.h
r165676 r171115 111 111 } 112 112 113 inline void StructureRareData::setEnumerationCache(VM& vm, const Structure*,JSPropertyNameIterator* value)113 inline void StructureRareData::setEnumerationCache(VM& vm, JSPropertyNameIterator* value) 114 114 { 115 115 m_enumerationCache.set(vm, this, value); -
trunk/Source/JavaScriptCore/runtime/ObjectPrototype.cpp
r169316 r171115 226 226 227 227 result = jsNontrivialString(&vm, newString.release()); 228 thisObject->structure(vm)->setObjectToStringValue(vm, thisObject,result);228 thisObject->structure(vm)->setObjectToStringValue(vm, result); 229 229 } 230 230 return JSValue::encode(result); -
trunk/Source/JavaScriptCore/runtime/PropertyMapHashTable.h
r169824 r171115 164 164 // Constructor is passed an initial capacity, a PropertyTable to copy, or both. 165 165 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&); 168 168 ~PropertyTable(); 169 169 … … 203 203 204 204 // 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); 206 206 207 207 #ifndef NDEBUG … … 215 215 private: 216 216 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&); 219 219 220 220 PropertyTable(const PropertyTable&); … … 499 499 } 500 500 501 inline PropertyTable* PropertyTable::copy(VM& vm, JSCell* owner,unsigned newCapacity)501 inline PropertyTable* PropertyTable::copy(VM& vm, unsigned newCapacity) 502 502 { 503 503 ASSERT(newCapacity >= m_keyCount); … … 506 506 // save rehashing all keys. 507 507 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); 510 510 } 511 511 -
trunk/Source/JavaScriptCore/runtime/PropertyTable.cpp
r165676 r171115 45 45 } 46 46 47 PropertyTable* PropertyTable::clone(VM& vm, JSCell* owner,const PropertyTable& other)47 PropertyTable* PropertyTable::clone(VM& vm, const PropertyTable& other) 48 48 { 49 PropertyTable* table = new (NotNull, allocateCell<PropertyTable>(vm.heap)) PropertyTable(vm, o wner, other);49 PropertyTable* table = new (NotNull, allocateCell<PropertyTable>(vm.heap)) PropertyTable(vm, other); 50 50 table->finishCreation(vm); 51 51 return table; 52 52 } 53 53 54 PropertyTable* PropertyTable::clone(VM& vm, JSCell* owner,unsigned initialCapacity, const PropertyTable& other)54 PropertyTable* PropertyTable::clone(VM& vm, unsigned initialCapacity, const PropertyTable& other) 55 55 { 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); 57 57 table->finishCreation(vm); 58 58 return table; … … 70 70 } 71 71 72 PropertyTable::PropertyTable(VM& vm, JSCell* owner,const PropertyTable& other)72 PropertyTable::PropertyTable(VM& vm, const PropertyTable& other) 73 73 : JSCell(vm, vm.propertyTableStructure.get()) 74 74 , m_indexSize(other.m_indexSize) … … 85 85 for (iterator iter = begin(); iter != end; ++iter) { 86 86 iter->key->ref(); 87 vm.heap.writeBarrier( owner, iter->specificValue.get());87 vm.heap.writeBarrier(this, iter->specificValue.get()); 88 88 } 89 89 … … 94 94 } 95 95 96 PropertyTable::PropertyTable(VM& vm, JSCell* owner,unsigned initialCapacity, const PropertyTable& other)96 PropertyTable::PropertyTable(VM& vm, unsigned initialCapacity, const PropertyTable& other) 97 97 : JSCell(vm, vm.propertyTableStructure.get()) 98 98 , m_indexSize(sizeForCapacity(initialCapacity)) … … 110 110 reinsert(*iter); 111 111 iter->key->ref(); 112 vm.heap.writeBarrier( owner, iter->specificValue.get());112 vm.heap.writeBarrier(this, iter->specificValue.get()); 113 113 } 114 114 -
trunk/Source/JavaScriptCore/runtime/Structure.cpp
r171092 r171115 238 238 if (previous->m_hasRareData && previous->rareData()->needsCloning()) 239 239 cloneRareDataFrom(vm, previous); 240 setPreviousID(vm, this,previous);240 setPreviousID(vm, previous); 241 241 242 242 previous->notifyTransitionFromThisStructure(); … … 294 294 295 295 if (table) { 296 table = table->copy(vm, structure,numberOfSlotsForLastOffset(m_offset, m_inlineCapacity));296 table = table->copy(vm, numberOfSlotsForLastOffset(m_offset, m_inlineCapacity)); 297 297 structure->m_lock.unlock(); 298 298 } … … 451 451 transition->m_attributesInPrevious = attributes; 452 452 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)); 454 454 transition->m_offset = structure->m_offset; 455 455 … … 486 486 DeferGC deferGC(vm.heap); 487 487 structure->materializePropertyMapIfNecessary(vm, deferGC); 488 transition->propertyTable().set(vm, transition, structure->copyPropertyTableForPinning(vm , transition));488 transition->propertyTable().set(vm, transition, structure->copyPropertyTableForPinning(vm)); 489 489 transition->m_offset = structure->m_offset; 490 490 transition->pin(); … … 503 503 DeferGC deferGC(vm.heap); 504 504 structure->materializePropertyMapIfNecessary(vm, deferGC); 505 transition->propertyTable().set(vm, transition, structure->copyPropertyTableForPinning(vm , transition));505 transition->propertyTable().set(vm, transition, structure->copyPropertyTableForPinning(vm)); 506 506 transition->m_offset = structure->m_offset; 507 507 transition->pin(); … … 525 525 526 526 structure->materializePropertyMapIfNecessary(vm, deferGC); 527 transition->propertyTable().set(vm, transition, structure->copyPropertyTableForPinning(vm , transition));527 transition->propertyTable().set(vm, transition, structure->copyPropertyTableForPinning(vm)); 528 528 transition->m_offset = structure->m_offset; 529 529 transition->pin(); … … 549 549 DeferGC deferGC(vm.heap); 550 550 structure->materializePropertyMapIfNecessary(vm, deferGC); 551 transition->propertyTable().set(vm, transition, structure->copyPropertyTableForPinning(vm , transition));551 transition->propertyTable().set(vm, transition, structure->copyPropertyTableForPinning(vm)); 552 552 transition->m_offset = structure->m_offset; 553 553 transition->m_dictionaryKind = kind; … … 612 612 DeferGC deferGC(vm.heap); 613 613 structure->materializePropertyMapIfNecessary(vm, deferGC); 614 transition->propertyTable().set(vm, transition, structure->copyPropertyTableForPinning(vm , transition));614 transition->propertyTable().set(vm, transition, structure->copyPropertyTableForPinning(vm)); 615 615 transition->m_offset = structure->m_offset; 616 616 transition->m_preventExtensions = true; … … 621 621 } 622 622 623 PropertyTable* Structure::takePropertyTableOrCloneIfPinned(VM& vm , Structure* owner)623 PropertyTable* Structure::takePropertyTableOrCloneIfPinned(VM& vm) 624 624 { 625 625 DeferGC deferGC(vm.heap); … … 627 627 628 628 if (m_isPinnedPropertyTable) 629 return propertyTable()->copy(vm, owner,propertyTable()->size() + 1);629 return propertyTable()->copy(vm, propertyTable()->size() + 1); 630 630 631 631 // Hold the lock while stealing the table - so that getConcurrently() on another thread … … 663 663 transition->m_attributesInPrevious = attributes; 664 664 transition->m_blob.setIndexingType(indexingType); 665 transition->propertyTable().set(vm, transition, structure->takePropertyTableOrCloneIfPinned(vm , transition));665 transition->propertyTable().set(vm, transition, structure->takePropertyTableOrCloneIfPinned(vm)); 666 666 transition->m_offset = structure->m_offset; 667 667 checkOffset(transition->m_offset, transition->inlineCapacity()); … … 865 865 #endif 866 866 867 PropertyTable* Structure::copyPropertyTable(VM& vm , Structure* owner)867 PropertyTable* Structure::copyPropertyTable(VM& vm) 868 868 { 869 869 if (!propertyTable()) 870 870 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 874 PropertyTable* Structure::copyPropertyTableForPinning(VM& vm) 875 875 { 876 876 if (propertyTable()) 877 return PropertyTable::clone(vm, owner,*propertyTable().get());877 return PropertyTable::clone(vm, *propertyTable().get()); 878 878 return PropertyTable::create(vm, numberOfSlotsForLastOffset(m_offset, m_inlineCapacity)); 879 879 } … … 957 957 PropertyOffset newOffset = propertyTable()->nextOffset(m_inlineCapacity); 958 958 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); 960 960 961 961 checkConsistency(); -
trunk/Source/JavaScriptCore/runtime/Structure.h
r170256 r171115 316 316 } 317 317 318 void setObjectToStringValue(VM& vm, const JSCell* owner,JSString* value)318 void setObjectToStringValue(VM& vm, JSString* value) 319 319 { 320 320 if (!m_hasRareData) 321 321 allocateRareData(vm); 322 rareData()->setObjectToStringValue(vm, owner,value);322 rareData()->setObjectToStringValue(vm, value); 323 323 } 324 324 … … 430 430 431 431 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&); 435 435 JS_EXPORT_PRIVATE void materializePropertyMap(VM&); 436 436 ALWAYS_INLINE void materializePropertyMapIfNecessary(VM& vm, DeferGC&) … … 462 462 } 463 463 464 void setPreviousID(VM& vm, Structure* transition, Structure*structure)464 void setPreviousID(VM& vm, Structure* structure) 465 465 { 466 466 if (m_hasRareData) 467 rareData()->setPreviousID(vm, transition,structure);467 rareData()->setPreviousID(vm, structure); 468 468 else 469 m_previousOrRareData.set(vm, t ransition, structure);469 m_previousOrRareData.set(vm, this, structure); 470 470 } 471 471 -
trunk/Source/JavaScriptCore/runtime/StructureInlines.h
r169903 r171115 157 157 if (!m_hasRareData) 158 158 allocateRareData(vm); 159 rareData()->setEnumerationCache(vm, this,enumerationCache);159 rareData()->setEnumerationCache(vm, enumerationCache); 160 160 } 161 161 -
trunk/Source/JavaScriptCore/runtime/StructureRareData.h
r154038 r171115 50 50 51 51 Structure* previousID() const; 52 void setPreviousID(VM&, Structure* transition, Structure*);52 void setPreviousID(VM&, Structure*); 53 53 void clearPreviousID(); 54 54 55 55 JSString* objectToStringValue() const; 56 void setObjectToStringValue(VM&, const JSCell* owner,JSString* value);56 void setObjectToStringValue(VM&, JSString* value); 57 57 58 58 JSPropertyNameIterator* enumerationCache(); 59 void setEnumerationCache(VM&, const Structure* owner,JSPropertyNameIterator* value);59 void setEnumerationCache(VM&, JSPropertyNameIterator* value); 60 60 61 61 DECLARE_EXPORT_INFO; -
trunk/Source/JavaScriptCore/runtime/StructureRareDataInlines.h
r161615 r171115 36 36 } 37 37 38 inline void StructureRareData::setPreviousID(VM& vm, Structure* , Structure*structure)38 inline void StructureRareData::setPreviousID(VM& vm, Structure* structure) 39 39 { 40 40 m_previous.set(vm, this, structure); … … 51 51 } 52 52 53 inline void StructureRareData::setObjectToStringValue(VM& vm, const JSCell*,JSString* value)53 inline void StructureRareData::setObjectToStringValue(VM& vm, JSString* value) 54 54 { 55 55 m_objectToStringValue.set(vm, this, value);
Note:
See TracChangeset
for help on using the changeset viewer.