Changeset 169695 in webkit
- Timestamp:
- Jun 9, 2014 11:07:37 AM (10 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r169668 r169695 1 2014-06-07 Mark Lam <mark.lam@apple.com> 2 3 Structure should initialize its previousID in its constructor. 4 <https://webkit.org/b/133606> 5 6 Reviewed by Mark Hahnenberg. 7 8 Currently, the Structure constructor that takes a previous structure will 9 initialize its previousID to point to the previous structure's previousID. 10 This is incorrect. However, the caller of the Structure::create() factory 11 method (which instantiated the Structure) will later call setPreviousID() 12 to set the previousID to the correct previous structure. This makes the 13 code confusing to read and more error prone in that the structure relies 14 on client code to fix its invalid previousID. 15 16 This patch fixes this by making the Structure constructor initialize 17 previousID correctly. 18 19 * runtime/Structure.cpp: 20 (JSC::Structure::Structure): 21 (JSC::Structure::addPropertyTransition): 22 (JSC::Structure::nonPropertyTransition): 23 * runtime/Structure.h: 24 * runtime/StructureInlines.h: 25 (JSC::Structure::create): 26 1 27 2014-06-06 Andreas Kling <akling@apple.com> 2 28 -
trunk/Source/JavaScriptCore/runtime/Structure.cpp
r169121 r169695 212 212 } 213 213 214 Structure::Structure(VM& vm, constStructure* previous)214 Structure::Structure(VM& vm, Structure* previous) 215 215 : JSCell(vm, vm.structureStructure.get()) 216 216 , m_prototype(vm, this, previous->storedPrototype()) … … 237 237 if (previous->typeInfo().structureHasRareData() && previous->rareData()->needsCloning()) 238 238 cloneRareDataFrom(vm, previous); 239 else if (previous->previousID()) 240 m_previousOrRareData.set(vm, this, previous->previousID()); 239 setPreviousID(vm, this, previous); 241 240 242 241 previous->notifyTransitionFromThisStructure(); … … 460 459 461 460 transition->m_cachedPrototypeChain.setMayBeNull(vm, transition, structure->m_cachedPrototypeChain.get()); 462 transition->setPreviousID(vm, transition, structure);463 461 transition->m_nameInPrevious = propertyName.uid(); 464 462 transition->m_attributesInPrevious = attributes; … … 673 671 674 672 Structure* transition = create(vm, structure); 675 transition->setPreviousID(vm, transition, structure);676 673 transition->m_attributesInPrevious = attributes; 677 674 transition->m_blob.setIndexingType(indexingType); -
trunk/Source/JavaScriptCore/runtime/Structure.h
r169121 r169695 390 390 JS_EXPORT_PRIVATE Structure(VM&, JSGlobalObject*, JSValue prototype, const TypeInfo&, const ClassInfo*, IndexingType, unsigned inlineCapacity); 391 391 Structure(VM&); 392 Structure(VM&, constStructure*);393 394 static Structure* create(VM&, constStructure*);392 Structure(VM&, Structure*); 393 394 static Structure* create(VM&, Structure*); 395 395 396 396 static Structure* addPropertyTransitionToExistingStructureImpl(Structure*, StringImpl* uid, unsigned attributes, JSCell* specificValue, PropertyOffset&); -
trunk/Source/JavaScriptCore/runtime/StructureInlines.h
r168373 r169695 50 50 } 51 51 52 inline Structure* Structure::create(VM& vm, constStructure* structure)52 inline Structure* Structure::create(VM& vm, Structure* structure) 53 53 { 54 54 ASSERT(vm.structureStructure);
Note: See TracChangeset
for help on using the changeset viewer.