Changeset 272411 in webkit
- Timestamp:
- Feb 5, 2021 6:26:44 AM (18 months ago)
- Location:
- trunk
- Files:
-
- 4 edited
-
JSTests/ChangeLog (modified) (1 diff)
-
JSTests/stress/object-assign-fast-path.js (modified) (1 diff)
-
Source/JavaScriptCore/ChangeLog (modified) (1 diff)
-
Source/JavaScriptCore/runtime/ObjectConstructor.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r272406 r272411 1 2021-02-05 Alexey Shvayka <shvaikalesh@gmail.com> 2 3 Object.assign should throw for property creation on non-extensible `target` 4 https://bugs.webkit.org/show_bug.cgi?id=220712 5 6 Reviewed by Ross Kirsling. 7 8 * stress/object-assign-fast-path.js: 9 1 10 2021-02-05 Yusuke Suzuki <ysuzuki@apple.com> 2 11 -
trunk/JSTests/stress/object-assign-fast-path.js
r250025 r272411 164 164 shouldBe(setterCalledWithValue, "world"); 165 165 } 166 { 167 let object = Object.freeze({ foo: 1 }); 168 shouldBe(Object.assign(object, {}), object); 169 } 170 { 171 let object = Object.preventExtensions({ foo: 1 }); 172 shouldBe(Object.assign(object, { foo: 2 }), object); 173 shouldBe(object.foo, 2); 174 } 175 { 176 let object = Object.preventExtensions({ foo: 1 }); 177 shouldThrow(() => { 178 Object.assign(object, { bar: 2 }); 179 }, `TypeError: Attempted to assign to readonly property.`); 180 shouldBe(object.bar, undefined); 181 } -
trunk/Source/JavaScriptCore/ChangeLog
r272406 r272411 1 2021-02-05 Alexey Shvayka <shvaikalesh@gmail.com> 2 3 Object.assign should throw for property creation on non-extensible `target` 4 https://bugs.webkit.org/show_bug.cgi?id=220712 5 6 Reviewed by Ross Kirsling. 7 8 This performance-neutral change precludes Object.assign from taking the 9 fast path if `target` is a non-extensible JSFinalObject, which ensures 10 a TypeError is thrown for property creation via [[Set]]. 11 12 Aligns JSC with the spec [1], V8, and SpiderMonkey. 13 14 [1]: https://tc39.es/ecma262/#sec-validateandapplypropertydescriptor (step 2.a) 15 16 * runtime/ObjectConstructor.cpp: 17 (JSC::JSC_DEFINE_HOST_FUNCTION): 18 1 19 2021-02-05 Yusuke Suzuki <ysuzuki@apple.com> 2 20 -
trunk/Source/JavaScriptCore/runtime/ObjectConstructor.cpp
r272364 r272411 274 274 // FIXME: Extend this for non JSFinalObject. For example, we would like to use this fast path for function objects too. 275 275 // https://bugs.webkit.org/show_bug.cgi?id=185358 276 bool targetCanPerformFastPut = jsDynamicCast<JSFinalObject*>(vm, target) && target->canPerformFastPutInlineExcludingProto(vm) ;276 bool targetCanPerformFastPut = jsDynamicCast<JSFinalObject*>(vm, target) && target->canPerformFastPutInlineExcludingProto(vm) && target->isStructureExtensible(vm); 277 277 278 278 Vector<RefPtr<UniquedStringImpl>, 8> properties;
Note: See TracChangeset
for help on using the changeset viewer.