Changeset 275569 in webkit
- Timestamp:
- Apr 6, 2021 4:28:53 PM (3 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r275544 r275569 1 2021-04-06 Alexey Shvayka <shvaikalesh@gmail.com> 2 3 Symbol and BigInt wrapper objects should perform OrdinaryToPrimitive 4 https://bugs.webkit.org/show_bug.cgi?id=224208 5 6 Reviewed by Yusuke Suzuki. 7 8 * stress/bigint-object-ordinary-toprimitive.js: Added. 9 * stress/symbol-object-ordinary-toprimitive.js: Added. 10 1 11 2021-04-06 Alexey Shvayka <shvaikalesh@gmail.com> 2 12 -
trunk/Source/JavaScriptCore/ChangeLog
r275544 r275569 1 2021-04-06 Alexey Shvayka <shvaikalesh@gmail.com> 2 3 Symbol and BigInt wrapper objects should perform OrdinaryToPrimitive 4 https://bugs.webkit.org/show_bug.cgi?id=224208 5 6 Reviewed by Yusuke Suzuki. 7 8 ES6 introduced Symbol.toPrimitive as the only way to override ToPrimitive; 9 if it's nullish, OrdinaryToPrimitive [1] is performed unconditionally. 10 11 This patch removes two redundant defaultValue() overrides, fixing JSC to call 12 (possibly userland) toString() / valueOf() methods of a) Symbol objects whose 13 Symbol.toPrimitive was removed, and b) BigInt wrapper objects. 14 15 Aligns JSC with V8 and SpiderMonkey. Coercion of primitives is unaffected. 16 Also, removes dummy BigIntObject::internalValue() override. 17 18 [1]: https://tc39.es/ecma262/#sec-toprimitive (step 2.d) 19 20 * runtime/BigIntObject.cpp: 21 (JSC::BigIntObject::defaultValue): Deleted. 22 * runtime/BigIntObject.h: 23 * runtime/SymbolObject.cpp: 24 (JSC::SymbolObject::defaultValue): Deleted. 25 * runtime/SymbolObject.h: 26 1 27 2021-04-06 Alexey Shvayka <shvaikalesh@gmail.com> 2 28 -
trunk/Source/JavaScriptCore/runtime/BigIntObject.cpp
r262388 r275569 57 57 } 58 58 59 JSValue BigIntObject::defaultValue(const JSObject* object, JSGlobalObject*, PreferredPrimitiveType)60 {61 const BigIntObject* bigIntObject = jsCast<const BigIntObject*>(object);62 return bigIntObject->internalValue();63 }64 65 59 } // namespace JSC -
trunk/Source/JavaScriptCore/runtime/BigIntObject.h
r261159 r275569 45 45 DECLARE_EXPORT_INFO; 46 46 47 JSValue internalValue() const { return JSWrapperObject::internalValue(); }48 49 47 static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype) 50 48 { 51 49 return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info()); 52 50 } 53 54 static JSValue defaultValue(const JSObject*, JSGlobalObject*, PreferredPrimitiveType);55 51 56 52 private: -
trunk/Source/JavaScriptCore/runtime/SymbolObject.cpp
r261895 r275569 48 48 } 49 49 50 JSValue SymbolObject::defaultValue(const JSObject* object, JSGlobalObject*, PreferredPrimitiveType)51 {52 const SymbolObject* symbolObject = jsCast<const SymbolObject*>(object);53 return symbolObject->internalValue();54 }55 56 50 } // namespace JSC -
trunk/Source/JavaScriptCore/runtime/SymbolObject.h
r261159 r275569 61 61 } 62 62 63 static JSValue defaultValue(const JSObject*, JSGlobalObject*, PreferredPrimitiveType);64 65 63 private: 66 64 JS_EXPORT_PRIVATE void finishCreation(VM&, Symbol*);
Note: See TracChangeset
for help on using the changeset viewer.