Changeset 247589 in webkit
- Timestamp:
- Jul 18, 2019 1:23:41 PM (5 years ago)
- Location:
- branches/safari-608-branch
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-608-branch/LayoutTests/ChangeLog
r247587 r247589 1 2019-07-17 Kocsen Chung <kocsen_chung@apple.com> 2 3 Cherry-pick r247474. rdar://problem/53229615 4 5 JSGlobalObject type macros should support feature flags and WeakRef should have one 6 https://bugs.webkit.org/show_bug.cgi?id=199601 7 8 Reviewed by Mark Lam. 9 10 Source/JavaScriptCore: 11 12 This patch refactors the various builtin type macros to have a 13 parameter, which is the feature flag enabling it. Since most 14 builtin types are enabled by default this patch adds a new global 15 bool typeExposedByDefault for clarity. Note, because static hash 16 tables have no concept of feature flags we can't use feature flags 17 with lazy properties. This is probably not a big deal as features 18 that are off by default won't be allocated anywhere we care about 19 memory usage anyway. 20 21 * runtime/CommonIdentifiers.h: 22 * runtime/JSGlobalObject.cpp: 23 (JSC::JSGlobalObject::init): 24 (JSC::JSGlobalObject::visitChildren): 25 * runtime/JSGlobalObject.h: 26 (JSC::JSGlobalObject::stringObjectStructure const): 27 (JSC::JSGlobalObject::bigIntObjectStructure const): Deleted. 28 * runtime/Options.h: 29 * wasm/js/JSWebAssembly.cpp: 30 31 Tools: 32 33 JSC options need to be set before the window is created for the test. 34 35 * DumpRenderTree/mac/DumpRenderTree.mm: 36 (resetWebViewToConsistentStateBeforeTesting): 37 * DumpRenderTree/win/DumpRenderTree.cpp: 38 (setJSCOptions): 39 (resetWebViewToConsistentStateBeforeTesting): 40 41 LayoutTests: 42 43 Add JSC option requirements for WeakRef tests. 44 45 * js/script-tests/weakref-async-is-collected.js: 46 * js/script-tests/weakref-eventually-collects-values.js: 47 * js/script-tests/weakref-microtasks-dont-collect.js: 48 * js/script-tests/weakref-weakset-consistency.js: 49 * js/weakref-async-is-collected.html: 50 * js/weakref-eventually-collects-values.html: 51 * js/weakref-microtasks-dont-collect.html: 52 * js/weakref-weakset-consistency.html: 53 54 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247474 268f45cc-cd09-0410-ab3c-d52691b4dbfc 55 56 2019-07-15 Keith Miller <keith_miller@apple.com> 57 58 JSGlobalObject type macros should support feature flags and WeakRef should have one 59 https://bugs.webkit.org/show_bug.cgi?id=199601 60 61 Reviewed by Mark Lam. 62 63 Add JSC option requirements for WeakRef tests. 64 65 * js/script-tests/weakref-async-is-collected.js: 66 * js/script-tests/weakref-eventually-collects-values.js: 67 * js/script-tests/weakref-microtasks-dont-collect.js: 68 * js/script-tests/weakref-weakset-consistency.js: 69 * js/weakref-async-is-collected.html: 70 * js/weakref-eventually-collects-values.html: 71 * js/weakref-microtasks-dont-collect.html: 72 * js/weakref-weakset-consistency.html: 73 1 74 2019-07-17 Kocsen Chung <kocsen_chung@apple.com> 2 75 -
branches/safari-608-branch/LayoutTests/js/script-tests/weakref-async-is-collected.js
r246565 r247589 1 //@ requireOptions("--useWeakRefs=true") 2 1 3 asyncTestStart(1); 2 4 function makeWeakRef() { return new WeakRef({foo: 1 }); } -
branches/safari-608-branch/LayoutTests/js/script-tests/weakref-eventually-collects-values.js
r246565 r247589 1 //@ requireOptions("--useWeakRefs=true") 2 1 3 asyncTestStart(1); 2 4 -
branches/safari-608-branch/LayoutTests/js/script-tests/weakref-microtasks-dont-collect.js
r246565 r247589 1 //@ requireOptions("--useWeakRefs=true") 2 1 3 asyncTestStart(1); 2 4 -
branches/safari-608-branch/LayoutTests/js/script-tests/weakref-weakset-consistency.js
r246565 r247589 1 //@ requireOptions("--useWeakRefs=true") 2 1 3 asyncTestStart(1); 2 4 function makeWeakRef() { return new WeakRef({foo: 1 }); } -
branches/safari-608-branch/LayoutTests/js/weakref-async-is-collected.html
r246565 r247589 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"><!-- webkit-test-runner [ jscOptions=--useWeakRefs=true ] --> 2 2 <html> 3 3 <head> -
branches/safari-608-branch/LayoutTests/js/weakref-eventually-collects-values.html
r246565 r247589 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"><!-- webkit-test-runner [ jscOptions=--useWeakRefs=true ] --> 2 2 <html> 3 3 <head> -
branches/safari-608-branch/LayoutTests/js/weakref-microtasks-dont-collect.html
r246565 r247589 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"><!-- webkit-test-runner [ jscOptions=--useWeakRefs=true ] --> 2 2 <html> 3 3 <head> -
branches/safari-608-branch/LayoutTests/js/weakref-weakset-consistency.html
r246565 r247589 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"><!-- webkit-test-runner [ jscOptions=--useWeakRefs=true ] --> 2 2 <html> 3 3 <head> -
branches/safari-608-branch/Source/JavaScriptCore/ChangeLog
r247432 r247589 1 2019-07-17 Kocsen Chung <kocsen_chung@apple.com> 2 3 Cherry-pick r247474. rdar://problem/53229615 4 5 JSGlobalObject type macros should support feature flags and WeakRef should have one 6 https://bugs.webkit.org/show_bug.cgi?id=199601 7 8 Reviewed by Mark Lam. 9 10 Source/JavaScriptCore: 11 12 This patch refactors the various builtin type macros to have a 13 parameter, which is the feature flag enabling it. Since most 14 builtin types are enabled by default this patch adds a new global 15 bool typeExposedByDefault for clarity. Note, because static hash 16 tables have no concept of feature flags we can't use feature flags 17 with lazy properties. This is probably not a big deal as features 18 that are off by default won't be allocated anywhere we care about 19 memory usage anyway. 20 21 * runtime/CommonIdentifiers.h: 22 * runtime/JSGlobalObject.cpp: 23 (JSC::JSGlobalObject::init): 24 (JSC::JSGlobalObject::visitChildren): 25 * runtime/JSGlobalObject.h: 26 (JSC::JSGlobalObject::stringObjectStructure const): 27 (JSC::JSGlobalObject::bigIntObjectStructure const): Deleted. 28 * runtime/Options.h: 29 * wasm/js/JSWebAssembly.cpp: 30 31 Tools: 32 33 JSC options need to be set before the window is created for the test. 34 35 * DumpRenderTree/mac/DumpRenderTree.mm: 36 (resetWebViewToConsistentStateBeforeTesting): 37 * DumpRenderTree/win/DumpRenderTree.cpp: 38 (setJSCOptions): 39 (resetWebViewToConsistentStateBeforeTesting): 40 41 LayoutTests: 42 43 Add JSC option requirements for WeakRef tests. 44 45 * js/script-tests/weakref-async-is-collected.js: 46 * js/script-tests/weakref-eventually-collects-values.js: 47 * js/script-tests/weakref-microtasks-dont-collect.js: 48 * js/script-tests/weakref-weakset-consistency.js: 49 * js/weakref-async-is-collected.html: 50 * js/weakref-eventually-collects-values.html: 51 * js/weakref-microtasks-dont-collect.html: 52 * js/weakref-weakset-consistency.html: 53 54 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247474 268f45cc-cd09-0410-ab3c-d52691b4dbfc 55 56 2019-07-15 Keith Miller <keith_miller@apple.com> 57 58 JSGlobalObject type macros should support feature flags and WeakRef should have one 59 https://bugs.webkit.org/show_bug.cgi?id=199601 60 61 Reviewed by Mark Lam. 62 63 This patch refactors the various builtin type macros to have a 64 parameter, which is the feature flag enabling it. Since most 65 builtin types are enabled by default this patch adds a new global 66 bool typeExposedByDefault for clarity. Note, because static hash 67 tables have no concept of feature flags we can't use feature flags 68 with lazy properties. This is probably not a big deal as features 69 that are off by default won't be allocated anywhere we care about 70 memory usage anyway. 71 72 * runtime/CommonIdentifiers.h: 73 * runtime/JSGlobalObject.cpp: 74 (JSC::JSGlobalObject::init): 75 (JSC::JSGlobalObject::visitChildren): 76 * runtime/JSGlobalObject.h: 77 (JSC::JSGlobalObject::stringObjectStructure const): 78 (JSC::JSGlobalObject::bigIntObjectStructure const): Deleted. 79 * runtime/Options.h: 80 * wasm/js/JSWebAssembly.cpp: 81 1 82 2019-07-15 Ryan Haddad <ryanhaddad@apple.com> 2 83 -
branches/safari-608-branch/Source/JavaScriptCore/runtime/CommonIdentifiers.h
r246567 r247589 54 54 macro(String) \ 55 55 macro(Symbol) \ 56 macro(WeakRef) \ 56 57 macro(__defineGetter__) \ 57 58 macro(__defineSetter__) \ -
branches/safari-608-branch/Source/JavaScriptCore/runtime/JSGlobalObject.cpp
r247173 r247589 210 210 namespace JSC { 211 211 212 #define CHECK_FEATURE_FLAG_TYPE(capitalName, lowerName, properName, instanceType, jsName, prototypeBase, featureFlag) \ 213 static_assert(std::is_same_v<std::remove_cv_t<decltype(featureFlag)>, bool> || std::is_same_v<std::remove_cv_t<decltype(featureFlag)>, bool&>); 214 215 FOR_EACH_SIMPLE_BUILTIN_TYPE(CHECK_FEATURE_FLAG_TYPE) 216 FOR_EACH_BUILTIN_DERIVED_ITERATOR_TYPE(CHECK_FEATURE_FLAG_TYPE) 217 FOR_EACH_LAZY_BUILTIN_TYPE(CHECK_FEATURE_FLAG_TYPE) 218 212 219 static JSValue createProxyProperty(VM& vm, JSObject* object) 213 220 { … … 364 371 Symbol JSGlobalObject::m_symbolObjectStructure DontEnum|ClassStructure 365 372 WeakMap JSGlobalObject::m_weakMapStructure DontEnum|ClassStructure 366 WeakRef JSGlobalObject::m_weakObjectRefStructure DontEnum|ClassStructure367 373 WeakSet JSGlobalObject::m_weakSetStructure DontEnum|ClassStructure 368 374 @end … … 703 709 m_asyncGeneratorPrototype.set(vm, this, AsyncGeneratorPrototype::create(vm, this, AsyncGeneratorPrototype::createStructure(vm, this, m_asyncIteratorPrototype.get()))); 704 710 705 #define CREATE_PROTOTYPE_FOR_SIMPLE_TYPE(capitalName, lowerName, properName, instanceType, jsName, prototypeBase ) do{ \711 #define CREATE_PROTOTYPE_FOR_SIMPLE_TYPE(capitalName, lowerName, properName, instanceType, jsName, prototypeBase, featureFlag) if (featureFlag) { \ 706 712 m_ ## lowerName ## Prototype.set(vm, this, capitalName##Prototype::create(vm, this, capitalName##Prototype::createStructure(vm, this, m_ ## prototypeBase ## Prototype.get()))); \ 707 713 m_ ## properName ## Structure.set(vm, this, instanceType::createStructure(vm, this, m_ ## lowerName ## Prototype.get())); \ 708 } while (0);714 } 709 715 710 716 FOR_EACH_SIMPLE_BUILTIN_TYPE(CREATE_PROTOTYPE_FOR_SIMPLE_TYPE) 711 712 if (UNLIKELY(Options::useBigInt()))713 FOR_BIG_INT_BUILTIN_TYPE_WITH_CONSTRUCTOR(CREATE_PROTOTYPE_FOR_SIMPLE_TYPE)714 715 717 FOR_EACH_BUILTIN_DERIVED_ITERATOR_TYPE(CREATE_PROTOTYPE_FOR_SIMPLE_TYPE) 716 718 717 719 #undef CREATE_PROTOTYPE_FOR_SIMPLE_TYPE 718 720 719 #define CREATE_PROTOTYPE_FOR_LAZY_TYPE(capitalName, lowerName, properName, instanceType, jsName, prototypeBase )\721 #define CREATE_PROTOTYPE_FOR_LAZY_TYPE(capitalName, lowerName, properName, instanceType, jsName, prototypeBase, featureFlag) if (featureFlag) { \ 720 722 m_ ## properName ## Structure.initLater(\ 721 723 [] (LazyClassStructure::Initializer& init) { \ … … 723 725 init.setStructure(instanceType::createStructure(init.vm, init.global, init.prototype)); \ 724 726 init.setConstructor(capitalName ## Constructor::create(init.vm, capitalName ## Constructor::createStructure(init.vm, init.global, init.global->m_functionPrototype.get()), jsCast<capitalName ## Prototype*>(init.prototype), init.global->m_speciesGetterSetter.get())); \ 725 }); 727 }); \ 728 } 726 729 727 730 FOR_EACH_LAZY_BUILTIN_TYPE(CREATE_PROTOTYPE_FOR_LAZY_TYPE) … … 751 754 #endif 752 755 753 #define CREATE_CONSTRUCTOR_FOR_SIMPLE_TYPE(capitalName, lowerName, properName, instanceType, jsName, prototypeBase) \ 754 capitalName ## Constructor* lowerName ## Constructor = capitalName ## Constructor::create(vm, capitalName ## Constructor::createStructure(vm, this, m_functionPrototype.get()), m_ ## lowerName ## Prototype.get(), m_speciesGetterSetter.get()); \ 755 m_ ## lowerName ## Prototype->putDirectWithoutTransition(vm, vm.propertyNames->constructor, lowerName ## Constructor, static_cast<unsigned>(PropertyAttribute::DontEnum)); \ 756 #define CREATE_CONSTRUCTOR_FOR_SIMPLE_TYPE(capitalName, lowerName, properName, instanceType, jsName, prototypeBase, featureFlag) \ 757 capitalName ## Constructor* lowerName ## Constructor = featureFlag ? capitalName ## Constructor::create(vm, capitalName ## Constructor::createStructure(vm, this, m_functionPrototype.get()), m_ ## lowerName ## Prototype.get(), m_speciesGetterSetter.get()) : nullptr; \ 758 if (featureFlag) \ 759 m_ ## lowerName ## Prototype->putDirectWithoutTransition(vm, vm.propertyNames->constructor, lowerName ## Constructor, static_cast<unsigned>(PropertyAttribute::DontEnum)); \ 756 760 757 761 FOR_EACH_SIMPLE_BUILTIN_TYPE(CREATE_CONSTRUCTOR_FOR_SIMPLE_TYPE) 758 BigIntConstructor* bigIntConstructor = nullptr;759 if (UNLIKELY(Options::useBigInt())) {760 bigIntConstructor = BigIntConstructor::create(vm, BigIntConstructor::createStructure(vm, this, m_functionPrototype.get()), m_bigIntPrototype.get(), m_speciesGetterSetter.get());761 m_bigIntPrototype->putDirectWithoutTransition(vm, vm.propertyNames->constructor, bigIntConstructor, static_cast<unsigned>(PropertyAttribute::DontEnum));762 }763 762 764 763 #undef CREATE_CONSTRUCTOR_FOR_SIMPLE_TYPE … … 831 830 #endif 832 831 833 #define PUT_CONSTRUCTOR_FOR_SIMPLE_TYPE(capitalName, lowerName, properName, instanceType, jsName, prototypeBase) \ 834 putDirectWithoutTransition(vm, vm.propertyNames-> jsName, lowerName ## Constructor, static_cast<unsigned>(PropertyAttribute::DontEnum)); \ 832 #define PUT_CONSTRUCTOR_FOR_SIMPLE_TYPE(capitalName, lowerName, properName, instanceType, jsName, prototypeBase, featureFlag) \ 833 if (featureFlag) \ 834 putDirectWithoutTransition(vm, vm.propertyNames-> jsName, lowerName ## Constructor, static_cast<unsigned>(PropertyAttribute::DontEnum)); 835 835 836 836 837 FOR_EACH_SIMPLE_BUILTIN_TYPE_WITH_CONSTRUCTOR(PUT_CONSTRUCTOR_FOR_SIMPLE_TYPE) 837 if (UNLIKELY(Options::useBigInt()))838 FOR_BIG_INT_BUILTIN_TYPE_WITH_CONSTRUCTOR(PUT_CONSTRUCTOR_FOR_SIMPLE_TYPE)839 838 840 839 #undef PUT_CONSTRUCTOR_FOR_SIMPLE_TYPE … … 1085 1084 putDirectWithoutTransition(vm, Identifier::fromString(exec, "WebAssembly"), webAssembly, static_cast<unsigned>(PropertyAttribute::DontEnum)); 1086 1085 1087 #define CREATE_WEBASSEMBLY_PROTOTYPE(capitalName, lowerName, properName, instanceType, jsName, prototypeBase) \ 1088 m_ ## properName ## Structure.initLater(\ 1089 [] (LazyClassStructure::Initializer& init) { \ 1090 init.setPrototype(capitalName##Prototype::create(init.vm, init.global, capitalName##Prototype::createStructure(init.vm, init.global, init.global->prototypeBase ## Prototype()))); \ 1091 init.setStructure(instanceType::createStructure(init.vm, init.global, init.prototype)); \ 1092 init.setConstructor(capitalName ## Constructor::create(init.vm, capitalName ## Constructor::createStructure(init.vm, init.global, init.global->functionPrototype()), jsCast<capitalName ## Prototype*>(init.prototype))); \ 1093 }); 1086 #define CREATE_WEBASSEMBLY_PROTOTYPE(capitalName, lowerName, properName, instanceType, jsName, prototypeBase, featureFlag) \ 1087 if (featureFlag) {\ 1088 m_ ## properName ## Structure.initLater(\ 1089 [] (LazyClassStructure::Initializer& init) { \ 1090 init.setPrototype(capitalName##Prototype::create(init.vm, init.global, capitalName##Prototype::createStructure(init.vm, init.global, init.global->prototypeBase ## Prototype()))); \ 1091 init.setStructure(instanceType::createStructure(init.vm, init.global, init.prototype)); \ 1092 init.setConstructor(capitalName ## Constructor::create(init.vm, capitalName ## Constructor::createStructure(init.vm, init.global, init.global->functionPrototype()), jsCast<capitalName ## Prototype*>(init.prototype))); \ 1093 }); \ 1094 } 1094 1095 1095 1096 FOR_EACH_WEBASSEMBLY_CONSTRUCTOR_TYPE(CREATE_WEBASSEMBLY_PROTOTYPE) … … 1735 1736 visitor.append(thisObject->m_getterSetterStructure); 1736 1737 thisObject->m_nativeStdFunctionStructure.visit(visitor); 1737 visitor.append(thisObject->m_bigIntObjectStructure);1738 1738 visitor.append(thisObject->m_regExpStructure); 1739 1739 visitor.append(thisObject->m_generatorFunctionStructure); … … 1754 1754 #endif 1755 1755 1756 #define VISIT_SIMPLE_TYPE(CapitalName, lowerName, properName, instanceType, jsName, prototypeBase ) do{ \1756 #define VISIT_SIMPLE_TYPE(CapitalName, lowerName, properName, instanceType, jsName, prototypeBase, featureFlag) if (featureFlag) { \ 1757 1757 visitor.append(thisObject->m_ ## lowerName ## Prototype); \ 1758 1758 visitor.append(thisObject->m_ ## properName ## Structure); \ 1759 } while (0); 1760 1761 #define VISIT_LAZY_TYPE(CapitalName, lowerName, properName, instanceType, jsName, prototypeBase) \ 1762 thisObject->m_ ## properName ## Structure.visit(visitor); 1759 } 1763 1760 1764 1761 FOR_EACH_SIMPLE_BUILTIN_TYPE(VISIT_SIMPLE_TYPE) 1765 if (UNLIKELY(Options::useBigInt()))1766 FOR_BIG_INT_BUILTIN_TYPE_WITH_CONSTRUCTOR(VISIT_SIMPLE_TYPE)1767 1762 FOR_EACH_BUILTIN_DERIVED_ITERATOR_TYPE(VISIT_SIMPLE_TYPE) 1768 1763 1764 #define VISIT_LAZY_TYPE(CapitalName, lowerName, properName, instanceType, jsName, prototypeBase, featureFlag) if (featureFlag) \ 1765 thisObject->m_ ## properName ## Structure.visit(visitor); 1766 1769 1767 FOR_EACH_LAZY_BUILTIN_TYPE(VISIT_LAZY_TYPE) 1770 1768 1771 1769 #if ENABLE(WEBASSEMBLY) 1772 1770 thisObject->m_webAssemblyModuleRecordStructure.visit(visitor); -
branches/safari-608-branch/Source/JavaScriptCore/runtime/JSGlobalObject.h
r247346 r247589 126 126 template<typename Watchpoint> class ObjectPropertyChangeAdaptiveWatchpoint; 127 127 128 #define DEFINE_STANDARD_BUILTIN(macro, upperName, lowerName) macro(upperName, lowerName, lowerName, JS ## upperName, upperName, object) 128 constexpr bool typeExposedByDefault = true; 129 130 #define DEFINE_STANDARD_BUILTIN(macro, upperName, lowerName) macro(upperName, lowerName, lowerName, JS ## upperName, upperName, object, typeExposedByDefault) 129 131 130 132 #define FOR_EACH_SIMPLE_BUILTIN_TYPE_WITH_CONSTRUCTOR(macro) \ 131 macro(String, string, stringObject, StringObject, String, object) \ 132 macro(Map, map, map, JSMap, Map, object) \ 133 macro(Set, set, set, JSSet, Set, object) \ 134 macro(JSPromise, promise, promise, JSPromise, Promise, object) 135 136 #define FOR_BIG_INT_BUILTIN_TYPE_WITH_CONSTRUCTOR(macro) \ 137 macro(BigInt, bigInt, bigIntObject, BigIntObject, BigInt, object) 133 macro(String, string, stringObject, StringObject, String, object, typeExposedByDefault) \ 134 macro(Map, map, map, JSMap, Map, object, typeExposedByDefault) \ 135 macro(Set, set, set, JSSet, Set, object, typeExposedByDefault) \ 136 macro(JSPromise, promise, promise, JSPromise, Promise, object, typeExposedByDefault) \ 137 macro(BigInt, bigInt, bigIntObject, BigIntObject, BigInt, object, Options::useBigInt()) \ 138 macro(WeakObjectRef, weakObjectRef, weakObjectRef, JSWeakObjectRef, WeakRef, object, Options::useWeakRefs()) \ 138 139 139 140 #define FOR_EACH_BUILTIN_DERIVED_ITERATOR_TYPE(macro) \ 140 macro(StringIterator, stringIterator, stringIterator, JSStringIterator, StringIterator, iterator ) \141 macro(StringIterator, stringIterator, stringIterator, JSStringIterator, StringIterator, iterator, typeExposedByDefault) \ 141 142 142 143 #define FOR_EACH_SIMPLE_BUILTIN_TYPE(macro) \ 143 144 FOR_EACH_SIMPLE_BUILTIN_TYPE_WITH_CONSTRUCTOR(macro) \ 144 macro(JSInternalPromise, internalPromise, internalPromise, JSInternalPromise, InternalPromise, object ) \145 macro(JSInternalPromise, internalPromise, internalPromise, JSInternalPromise, InternalPromise, object, typeExposedByDefault) \ 145 146 146 147 #define FOR_EACH_LAZY_BUILTIN_TYPE_WITH_DECLARATION(macro) \ 147 macro(Boolean, boolean, booleanObject, BooleanObject, Boolean, object) \ 148 macro(Date, date, date, DateInstance, Date, object) \ 149 macro(Error, error, error, ErrorInstance, Error, object) \ 150 macro(Number, number, numberObject, NumberObject, Number, object) \ 151 macro(Symbol, symbol, symbolObject, SymbolObject, Symbol, object) \ 152 macro(WeakObjectRef, weakObjectRef, weakObjectRef, JSWeakObjectRef, WeakRef, object) \ 148 macro(Boolean, boolean, booleanObject, BooleanObject, Boolean, object, typeExposedByDefault) \ 149 macro(Date, date, date, DateInstance, Date, object, typeExposedByDefault) \ 150 macro(Error, error, error, ErrorInstance, Error, object, typeExposedByDefault) \ 151 macro(Number, number, numberObject, NumberObject, Number, object, typeExposedByDefault) \ 152 macro(Symbol, symbol, symbolObject, SymbolObject, Symbol, object, typeExposedByDefault) \ 153 153 DEFINE_STANDARD_BUILTIN(macro, WeakMap, weakMap) \ 154 154 DEFINE_STANDARD_BUILTIN(macro, WeakSet, weakSet) \ … … 156 156 #define FOR_EACH_LAZY_BUILTIN_TYPE(macro) \ 157 157 FOR_EACH_LAZY_BUILTIN_TYPE_WITH_DECLARATION(macro) \ 158 macro(JSArrayBuffer, arrayBuffer, arrayBuffer, JSArrayBuffer, ArrayBuffer, object ) \158 macro(JSArrayBuffer, arrayBuffer, arrayBuffer, JSArrayBuffer, ArrayBuffer, object, typeExposedByDefault) \ 159 159 160 160 #if ENABLE(WEBASSEMBLY) 161 161 #define FOR_EACH_WEBASSEMBLY_CONSTRUCTOR_TYPE(macro) \ 162 macro(WebAssemblyCompileError, webAssemblyCompileError, webAssemblyCompileError, JSWebAssemblyCompileError, CompileError, error ) \163 macro(WebAssemblyInstance, webAssemblyInstance, webAssemblyInstance, JSWebAssemblyInstance, Instance, object ) \164 macro(WebAssemblyLinkError, webAssemblyLinkError, webAssemblyLinkError, JSWebAssemblyLinkError, LinkError, error ) \165 macro(WebAssemblyMemory, webAssemblyMemory, webAssemblyMemory, JSWebAssemblyMemory, Memory, object ) \166 macro(WebAssemblyModule, webAssemblyModule, webAssemblyModule, JSWebAssemblyModule, Module, object ) \167 macro(WebAssemblyRuntimeError, webAssemblyRuntimeError, webAssemblyRuntimeError, JSWebAssemblyRuntimeError, RuntimeError, error ) \168 macro(WebAssemblyTable, webAssemblyTable, webAssemblyTable, JSWebAssemblyTable, Table, object )162 macro(WebAssemblyCompileError, webAssemblyCompileError, webAssemblyCompileError, JSWebAssemblyCompileError, CompileError, error, typeExposedByDefault) \ 163 macro(WebAssemblyInstance, webAssemblyInstance, webAssemblyInstance, JSWebAssemblyInstance, Instance, object, typeExposedByDefault) \ 164 macro(WebAssemblyLinkError, webAssemblyLinkError, webAssemblyLinkError, JSWebAssemblyLinkError, LinkError, error, typeExposedByDefault) \ 165 macro(WebAssemblyMemory, webAssemblyMemory, webAssemblyMemory, JSWebAssemblyMemory, Memory, object, typeExposedByDefault) \ 166 macro(WebAssemblyModule, webAssemblyModule, webAssemblyModule, JSWebAssemblyModule, Module, object, typeExposedByDefault) \ 167 macro(WebAssemblyRuntimeError, webAssemblyRuntimeError, webAssemblyRuntimeError, JSWebAssemblyRuntimeError, RuntimeError, error, typeExposedByDefault) \ 168 macro(WebAssemblyTable, webAssemblyTable, webAssemblyTable, JSWebAssemblyTable, Table, object, typeExposedByDefault) 169 169 #else 170 170 #define FOR_EACH_WEBASSEMBLY_CONSTRUCTOR_TYPE(macro) 171 171 #endif // ENABLE(WEBASSEMBLY) 172 172 173 #define DECLARE_SIMPLE_BUILTIN_TYPE(capitalName, lowerName, properName, instanceType, jsName, prototypeBase ) \173 #define DECLARE_SIMPLE_BUILTIN_TYPE(capitalName, lowerName, properName, instanceType, jsName, prototypeBase, featureFlag) \ 174 174 class JS ## capitalName; \ 175 175 class capitalName ## Prototype; \ … … 178 178 class IteratorPrototype; 179 179 FOR_EACH_SIMPLE_BUILTIN_TYPE(DECLARE_SIMPLE_BUILTIN_TYPE) 180 FOR_BIG_INT_BUILTIN_TYPE_WITH_CONSTRUCTOR(DECLARE_SIMPLE_BUILTIN_TYPE)181 180 FOR_EACH_LAZY_BUILTIN_TYPE_WITH_DECLARATION(DECLARE_SIMPLE_BUILTIN_TYPE) 182 181 FOR_EACH_BUILTIN_DERIVED_ITERATOR_TYPE(DECLARE_SIMPLE_BUILTIN_TYPE) … … 389 388 #endif 390 389 391 #define DEFINE_STORAGE_FOR_SIMPLE_TYPE(capitalName, lowerName, properName, instanceType, jsName, prototypeBase ) \390 #define DEFINE_STORAGE_FOR_SIMPLE_TYPE(capitalName, lowerName, properName, instanceType, jsName, prototypeBase, featureFlag) \ 392 391 WriteBarrier<capitalName ## Prototype> m_ ## lowerName ## Prototype; \ 393 392 WriteBarrier<Structure> m_ ## properName ## Structure; 394 393 395 #define DEFINE_STORAGE_FOR_LAZY_TYPE(capitalName, lowerName, properName, instanceType, jsName, prototypeBase ) \394 #define DEFINE_STORAGE_FOR_LAZY_TYPE(capitalName, lowerName, properName, instanceType, jsName, prototypeBase, featureFlag) \ 396 395 LazyClassStructure m_ ## properName ## Structure; 397 396 398 397 FOR_EACH_SIMPLE_BUILTIN_TYPE(DEFINE_STORAGE_FOR_SIMPLE_TYPE) 399 FOR_BIG_INT_BUILTIN_TYPE_WITH_CONSTRUCTOR(DEFINE_STORAGE_FOR_SIMPLE_TYPE)400 398 FOR_EACH_BUILTIN_DERIVED_ITERATOR_TYPE(DEFINE_STORAGE_FOR_SIMPLE_TYPE) 401 399 … … 754 752 Structure* asyncGeneratorFunctionStructure() const { return m_asyncGeneratorFunctionStructure.get(); } 755 753 Structure* stringObjectStructure() const { return m_stringObjectStructure.get(); } 756 Structure* bigIntObjectStructure() const { return m_bigIntObjectStructure.get(); }757 754 Structure* iteratorResultObjectStructure() const { return m_iteratorResultObjectStructure.get(this); } 758 755 Structure* regExpMatchesArrayStructure() const { return m_regExpMatchesArrayStructure.get(); } … … 841 838 } 842 839 843 #define DEFINE_ACCESSORS_FOR_SIMPLE_TYPE(capitalName, lowerName, properName, instanceType, jsName, prototypeBase ) \840 #define DEFINE_ACCESSORS_FOR_SIMPLE_TYPE(capitalName, lowerName, properName, instanceType, jsName, prototypeBase, featureFlag) \ 844 841 Structure* properName ## Structure() { return m_ ## properName ## Structure.get(); } 845 842 846 843 FOR_EACH_SIMPLE_BUILTIN_TYPE(DEFINE_ACCESSORS_FOR_SIMPLE_TYPE) 847 FOR_BIG_INT_BUILTIN_TYPE_WITH_CONSTRUCTOR(DEFINE_ACCESSORS_FOR_SIMPLE_TYPE)848 844 FOR_EACH_BUILTIN_DERIVED_ITERATOR_TYPE(DEFINE_ACCESSORS_FOR_SIMPLE_TYPE) 849 845 850 846 #undef DEFINE_ACCESSORS_FOR_SIMPLE_TYPE 851 847 852 #define DEFINE_ACCESSORS_FOR_LAZY_TYPE(capitalName, lowerName, properName, instanceType, jsName, prototypeBase ) \848 #define DEFINE_ACCESSORS_FOR_LAZY_TYPE(capitalName, lowerName, properName, instanceType, jsName, prototypeBase, featureFlag) \ 853 849 Structure* properName ## Structure() { return m_ ## properName ## Structure.get(this); } \ 854 850 JSObject* properName ## Constructor() { return m_ ## properName ## Structure.constructor(this); } -
branches/safari-608-branch/Source/JavaScriptCore/runtime/Options.h
r247247 r247589 492 492 v(bool, useEagerWebAssemblyModuleHashing, false, Normal, "Unnamed WebAssembly modules are identified in backtraces through their hash, if available.") \ 493 493 v(bool, useWebAssemblyReferences, false, Normal, "Allow types from the wasm references spec.") \ 494 v(bool, useWeakRefs, false, Normal, "Expose the WeakRef constructor.") \ 494 495 v(bool, useBigInt, false, Normal, "If true, we will enable BigInt support.") \ 495 496 v(bool, useArrayAllocationProfiling, true, Normal, "If true, we will use our normal array allocation profiling. If false, the allocation profile will always claim to be undecided.") \ -
branches/safari-608-branch/Source/JavaScriptCore/wasm/js/JSWebAssembly.cpp
r243011 r247589 35 35 STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(JSWebAssembly); 36 36 37 #define DEFINE_CALLBACK_FOR_CONSTRUCTOR(capitalName, lowerName, properName, instanceType, jsName, prototypeBase ) \37 #define DEFINE_CALLBACK_FOR_CONSTRUCTOR(capitalName, lowerName, properName, instanceType, jsName, prototypeBase, featureFlag) \ 38 38 static JSValue create##capitalName(VM& vm, JSObject* object) \ 39 39 { \ -
branches/safari-608-branch/Tools/ChangeLog
r247586 r247589 1 2019-07-17 Kocsen Chung <kocsen_chung@apple.com> 2 3 Cherry-pick r247474. rdar://problem/53229615 4 5 JSGlobalObject type macros should support feature flags and WeakRef should have one 6 https://bugs.webkit.org/show_bug.cgi?id=199601 7 8 Reviewed by Mark Lam. 9 10 Source/JavaScriptCore: 11 12 This patch refactors the various builtin type macros to have a 13 parameter, which is the feature flag enabling it. Since most 14 builtin types are enabled by default this patch adds a new global 15 bool typeExposedByDefault for clarity. Note, because static hash 16 tables have no concept of feature flags we can't use feature flags 17 with lazy properties. This is probably not a big deal as features 18 that are off by default won't be allocated anywhere we care about 19 memory usage anyway. 20 21 * runtime/CommonIdentifiers.h: 22 * runtime/JSGlobalObject.cpp: 23 (JSC::JSGlobalObject::init): 24 (JSC::JSGlobalObject::visitChildren): 25 * runtime/JSGlobalObject.h: 26 (JSC::JSGlobalObject::stringObjectStructure const): 27 (JSC::JSGlobalObject::bigIntObjectStructure const): Deleted. 28 * runtime/Options.h: 29 * wasm/js/JSWebAssembly.cpp: 30 31 Tools: 32 33 JSC options need to be set before the window is created for the test. 34 35 * DumpRenderTree/mac/DumpRenderTree.mm: 36 (resetWebViewToConsistentStateBeforeTesting): 37 * DumpRenderTree/win/DumpRenderTree.cpp: 38 (setJSCOptions): 39 (resetWebViewToConsistentStateBeforeTesting): 40 41 LayoutTests: 42 43 Add JSC option requirements for WeakRef tests. 44 45 * js/script-tests/weakref-async-is-collected.js: 46 * js/script-tests/weakref-eventually-collects-values.js: 47 * js/script-tests/weakref-microtasks-dont-collect.js: 48 * js/script-tests/weakref-weakset-consistency.js: 49 * js/weakref-async-is-collected.html: 50 * js/weakref-eventually-collects-values.html: 51 * js/weakref-microtasks-dont-collect.html: 52 * js/weakref-weakset-consistency.html: 53 54 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247474 268f45cc-cd09-0410-ab3c-d52691b4dbfc 55 56 2019-07-15 Keith Miller <keith_miller@apple.com> 57 58 JSGlobalObject type macros should support feature flags and WeakRef should have one 59 https://bugs.webkit.org/show_bug.cgi?id=199601 60 61 Reviewed by Mark Lam. 62 63 JSC options need to be set before the window is created for the test. 64 65 * DumpRenderTree/mac/DumpRenderTree.mm: 66 (resetWebViewToConsistentStateBeforeTesting): 67 * DumpRenderTree/win/DumpRenderTree.cpp: 68 (setJSCOptions): 69 (resetWebViewToConsistentStateBeforeTesting): 70 1 71 2019-07-17 Kocsen Chung <kocsen_chung@apple.com> 2 72 -
branches/safari-608-branch/Tools/DumpRenderTree/mac/DumpRenderTree.mm
r246285 r247589 1842 1842 static void resetWebViewToConsistentStateBeforeTesting(const TestOptions& options) 1843 1843 { 1844 setJSCOptions(options); 1845 1844 1846 WebView *webView = [mainFrame webView]; 1845 1847 … … 1916 1918 #endif 1917 1919 1918 setJSCOptions(options);1919 1920 1920 WebCoreTestSupport::setAdditionalSupportedImageTypesForTesting(options.additionalSupportedImageTypes.c_str()); 1921 1921 -
branches/safari-608-branch/Tools/DumpRenderTree/win/DumpRenderTree.cpp
r245733 r247589 46 46 47 47 #include <CoreFoundation/CoreFoundation.h> 48 #include <JavaScriptCore/Options.h> 48 49 #include <JavaScriptCore/TestRunnerUtils.h> 49 50 #include <WebKitLegacy/WebKit.h> … … 66 67 #include <wtf/Vector.h> 67 68 #include <wtf/text/CString.h> 69 #include <wtf/text/StringBuilder.h> 68 70 #include <wtf/text/StringConcatenateNumbers.h> 69 71 #include <wtf/text/StringHash.h> … … 942 944 } 943 945 946 static void setJSCOptions(const TestOptions& options) 947 { 948 static WTF::StringBuilder savedOptions; 949 950 if (!savedOptions.isEmpty()) { 951 JSC::Options::setOptions(savedOptions.toString().ascii().data()); 952 savedOptions.clear(); 953 } 954 955 if (options.jscOptions.length()) { 956 JSC::Options::dumpAllOptionsInALine(savedOptions); 957 JSC::Options::setOptions(options.jscOptions.c_str()); 958 } 959 } 960 944 961 static void resetWebViewToConsistentStateBeforeTesting(const TestOptions& options) 945 962 { 963 setJSCOptions(options); 964 946 965 COMPtr<IWebView> webView; 947 966 if (FAILED(frame->webView(&webView)))
Note: See TracChangeset
for help on using the changeset viewer.