Changeset 270043 in webkit
- Timestamp:
- Nov 19, 2020 12:45:50 PM (3 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r270015 r270043 1 2020-11-19 Xan López <xan@igalia.com> 2 3 [JSC] Add support for static private class fields 4 https://bugs.webkit.org/show_bug.cgi?id=214297 5 6 Reviewed by Yusuke Suzuki. 7 8 Copy V8 tests for static private fields and add the test262 9 flag. Also add a couple more of our own tests for the sake of 10 completeness. 11 12 * stress/class-fields-static-private-harmony.js: Added, with a couple additional tests. 13 * stress/resources/harmony-support.js: 14 (assertDoesNotThrow): added. 15 * test262/config.yaml: 16 1 17 2020-11-18 Dmitry Bezhetskov <dbezhetskov@igalia.com> 2 18 -
trunk/JSTests/stress/class-fields-private-harmony.js
r269965 r270043 362 362 } 363 363 364 /*365 FIXME: we don't have %SymbolIsPrivate()366 364 { 367 365 let symbol = Symbol(); … … 376 374 var p = new Proxy(new C, { 377 375 get: function(target, name) { 378 if (typeof( arg) === 'symbol') {379 assertFalse( %SymbolIsPrivate(name));376 if (typeof(name) === 'symbol') { 377 assertFalse($vm.isPrivateSymbol(name)); 380 378 } 381 379 return target[name]; … … 387 385 assertEquals(1, p[symbol]); 388 386 } 389 */390 387 391 388 { -
trunk/JSTests/stress/resources/harmony-support.js
r269922 r270043 195 195 fail(expected, 'no exception', 'expected thrown exception'); 196 196 } 197 198 /** 199 * Runs code() and asserts that it does not throws an exception. 200 */ 201 function assertDoesNotThrow(code, name_opt) { 202 try { 203 if (typeof code == 'function') { 204 code(); 205 } else { 206 eval(code); 207 } 208 } catch (e) { 209 fail("no exception", "threw an exception: " + (e.message || e)); 210 } 211 } -
trunk/JSTests/test262/config.yaml
r270005 r270043 6 6 class-fields-private: usePrivateClassFields 7 7 class-static-fields-public: usePublicStaticClassFields 8 class-static-fields-private: usePrivateStaticClassFields 8 9 Intl.DateTimeFormat-dayPeriod: useIntlDateTimeFormatDayPeriod 9 10 SharedArrayBuffer: useSharedArrayBuffer … … 21 22 - arbitrary-module-namespace-names 22 23 - class-methods-private 23 - class-static-fields-private24 24 - class-static-methods-private 25 25 - cleanupSome -
trunk/Source/JavaScriptCore/ChangeLog
r270036 r270043 1 2020-11-19 Xan López <xan@igalia.com> 2 3 [JSC] Add support for static private class fields 4 https://bugs.webkit.org/show_bug.cgi?id=214297 5 6 Reviewed by Yusuke Suzuki. 7 8 Static private fields come trivially now that both private and 9 static (public) fields are implemented. 10 11 * parser/Parser.cpp: 12 (JSC::Parser<LexerType>::parseClass): accept static private fields if the runtime option allows it. 13 * runtime/Options.cpp: 14 (JSC::Options::recomputeDependentOptions): usePrivateStaticClassFields depends on usePrivateClassFields. 15 * runtime/OptionsList.h: add runtime option to enable static private fields. 16 * tools/JSDollarVM.cpp: add a method to check for private symbols in the stress tests. 17 (JSC::JSC_DEFINE_HOST_FUNCTION): 18 (JSC::JSDollarVM::finishCreation): 19 1 20 2020-11-19 Adrian Perez de Castro <aperez@igalia.com> 2 21 -
trunk/Source/JavaScriptCore/parser/Parser.cpp
r269939 r270043 2972 2972 JSToken token = m_token; 2973 2973 ident = m_token.m_data.ident; 2974 failIfTrue(tag == ClassElementTag::Static, "Static class element cannot be private"); 2974 if (!Options::usePrivateStaticClassFields()) 2975 failIfTrue(tag == ClassElementTag::Static, "Static class element cannot be private"); 2975 2976 failIfTrue(isGetter || isSetter, "Cannot parse class method with private name"); 2976 2977 ASSERT(ident); -
trunk/Source/JavaScriptCore/runtime/Options.cpp
r269974 r270043 552 552 FOR_EACH_JSC_EXPERIMENTAL_OPTION(DISABLE_TIERS); 553 553 } 554 555 if (Options::usePrivateStaticClassFields()) 556 Options::usePrivateClassFields() = true; 554 557 } 555 558 -
trunk/Source/JavaScriptCore/runtime/OptionsList.h
r269939 r270043 526 526 v(Bool, useJITCage, canUseJITCage(), Normal, nullptr) \ 527 527 v(Bool, usePublicStaticClassFields, true, Normal, "If true, the parser will understand public static data fields inside classes.") \ 528 v(Bool, usePrivateStaticClassFields, false, Normal, "If true, the parser will understand private static data fields inside classes.") \ 528 529 529 530 enum OptionEquivalence { -
trunk/Source/JavaScriptCore/tools/JSDollarVM.cpp
r268710 r270043 1870 1870 static JSC_DECLARE_HOST_FUNCTION(functionIsGigacageEnabled); 1871 1871 static JSC_DECLARE_HOST_FUNCTION(functionToUncacheableDictionary); 1872 static JSC_DECLARE_HOST_FUNCTION(functionIsPrivateSymbol); 1872 1873 1873 1874 const ClassInfo JSDollarVM::s_info = { "DollarVM", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSDollarVM) }; … … 3378 3379 } 3379 3380 3381 JSC_DEFINE_HOST_FUNCTION(functionIsPrivateSymbol, (JSGlobalObject*, CallFrame* callFrame)) 3382 { 3383 DollarVMAssertScope assertScope; 3384 3385 if (!(callFrame->argument(0).isSymbol())) 3386 return JSValue::encode(jsBoolean(false)); 3387 3388 return JSValue::encode(jsBoolean(asSymbol(callFrame->argument(0))->uid().isPrivate())); 3389 } 3390 3380 3391 constexpr unsigned jsDollarVMPropertyAttributes = PropertyAttribute::ReadOnly | PropertyAttribute::DontEnum | PropertyAttribute::DontDelete; 3381 3392 … … 3528 3539 addFunction(vm, "toUncacheableDictionary", functionToUncacheableDictionary, 1); 3529 3540 3541 addFunction(vm, "isPrivateSymbol", functionIsPrivateSymbol, 1); 3542 3530 3543 m_objectDoingSideEffectPutWithoutCorrectSlotStatusStructure.set(vm, this, ObjectDoingSideEffectPutWithoutCorrectSlotStatus::createStructure(vm, globalObject, jsNull())); 3531 3544 }
Note: See TracChangeset
for help on using the changeset viewer.