Changeset 223161 in webkit
- Timestamp:
- Oct 10, 2017 5:53:59 PM (7 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r223159 r223161 1 2017-10-10 Saam Barati <sbarati@apple.com> 2 3 Prototype structure transition should be a deferred transition 4 https://bugs.webkit.org/show_bug.cgi?id=177734 5 6 Reviewed by Keith Miller. 7 8 Absence ObjectPropertyConditions work by verifying both that the Structure 9 does not have a particular property and that its prototype has 10 remained constant. However, the prototype transition was firing 11 the transition watchpoint before setting the object's structure. 12 This meant that isValid for Absence would never return false because 13 the prototype changed. Clearly this is wrong. The reason this didn't 14 break OPCs in general is that we'd also check if we could still watch 15 the OPC. In this case, we can't still watch it because we're inspecting 16 a structure with an invalidated transition watchpoint. To fix 17 this weird quirk of the code, I'm making it so that doing a prototype 18 transition uses the DeferredStructureTransitionWatchpointFire machinery. 19 20 This patch also fixes some dead code that I left in regarding 21 poly proto in OPC. 22 23 * bytecode/PropertyCondition.cpp: 24 (JSC::PropertyCondition::isStillValidAssumingImpurePropertyWatchpoint const): 25 * runtime/JSObject.cpp: 26 (JSC::JSObject::setPrototypeDirect): 27 * runtime/Structure.cpp: 28 (JSC::Structure::changePrototypeTransition): 29 * runtime/Structure.h: 30 1 31 2017-10-10 Robin Morisset <rmorisset@apple.com> 2 32 -
trunk/Source/JavaScriptCore/bytecode/PropertyCondition.cpp
r222827 r223161 123 123 } 124 124 125 JSObject* currentPrototype; 126 if (structure->hasMonoProto()) 127 currentPrototype = structure->storedPrototypeObject(); 128 else { 129 RELEASE_ASSERT(base); 130 currentPrototype = jsDynamicCast<JSObject*>(*structure->vm(), base->getPrototypeDirect()); 131 } 132 133 if (currentPrototype != prototype()) { 125 if (structure->storedPrototypeObject() != prototype()) { 134 126 if (PropertyConditionInternal::verbose) { 135 127 dataLog( -
trunk/Source/JavaScriptCore/runtime/JSObject.cpp
r223027 r223161 1635 1635 1636 1636 if (structure(vm)->hasMonoProto()) { 1637 Structure* newStructure = Structure::changePrototypeTransition(vm, structure(vm), prototype); 1637 DeferredStructureTransitionWatchpointFire deferred; 1638 Structure* newStructure = Structure::changePrototypeTransition(vm, structure(vm), prototype, deferred); 1638 1639 setStructure(vm, newStructure); 1639 1640 } else -
trunk/Source/JavaScriptCore/runtime/Structure.cpp
r222827 r223161 546 546 } 547 547 548 Structure* Structure::changePrototypeTransition(VM& vm, Structure* structure, JSValue prototype )548 Structure* Structure::changePrototypeTransition(VM& vm, Structure* structure, JSValue prototype, DeferredStructureTransitionWatchpointFire& deferred) 549 549 { 550 550 ASSERT(prototype.isObject() || prototype.isNull()); 551 551 552 552 DeferGC deferGC(vm.heap); 553 Structure* transition = create(vm, structure );553 Structure* transition = create(vm, structure, &deferred); 554 554 555 555 transition->m_prototype.set(vm, transition, prototype); -
trunk/Source/JavaScriptCore/runtime/Structure.h
r222827 r223161 182 182 JS_EXPORT_PRIVATE static Structure* addPropertyTransitionToExistingStructure(Structure*, PropertyName, unsigned attributes, PropertyOffset&); 183 183 static Structure* removePropertyTransition(VM&, Structure*, PropertyName, PropertyOffset&); 184 static Structure* changePrototypeTransition(VM&, Structure*, JSValue prototype );184 static Structure* changePrototypeTransition(VM&, Structure*, JSValue prototype, DeferredStructureTransitionWatchpointFire&); 185 185 JS_EXPORT_PRIVATE static Structure* attributeChangeTransition(VM&, Structure*, PropertyName, unsigned attributes); 186 186 JS_EXPORT_PRIVATE static Structure* toCacheableDictionaryTransition(VM&, Structure*, DeferredStructureTransitionWatchpointFire* = nullptr);
Note: See TracChangeset
for help on using the changeset viewer.