Changeset 267635 in webkit
- Timestamp:
- Sep 26, 2020, 2:08:52 PM (6 years ago)
- Location:
- branches/safari-610-branch
- Files:
-
- 1 added
- 7 edited
-
JSTests/ChangeLog (modified) (1 diff)
-
JSTests/stress/has-static-property-property-condition-needs-to-check-if-structure-has-property.js (added)
-
Source/JavaScriptCore/ChangeLog (modified) (1 diff)
-
Source/JavaScriptCore/bytecode/ObjectPropertyCondition.h (modified) (1 diff)
-
Source/JavaScriptCore/bytecode/ObjectPropertyConditionSet.cpp (modified) (4 diffs)
-
Source/JavaScriptCore/bytecode/PropertyCondition.cpp (modified) (7 diffs)
-
Source/JavaScriptCore/bytecode/PropertyCondition.h (modified) (4 diffs)
-
Source/JavaScriptCore/tools/JSDollarVM.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-610-branch/JSTests/ChangeLog
r267585 r267635 1 2020-09-25 Alan Coon <alancoon@apple.com> 2 3 Cherry-pick r267113. rdar://problem/69586723 4 5 CustomFunctionEquivalence PropertyCondition needs to check if the structure has the property 6 https://bugs.webkit.org/show_bug.cgi?id=216575 7 <rdar://problem/68286930> 8 9 Reviewed by Yusuke Suzuki. 10 11 JSTests: 12 13 * stress/has-static-property-property-condition-needs-to-check-if-structure-has-property.js: Added. 14 (foo): 15 16 Source/JavaScriptCore: 17 18 The CustomFunctionEquivalence PropertyCondition would only return false to 19 isStillValidAssumingImpurePropertyWatchpoint if the Structure's static 20 property table was reified or if the static property table did not contain the 21 property. However, this missed the obvious case of where we store to this 22 property in normal object storage without reifying the static property table. 23 The fix here is simple: we first check if the Structure's property table 24 has this property, and if so, return false. 25 26 This patch also renames CustomFunctionEquivalence to HasStaticProperty to 27 better capture what we're doing. 28 29 * bytecode/ObjectPropertyCondition.h: 30 (JSC::ObjectPropertyCondition::hasStaticProperty): 31 (JSC::ObjectPropertyCondition::customFunctionEquivalence): Deleted. 32 * bytecode/ObjectPropertyConditionSet.cpp: 33 (JSC::ObjectPropertyConditionSet::hasOneSlotBaseCondition const): 34 (JSC::ObjectPropertyConditionSet::slotBaseCondition const): 35 (JSC::generateConditionsForPrototypePropertyHitCustom): 36 * bytecode/PropertyCondition.cpp: 37 (JSC::PropertyCondition::dumpInContext const): 38 (JSC::PropertyCondition::isStillValidAssumingImpurePropertyWatchpoint const): 39 (JSC::PropertyCondition::validityRequiresImpurePropertyWatchpoint const): 40 (JSC::PropertyCondition::isStillValid const): 41 (JSC::PropertyCondition::isWatchableWhenValid const): 42 (WTF::printInternal): 43 * bytecode/PropertyCondition.h: 44 (JSC::PropertyCondition::hasStaticProperty): 45 (JSC::PropertyCondition::hash const): 46 (JSC::PropertyCondition::operator== const): 47 (JSC::PropertyCondition::customFunctionEquivalence): Deleted. 48 * tools/JSDollarVM.cpp: 49 (JSC::functionCreateStaticCustomValue): 50 (JSC::JSDollarVM::finishCreation): 51 52 53 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267113 268f45cc-cd09-0410-ab3c-d52691b4dbfc 54 55 2020-09-15 Saam Barati <sbarati@apple.com> 56 57 CustomFunctionEquivalence PropertyCondition needs to check if the structure has the property 58 https://bugs.webkit.org/show_bug.cgi?id=216575 59 <rdar://problem/68286930> 60 61 Reviewed by Yusuke Suzuki. 62 63 * stress/has-static-property-property-condition-needs-to-check-if-structure-has-property.js: Added. 64 (foo): 65 1 66 2020-09-25 Alan Coon <alancoon@apple.com> 2 67 -
branches/safari-610-branch/Source/JavaScriptCore/ChangeLog
r267585 r267635 1 2020-09-25 Alan Coon <alancoon@apple.com> 2 3 Cherry-pick r267113. rdar://problem/69586723 4 5 CustomFunctionEquivalence PropertyCondition needs to check if the structure has the property 6 https://bugs.webkit.org/show_bug.cgi?id=216575 7 <rdar://problem/68286930> 8 9 Reviewed by Yusuke Suzuki. 10 11 JSTests: 12 13 * stress/has-static-property-property-condition-needs-to-check-if-structure-has-property.js: Added. 14 (foo): 15 16 Source/JavaScriptCore: 17 18 The CustomFunctionEquivalence PropertyCondition would only return false to 19 isStillValidAssumingImpurePropertyWatchpoint if the Structure's static 20 property table was reified or if the static property table did not contain the 21 property. However, this missed the obvious case of where we store to this 22 property in normal object storage without reifying the static property table. 23 The fix here is simple: we first check if the Structure's property table 24 has this property, and if so, return false. 25 26 This patch also renames CustomFunctionEquivalence to HasStaticProperty to 27 better capture what we're doing. 28 29 * bytecode/ObjectPropertyCondition.h: 30 (JSC::ObjectPropertyCondition::hasStaticProperty): 31 (JSC::ObjectPropertyCondition::customFunctionEquivalence): Deleted. 32 * bytecode/ObjectPropertyConditionSet.cpp: 33 (JSC::ObjectPropertyConditionSet::hasOneSlotBaseCondition const): 34 (JSC::ObjectPropertyConditionSet::slotBaseCondition const): 35 (JSC::generateConditionsForPrototypePropertyHitCustom): 36 * bytecode/PropertyCondition.cpp: 37 (JSC::PropertyCondition::dumpInContext const): 38 (JSC::PropertyCondition::isStillValidAssumingImpurePropertyWatchpoint const): 39 (JSC::PropertyCondition::validityRequiresImpurePropertyWatchpoint const): 40 (JSC::PropertyCondition::isStillValid const): 41 (JSC::PropertyCondition::isWatchableWhenValid const): 42 (WTF::printInternal): 43 * bytecode/PropertyCondition.h: 44 (JSC::PropertyCondition::hasStaticProperty): 45 (JSC::PropertyCondition::hash const): 46 (JSC::PropertyCondition::operator== const): 47 (JSC::PropertyCondition::customFunctionEquivalence): Deleted. 48 * tools/JSDollarVM.cpp: 49 (JSC::functionCreateStaticCustomValue): 50 (JSC::JSDollarVM::finishCreation): 51 52 53 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267113 268f45cc-cd09-0410-ab3c-d52691b4dbfc 54 55 2020-09-15 Saam Barati <sbarati@apple.com> 56 57 CustomFunctionEquivalence PropertyCondition needs to check if the structure has the property 58 https://bugs.webkit.org/show_bug.cgi?id=216575 59 <rdar://problem/68286930> 60 61 Reviewed by Yusuke Suzuki. 62 63 The CustomFunctionEquivalence PropertyCondition would only return false to 64 isStillValidAssumingImpurePropertyWatchpoint if the Structure's static 65 property table was reified or if the static property table did not contain the 66 property. However, this missed the obvious case of where we store to this 67 property in normal object storage without reifying the static property table. 68 The fix here is simple: we first check if the Structure's property table 69 has this property, and if so, return false. 70 71 This patch also renames CustomFunctionEquivalence to HasStaticProperty to 72 better capture what we're doing. 73 74 * bytecode/ObjectPropertyCondition.h: 75 (JSC::ObjectPropertyCondition::hasStaticProperty): 76 (JSC::ObjectPropertyCondition::customFunctionEquivalence): Deleted. 77 * bytecode/ObjectPropertyConditionSet.cpp: 78 (JSC::ObjectPropertyConditionSet::hasOneSlotBaseCondition const): 79 (JSC::ObjectPropertyConditionSet::slotBaseCondition const): 80 (JSC::generateConditionsForPrototypePropertyHitCustom): 81 * bytecode/PropertyCondition.cpp: 82 (JSC::PropertyCondition::dumpInContext const): 83 (JSC::PropertyCondition::isStillValidAssumingImpurePropertyWatchpoint const): 84 (JSC::PropertyCondition::validityRequiresImpurePropertyWatchpoint const): 85 (JSC::PropertyCondition::isStillValid const): 86 (JSC::PropertyCondition::isWatchableWhenValid const): 87 (WTF::printInternal): 88 * bytecode/PropertyCondition.h: 89 (JSC::PropertyCondition::hasStaticProperty): 90 (JSC::PropertyCondition::hash const): 91 (JSC::PropertyCondition::operator== const): 92 (JSC::PropertyCondition::customFunctionEquivalence): Deleted. 93 * tools/JSDollarVM.cpp: 94 (JSC::functionCreateStaticCustomValue): 95 (JSC::JSDollarVM::finishCreation): 96 1 97 2020-09-25 Alan Coon <alancoon@apple.com> 2 98 -
branches/safari-610-branch/Source/JavaScriptCore/bytecode/ObjectPropertyCondition.h
r264488 r267635 123 123 } 124 124 125 static ObjectPropertyCondition customFunctionEquivalence(125 static ObjectPropertyCondition hasStaticProperty( 126 126 VM& vm, JSCell* owner, JSObject* object, UniquedStringImpl* uid) 127 127 { 128 128 ObjectPropertyCondition result; 129 129 result.m_object = object; 130 result.m_condition = PropertyCondition:: customFunctionEquivalence(uid);130 result.m_condition = PropertyCondition::hasStaticProperty(uid); 131 131 if (owner) 132 132 vm.heap.writeBarrier(owner); -
branches/safari-610-branch/Source/JavaScriptCore/bytecode/ObjectPropertyConditionSet.cpp
r266866 r267635 68 68 case PropertyCondition::Presence: 69 69 case PropertyCondition::Equivalence: 70 case PropertyCondition:: CustomFunctionEquivalence:70 case PropertyCondition::HasStaticProperty: 71 71 if (sawBase) 72 72 return false; … … 88 88 if (condition.kind() == PropertyCondition::Presence 89 89 || condition.kind() == PropertyCondition::Equivalence 90 || condition.kind() == PropertyCondition:: CustomFunctionEquivalence) {90 || condition.kind() == PropertyCondition::HasStaticProperty) { 91 91 result = condition; 92 92 numFound++; … … 245 245 break; 246 246 } 247 case PropertyCondition:: CustomFunctionEquivalence: {247 case PropertyCondition::HasStaticProperty: { 248 248 auto entry = object->findPropertyHashEntry(vm, uid); 249 249 if (!entry) 250 250 return ObjectPropertyCondition(); 251 result = ObjectPropertyCondition:: customFunctionEquivalence(vm, owner, object, uid);251 result = ObjectPropertyCondition::hasStaticProperty(vm, owner, object, uid); 252 252 break; 253 253 } … … 410 410 kind = PropertyCondition::Equivalence; 411 411 } else if (structure->findPropertyHashEntry(uid)) 412 kind = PropertyCondition:: CustomFunctionEquivalence;412 kind = PropertyCondition::HasStaticProperty; 413 413 else if (attributes & PropertyAttribute::DontDelete) { 414 414 // This can't change, so we can blindly cache it. -
branches/safari-610-branch/Source/JavaScriptCore/bytecode/PropertyCondition.cpp
r261895 r267635 55 55 out.print(m_header.type(), " of ", m_header.pointer(), " with ", inContext(requiredValue(), context)); 56 56 return; 57 case CustomFunctionEquivalence:57 case HasStaticProperty: 58 58 out.print(m_header.type(), " of ", m_header.pointer()); 59 59 return; … … 90 90 case AbsenceOfSetEffect: 91 91 case Equivalence: 92 case CustomFunctionEquivalence:92 case HasStaticProperty: 93 93 if (!structure->propertyAccessesAreCacheable()) { 94 94 if (PropertyConditionInternal::verbose) … … 254 254 return true; 255 255 } 256 case CustomFunctionEquivalence: { 256 case HasStaticProperty: { 257 if (isValidOffset(structure->getConcurrently(uid()))) 258 return false; 257 259 if (structure->staticPropertiesReified()) 258 260 return false; … … 274 276 case Absence: 275 277 case Equivalence: 276 case CustomFunctionEquivalence:278 case HasStaticProperty: 277 279 return structure->needImpurePropertyWatchpoint(); 278 280 case AbsenceOfSetEffect: … … 300 302 case Presence: 301 303 case Equivalence: 302 case CustomFunctionEquivalence:304 case HasStaticProperty: 303 305 if (structure->typeInfo().getOwnPropertySlotIsImpure()) 304 306 return false; … … 343 345 } 344 346 345 case CustomFunctionEquivalence: {347 case HasStaticProperty: { 346 348 // We just use the structure transition watchpoint for this. A structure S starts 347 349 // off with a property P in the static property hash table. If S transitions to … … 431 433 out.print("Equivalence"); 432 434 return; 433 case JSC::PropertyCondition:: CustomFunctionEquivalence:434 out.print(" CustomFunctionEquivalence");435 case JSC::PropertyCondition::HasStaticProperty: 436 out.print("HasStaticProperty"); 435 437 return; 436 438 case JSC::PropertyCondition::HasPrototype: -
branches/safari-610-branch/Source/JavaScriptCore/bytecode/PropertyCondition.h
r264488 r267635 41 41 AbsenceOfSetEffect, 42 42 Equivalence, // An adaptive watchpoint on this will be a pair of watchpoints, and when the structure transitions, we will set the replacement watchpoint on the new structure. 43 CustomFunctionEquivalence, // Custom value or accessor.43 HasStaticProperty, // Custom value or accessor. 44 44 HasPrototype 45 45 }; … … 125 125 } 126 126 127 static PropertyCondition customFunctionEquivalence(UniquedStringImpl* uid)128 { 129 PropertyCondition result; 130 result.m_header = Header(uid, CustomFunctionEquivalence);127 static PropertyCondition hasStaticProperty(UniquedStringImpl* uid) 128 { 129 PropertyCondition result; 130 result.m_header = Header(uid, HasStaticProperty); 131 131 return result; 132 132 } … … 202 202 result ^= EncodedJSValueHash::hash(u.equivalence.value); 203 203 break; 204 case CustomFunctionEquivalence:204 case HasStaticProperty: 205 205 break; 206 206 } … … 224 224 case Equivalence: 225 225 return u.equivalence.value == other.u.equivalence.value; 226 case CustomFunctionEquivalence:226 case HasStaticProperty: 227 227 return true; 228 228 } -
branches/safari-610-branch/Source/JavaScriptCore/tools/JSDollarVM.cpp
r266879 r267635 739 739 }; 740 740 741 static EncodedJSValue testStaticValueGetter(JSGlobalObject*, EncodedJSValue, PropertyName) 742 { 743 DollarVMAssertScope assertScope; 744 return JSValue::encode(jsUndefined()); 745 } 746 747 static bool testStaticValuePutter(JSGlobalObject* globalObject, EncodedJSValue thisValue, EncodedJSValue value) 748 { 749 DollarVMAssertScope assertScope; 750 VM& vm = globalObject->vm(); 751 752 JSObject* thisObject = jsDynamicCast<JSObject*>(vm, JSValue::decode(thisValue)); 753 RELEASE_ASSERT(thisObject); 754 755 return thisObject->putDirect(vm, PropertyName(Identifier::fromString(vm, "testStaticValue")), JSValue::decode(value)); 756 } 757 758 static const struct CompactHashIndex staticCustomValueTableIndex[2] = { 759 { 0, -1 }, 760 { -1, -1 }, 761 }; 762 763 static const struct HashTableValue staticCustomValueTableValues[1] = { 764 { "testStaticValue", static_cast<unsigned>(PropertyAttribute::CustomAccessor), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(testStaticValueGetter), (intptr_t)static_cast<PutPropertySlot::PutValueFunc>(testStaticValuePutter) } }, 765 }; 766 767 static const struct HashTable staticCustomValueTable = 768 { 1, 1, true, nullptr, staticCustomValueTableValues, staticCustomValueTableIndex }; 769 770 class StaticCustomValue : public JSNonFinalObject { 771 using Base = JSNonFinalObject; 772 public: 773 StaticCustomValue(VM& vm, Structure* structure) 774 : Base(vm, structure) 775 { 776 DollarVMAssertScope assertScope; 777 } 778 779 DECLARE_INFO; 780 781 static constexpr unsigned StructureFlags = Base::StructureFlags | HasStaticPropertyTable; 782 783 template<typename CellType, SubspaceAccess> 784 static CompleteSubspace* subspaceFor(VM& vm) 785 { 786 return &vm.cellSpace; 787 } 788 789 static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype) 790 { 791 DollarVMAssertScope assertScope; 792 return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info()); 793 } 794 795 static StaticCustomValue* create(VM& vm, Structure* structure) 796 { 797 DollarVMAssertScope assertScope; 798 StaticCustomValue* accessor = new (NotNull, allocateCell<StaticCustomValue>(vm.heap)) StaticCustomValue(vm, structure); 799 accessor->finishCreation(vm); 800 return accessor; 801 } 802 }; 803 741 804 class ObjectDoingSideEffectPutWithoutCorrectSlotStatus : public JSNonFinalObject { 742 805 using Base = JSNonFinalObject; … … 1545 1608 1546 1609 const ClassInfo StaticCustomAccessor::s_info = { "StaticCustomAccessor", &Base::s_info, &staticCustomAccessorTable, nullptr, CREATE_METHOD_TABLE(StaticCustomAccessor) }; 1610 const ClassInfo StaticCustomValue::s_info = { "StaticCustomValue", &Base::s_info, &staticCustomValueTable, nullptr, CREATE_METHOD_TABLE(StaticCustomValue) }; 1547 1611 const ClassInfo ObjectDoingSideEffectPutWithoutCorrectSlotStatus::s_info = { "ObjectDoingSideEffectPutWithoutCorrectSlotStatus", &Base::s_info, &staticCustomAccessorTable, nullptr, CREATE_METHOD_TABLE(ObjectDoingSideEffectPutWithoutCorrectSlotStatus) }; 1548 1612 … … 2532 2596 } 2533 2597 2598 static EncodedJSValue JSC_HOST_CALL functionCreateStaticCustomValue(JSGlobalObject* globalObject, CallFrame*) 2599 { 2600 DollarVMAssertScope assertScope; 2601 VM& vm = globalObject->vm(); 2602 JSLockHolder lock(vm); 2603 Structure* structure = StaticCustomValue::createStructure(vm, globalObject, jsNull()); 2604 auto* result = StaticCustomValue::create(vm, structure); 2605 return JSValue::encode(result); 2606 } 2607 2534 2608 static EncodedJSValue JSC_HOST_CALL functionCreateObjectDoingSideEffectPutWithoutCorrectSlotStatus(JSGlobalObject* globalObject, CallFrame* callFrame) 2535 2609 { … … 3233 3307 #endif 3234 3308 addFunction(vm, "createStaticCustomAccessor", functionCreateStaticCustomAccessor, 0); 3309 addFunction(vm, "createStaticCustomValue", functionCreateStaticCustomValue, 0); 3235 3310 addFunction(vm, "createObjectDoingSideEffectPutWithoutCorrectSlotStatus", functionCreateObjectDoingSideEffectPutWithoutCorrectSlotStatus, 0); 3236 3311 addFunction(vm, "createEmptyFunctionWithName", functionCreateEmptyFunctionWithName, 1);
Note:
See TracChangeset
for help on using the changeset viewer.