Changeset 247474 in webkit


Ignore:
Timestamp:
Jul 15, 2019 9:37:37 PM (5 years ago)
Author:
keith_miller@apple.com
Message:

JSGlobalObject type macros should support feature flags and WeakRef should have one
https://bugs.webkit.org/show_bug.cgi?id=199601

Reviewed by Mark Lam.

Source/JavaScriptCore:

This patch refactors the various builtin type macros to have a
parameter, which is the feature flag enabling it. Since most
builtin types are enabled by default this patch adds a new global
bool typeExposedByDefault for clarity. Note, because static hash
tables have no concept of feature flags we can't use feature flags
with lazy properties. This is probably not a big deal as features
that are off by default won't be allocated anywhere we care about
memory usage anyway.

  • runtime/CommonIdentifiers.h:
  • runtime/JSGlobalObject.cpp:

(JSC::JSGlobalObject::init):
(JSC::JSGlobalObject::visitChildren):

  • runtime/JSGlobalObject.h:

(JSC::JSGlobalObject::stringObjectStructure const):
(JSC::JSGlobalObject::bigIntObjectStructure const): Deleted.

  • runtime/Options.h:
  • wasm/js/JSWebAssembly.cpp:

Tools:

JSC options need to be set before the window is created for the test.

  • DumpRenderTree/mac/DumpRenderTree.mm:

(resetWebViewToConsistentStateBeforeTesting):

  • DumpRenderTree/win/DumpRenderTree.cpp:

(setJSCOptions):
(resetWebViewToConsistentStateBeforeTesting):

LayoutTests:

Add JSC option requirements for WeakRef tests.

  • js/script-tests/weakref-async-is-collected.js:
  • js/script-tests/weakref-eventually-collects-values.js:
  • js/script-tests/weakref-microtasks-dont-collect.js:
  • js/script-tests/weakref-weakset-consistency.js:
  • js/weakref-async-is-collected.html:
  • js/weakref-eventually-collects-values.html:
  • js/weakref-microtasks-dont-collect.html:
  • js/weakref-weakset-consistency.html:
Location:
trunk
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r247472 r247474  
     12019-07-15  Keith Miller  <keith_miller@apple.com>
     2
     3        JSGlobalObject type macros should support feature flags and WeakRef should have one
     4        https://bugs.webkit.org/show_bug.cgi?id=199601
     5
     6        Reviewed by Mark Lam.
     7
     8        Add JSC option requirements for WeakRef tests.
     9
     10        * js/script-tests/weakref-async-is-collected.js:
     11        * js/script-tests/weakref-eventually-collects-values.js:
     12        * js/script-tests/weakref-microtasks-dont-collect.js:
     13        * js/script-tests/weakref-weakset-consistency.js:
     14        * js/weakref-async-is-collected.html:
     15        * js/weakref-eventually-collects-values.html:
     16        * js/weakref-microtasks-dont-collect.html:
     17        * js/weakref-weakset-consistency.html:
     18
    1192019-07-15  Ryan Haddad  <ryanhaddad@apple.com>
    220
  • trunk/LayoutTests/js/script-tests/weakref-async-is-collected.js

    r246565 r247474  
     1//@ requireOptions("--useWeakRefs=true")
     2
    13asyncTestStart(1);
    24function makeWeakRef() { return new WeakRef({foo: 1 }); }
  • trunk/LayoutTests/js/script-tests/weakref-eventually-collects-values.js

    r246565 r247474  
     1//@ requireOptions("--useWeakRefs=true")
     2
    13asyncTestStart(1);
    24
  • trunk/LayoutTests/js/script-tests/weakref-microtasks-dont-collect.js

    r246565 r247474  
     1//@ requireOptions("--useWeakRefs=true")
     2
    13asyncTestStart(1);
    24
  • trunk/LayoutTests/js/script-tests/weakref-weakset-consistency.js

    r246565 r247474  
     1//@ requireOptions("--useWeakRefs=true")
     2
    13asyncTestStart(1);
    24function makeWeakRef() { return new WeakRef({foo: 1 }); }
  • trunk/LayoutTests/js/weakref-async-is-collected.html

    r246565 r247474  
    1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
     1<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"><!-- webkit-test-runner [ jscOptions=--useWeakRefs=true ] -->
    22<html>
    33<head>
  • trunk/LayoutTests/js/weakref-eventually-collects-values.html

    r246565 r247474  
    1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
     1<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"><!-- webkit-test-runner [ jscOptions=--useWeakRefs=true ] -->
    22<html>
    33<head>
  • trunk/LayoutTests/js/weakref-microtasks-dont-collect.html

    r246565 r247474  
    1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
     1<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"><!-- webkit-test-runner [ jscOptions=--useWeakRefs=true ] -->
    22<html>
    33<head>
  • trunk/LayoutTests/js/weakref-weakset-consistency.html

    r246565 r247474  
    1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
     1<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"><!-- webkit-test-runner [ jscOptions=--useWeakRefs=true ] -->
    22<html>
    33<head>
  • trunk/Source/JavaScriptCore/ChangeLog

    r247471 r247474  
     12019-07-15  Keith Miller  <keith_miller@apple.com>
     2
     3        JSGlobalObject type macros should support feature flags and WeakRef should have one
     4        https://bugs.webkit.org/show_bug.cgi?id=199601
     5
     6        Reviewed by Mark Lam.
     7
     8        This patch refactors the various builtin type macros to have a
     9        parameter, which is the feature flag enabling it.  Since most
     10        builtin types are enabled by default this patch adds a new global
     11        bool typeExposedByDefault for clarity. Note, because static hash
     12        tables have no concept of feature flags we can't use feature flags
     13        with lazy properties. This is probably not a big deal as features
     14        that are off by default won't be allocated anywhere we care about
     15        memory usage anyway.
     16
     17        * runtime/CommonIdentifiers.h:
     18        * runtime/JSGlobalObject.cpp:
     19        (JSC::JSGlobalObject::init):
     20        (JSC::JSGlobalObject::visitChildren):
     21        * runtime/JSGlobalObject.h:
     22        (JSC::JSGlobalObject::stringObjectStructure const):
     23        (JSC::JSGlobalObject::bigIntObjectStructure const): Deleted.
     24        * runtime/Options.h:
     25        * wasm/js/JSWebAssembly.cpp:
     26
    1272019-07-15  Keith Miller  <keith_miller@apple.com>
    228
  • trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h

    r246567 r247474  
    5454    macro(String) \
    5555    macro(Symbol) \
     56    macro(WeakRef) \
    5657    macro(__defineGetter__) \
    5758    macro(__defineSetter__) \
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp

    r247457 r247474  
    232232namespace JSC {
    233233
     234#define CHECK_FEATURE_FLAG_TYPE(capitalName, lowerName, properName, instanceType, jsName, prototypeBase, featureFlag) \
     235static_assert(std::is_same_v<std::remove_cv_t<decltype(featureFlag)>, bool> || std::is_same_v<std::remove_cv_t<decltype(featureFlag)>, bool&>);
     236
     237FOR_EACH_SIMPLE_BUILTIN_TYPE(CHECK_FEATURE_FLAG_TYPE)
     238FOR_EACH_BUILTIN_DERIVED_ITERATOR_TYPE(CHECK_FEATURE_FLAG_TYPE)
     239FOR_EACH_LAZY_BUILTIN_TYPE(CHECK_FEATURE_FLAG_TYPE)
     240
    234241static JSValue createProxyProperty(VM& vm, JSObject* object)
    235242{
     
    386393  Symbol                JSGlobalObject::m_symbolObjectStructure      DontEnum|ClassStructure
    387394  WeakMap               JSGlobalObject::m_weakMapStructure           DontEnum|ClassStructure
    388   WeakRef               JSGlobalObject::m_weakObjectRefStructure     DontEnum|ClassStructure
    389395  WeakSet               JSGlobalObject::m_weakSetStructure           DontEnum|ClassStructure
    390396@end
     
    725731    m_asyncGeneratorPrototype.set(vm, this, AsyncGeneratorPrototype::create(vm, this, AsyncGeneratorPrototype::createStructure(vm, this, m_asyncIteratorPrototype.get())));
    726732
    727 #define CREATE_PROTOTYPE_FOR_SIMPLE_TYPE(capitalName, lowerName, properName, instanceType, jsName, prototypeBase) do { \
     733#define CREATE_PROTOTYPE_FOR_SIMPLE_TYPE(capitalName, lowerName, properName, instanceType, jsName, prototypeBase, featureFlag) if (featureFlag) { \
    728734        m_ ## lowerName ## Prototype.set(vm, this, capitalName##Prototype::create(vm, this, capitalName##Prototype::createStructure(vm, this, m_ ## prototypeBase ## Prototype.get()))); \
    729735        m_ ## properName ## Structure.set(vm, this, instanceType::createStructure(vm, this, m_ ## lowerName ## Prototype.get())); \
    730     } while (0);
     736    }
    731737   
    732738    FOR_EACH_SIMPLE_BUILTIN_TYPE(CREATE_PROTOTYPE_FOR_SIMPLE_TYPE)
    733 
    734     if (UNLIKELY(Options::useBigInt()))
    735         FOR_BIG_INT_BUILTIN_TYPE_WITH_CONSTRUCTOR(CREATE_PROTOTYPE_FOR_SIMPLE_TYPE)
    736 
    737739    FOR_EACH_BUILTIN_DERIVED_ITERATOR_TYPE(CREATE_PROTOTYPE_FOR_SIMPLE_TYPE)
    738740   
    739741#undef CREATE_PROTOTYPE_FOR_SIMPLE_TYPE
    740742
    741 #define CREATE_PROTOTYPE_FOR_LAZY_TYPE(capitalName, lowerName, properName, instanceType, jsName, prototypeBase) \
     743#define CREATE_PROTOTYPE_FOR_LAZY_TYPE(capitalName, lowerName, properName, instanceType, jsName, prototypeBase, featureFlag) if (featureFlag) { \
    742744    m_ ## properName ## Structure.initLater(\
    743745        [] (LazyClassStructure::Initializer& init) { \
     
    745747            init.setStructure(instanceType::createStructure(init.vm, init.global, init.prototype)); \
    746748            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())); \
    747         });
     749        }); \
     750    }
    748751   
    749752    FOR_EACH_LAZY_BUILTIN_TYPE(CREATE_PROTOTYPE_FOR_LAZY_TYPE)
     
    773776#endif
    774777
    775 #define CREATE_CONSTRUCTOR_FOR_SIMPLE_TYPE(capitalName, lowerName, properName, instanceType, jsName, prototypeBase) \
    776 capitalName ## Constructor* lowerName ## Constructor = capitalName ## Constructor::create(vm, capitalName ## Constructor::createStructure(vm, this, m_functionPrototype.get()), m_ ## lowerName ## Prototype.get(), m_speciesGetterSetter.get()); \
    777 m_ ## lowerName ## Prototype->putDirectWithoutTransition(vm, vm.propertyNames->constructor, lowerName ## Constructor, static_cast<unsigned>(PropertyAttribute::DontEnum)); \
     778#define CREATE_CONSTRUCTOR_FOR_SIMPLE_TYPE(capitalName, lowerName, properName, instanceType, jsName, prototypeBase, featureFlag) \
     779capitalName ## Constructor* lowerName ## Constructor = featureFlag ? capitalName ## Constructor::create(vm, capitalName ## Constructor::createStructure(vm, this, m_functionPrototype.get()), m_ ## lowerName ## Prototype.get(), m_speciesGetterSetter.get()) : nullptr; \
     780    if (featureFlag) \
     781        m_ ## lowerName ## Prototype->putDirectWithoutTransition(vm, vm.propertyNames->constructor, lowerName ## Constructor, static_cast<unsigned>(PropertyAttribute::DontEnum)); \
    778782
    779783    FOR_EACH_SIMPLE_BUILTIN_TYPE(CREATE_CONSTRUCTOR_FOR_SIMPLE_TYPE)
    780     BigIntConstructor* bigIntConstructor = nullptr;
    781     if (UNLIKELY(Options::useBigInt())) {
    782         bigIntConstructor = BigIntConstructor::create(vm, BigIntConstructor::createStructure(vm, this, m_functionPrototype.get()), m_bigIntPrototype.get(), m_speciesGetterSetter.get());
    783         m_bigIntPrototype->putDirectWithoutTransition(vm, vm.propertyNames->constructor, bigIntConstructor, static_cast<unsigned>(PropertyAttribute::DontEnum));
    784     }
    785784   
    786785#undef CREATE_CONSTRUCTOR_FOR_SIMPLE_TYPE
     
    853852#endif
    854853
    855 #define PUT_CONSTRUCTOR_FOR_SIMPLE_TYPE(capitalName, lowerName, properName, instanceType, jsName, prototypeBase) \
    856 putDirectWithoutTransition(vm, vm.propertyNames-> jsName, lowerName ## Constructor, static_cast<unsigned>(PropertyAttribute::DontEnum)); \
     854#define PUT_CONSTRUCTOR_FOR_SIMPLE_TYPE(capitalName, lowerName, properName, instanceType, jsName, prototypeBase, featureFlag) \
     855    if (featureFlag) \
     856        putDirectWithoutTransition(vm, vm.propertyNames-> jsName, lowerName ## Constructor, static_cast<unsigned>(PropertyAttribute::DontEnum));
     857
    857858
    858859    FOR_EACH_SIMPLE_BUILTIN_TYPE_WITH_CONSTRUCTOR(PUT_CONSTRUCTOR_FOR_SIMPLE_TYPE)
    859     if (UNLIKELY(Options::useBigInt()))
    860         FOR_BIG_INT_BUILTIN_TYPE_WITH_CONSTRUCTOR(PUT_CONSTRUCTOR_FOR_SIMPLE_TYPE)
    861860
    862861#undef PUT_CONSTRUCTOR_FOR_SIMPLE_TYPE
     
    11061105        putDirectWithoutTransition(vm, Identifier::fromString(exec, "WebAssembly"), webAssembly, static_cast<unsigned>(PropertyAttribute::DontEnum));
    11071106
    1108 #define CREATE_WEBASSEMBLY_PROTOTYPE(capitalName, lowerName, properName, instanceType, jsName, prototypeBase) \
    1109     m_ ## properName ## Structure.initLater(\
    1110         [] (LazyClassStructure::Initializer& init) { \
    1111             init.setPrototype(capitalName##Prototype::create(init.vm, init.global, capitalName##Prototype::createStructure(init.vm, init.global, init.global->prototypeBase ## Prototype()))); \
    1112             init.setStructure(instanceType::createStructure(init.vm, init.global, init.prototype)); \
    1113             init.setConstructor(capitalName ## Constructor::create(init.vm, capitalName ## Constructor::createStructure(init.vm, init.global, init.global->functionPrototype()), jsCast<capitalName ## Prototype*>(init.prototype))); \
    1114         });
     1107#define CREATE_WEBASSEMBLY_PROTOTYPE(capitalName, lowerName, properName, instanceType, jsName, prototypeBase, featureFlag) \
     1108    if (featureFlag) {\
     1109        m_ ## properName ## Structure.initLater(\
     1110            [] (LazyClassStructure::Initializer& init) { \
     1111                init.setPrototype(capitalName##Prototype::create(init.vm, init.global, capitalName##Prototype::createStructure(init.vm, init.global, init.global->prototypeBase ## Prototype()))); \
     1112                init.setStructure(instanceType::createStructure(init.vm, init.global, init.prototype)); \
     1113                init.setConstructor(capitalName ## Constructor::create(init.vm, capitalName ## Constructor::createStructure(init.vm, init.global, init.global->functionPrototype()), jsCast<capitalName ## Prototype*>(init.prototype))); \
     1114            }); \
     1115    }
    11151116
    11161117        FOR_EACH_WEBASSEMBLY_CONSTRUCTOR_TYPE(CREATE_WEBASSEMBLY_PROTOTYPE)
     
    17561757    visitor.append(thisObject->m_getterSetterStructure);
    17571758    thisObject->m_nativeStdFunctionStructure.visit(visitor);
    1758     visitor.append(thisObject->m_bigIntObjectStructure);
    17591759    visitor.append(thisObject->m_regExpStructure);
    17601760    visitor.append(thisObject->m_generatorFunctionStructure);
     
    17751775#endif
    17761776
    1777 #define VISIT_SIMPLE_TYPE(CapitalName, lowerName, properName, instanceType, jsName, prototypeBase) do { \
     1777#define VISIT_SIMPLE_TYPE(CapitalName, lowerName, properName, instanceType, jsName, prototypeBase, featureFlag) if (featureFlag) { \
    17781778        visitor.append(thisObject->m_ ## lowerName ## Prototype); \
    17791779        visitor.append(thisObject->m_ ## properName ## Structure); \
    1780     } while (0);
    1781 
    1782 #define VISIT_LAZY_TYPE(CapitalName, lowerName, properName, instanceType, jsName, prototypeBase) \
    1783     thisObject->m_ ## properName ## Structure.visit(visitor);
     1780    }
    17841781
    17851782    FOR_EACH_SIMPLE_BUILTIN_TYPE(VISIT_SIMPLE_TYPE)
    1786     if (UNLIKELY(Options::useBigInt()))
    1787         FOR_BIG_INT_BUILTIN_TYPE_WITH_CONSTRUCTOR(VISIT_SIMPLE_TYPE)
    17881783    FOR_EACH_BUILTIN_DERIVED_ITERATOR_TYPE(VISIT_SIMPLE_TYPE)
    17891784
     1785#define VISIT_LAZY_TYPE(CapitalName, lowerName, properName, instanceType, jsName, prototypeBase, featureFlag) if (featureFlag) \
     1786        thisObject->m_ ## properName ## Structure.visit(visitor);
     1787
    17901788    FOR_EACH_LAZY_BUILTIN_TYPE(VISIT_LAZY_TYPE)
    1791    
     1789
    17921790#if ENABLE(WEBASSEMBLY)
    17931791    thisObject->m_webAssemblyModuleRecordStructure.visit(visitor);
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h

    r247346 r247474  
    126126template<typename Watchpoint> class ObjectPropertyChangeAdaptiveWatchpoint;
    127127
    128 #define DEFINE_STANDARD_BUILTIN(macro, upperName, lowerName) macro(upperName, lowerName, lowerName, JS ## upperName, upperName, object)
     128constexpr bool typeExposedByDefault = true;
     129
     130#define DEFINE_STANDARD_BUILTIN(macro, upperName, lowerName) macro(upperName, lowerName, lowerName, JS ## upperName, upperName, object, typeExposedByDefault)
    129131
    130132#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()) \
    138139
    139140#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) \
    141142
    142143#define FOR_EACH_SIMPLE_BUILTIN_TYPE(macro) \
    143144    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) \
    145146
    146147#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) \
    153153    DEFINE_STANDARD_BUILTIN(macro, WeakMap, weakMap) \
    154154    DEFINE_STANDARD_BUILTIN(macro, WeakSet, weakSet) \
     
    156156#define FOR_EACH_LAZY_BUILTIN_TYPE(macro) \
    157157    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) \
    159159
    160160#if ENABLE(WEBASSEMBLY)
    161161#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)
    169169#else
    170170#define FOR_EACH_WEBASSEMBLY_CONSTRUCTOR_TYPE(macro)
    171171#endif // ENABLE(WEBASSEMBLY)
    172172
    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) \
    174174    class JS ## capitalName; \
    175175    class capitalName ## Prototype; \
     
    178178class IteratorPrototype;
    179179FOR_EACH_SIMPLE_BUILTIN_TYPE(DECLARE_SIMPLE_BUILTIN_TYPE)
    180 FOR_BIG_INT_BUILTIN_TYPE_WITH_CONSTRUCTOR(DECLARE_SIMPLE_BUILTIN_TYPE)
    181180FOR_EACH_LAZY_BUILTIN_TYPE_WITH_DECLARATION(DECLARE_SIMPLE_BUILTIN_TYPE)
    182181FOR_EACH_BUILTIN_DERIVED_ITERATOR_TYPE(DECLARE_SIMPLE_BUILTIN_TYPE)
     
    389388#endif
    390389
    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) \
    392391    WriteBarrier<capitalName ## Prototype> m_ ## lowerName ## Prototype; \
    393392    WriteBarrier<Structure> m_ ## properName ## Structure;
    394393
    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) \
    396395    LazyClassStructure m_ ## properName ## Structure;
    397396
    398397    FOR_EACH_SIMPLE_BUILTIN_TYPE(DEFINE_STORAGE_FOR_SIMPLE_TYPE)
    399     FOR_BIG_INT_BUILTIN_TYPE_WITH_CONSTRUCTOR(DEFINE_STORAGE_FOR_SIMPLE_TYPE)
    400398    FOR_EACH_BUILTIN_DERIVED_ITERATOR_TYPE(DEFINE_STORAGE_FOR_SIMPLE_TYPE)
    401399   
     
    754752    Structure* asyncGeneratorFunctionStructure() const { return m_asyncGeneratorFunctionStructure.get(); }
    755753    Structure* stringObjectStructure() const { return m_stringObjectStructure.get(); }
    756     Structure* bigIntObjectStructure() const { return m_bigIntObjectStructure.get(); }
    757754    Structure* iteratorResultObjectStructure() const { return m_iteratorResultObjectStructure.get(this); }
    758755    Structure* regExpMatchesArrayStructure() const { return m_regExpMatchesArrayStructure.get(); }
     
    841838    }
    842839
    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) \
    844841    Structure* properName ## Structure() { return m_ ## properName ## Structure.get(); }
    845842
    846843    FOR_EACH_SIMPLE_BUILTIN_TYPE(DEFINE_ACCESSORS_FOR_SIMPLE_TYPE)
    847     FOR_BIG_INT_BUILTIN_TYPE_WITH_CONSTRUCTOR(DEFINE_ACCESSORS_FOR_SIMPLE_TYPE)
    848844    FOR_EACH_BUILTIN_DERIVED_ITERATOR_TYPE(DEFINE_ACCESSORS_FOR_SIMPLE_TYPE)
    849845
    850846#undef DEFINE_ACCESSORS_FOR_SIMPLE_TYPE
    851847
    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) \
    853849    Structure* properName ## Structure() { return m_ ## properName ## Structure.get(this); } \
    854850    JSObject* properName ## Constructor() { return m_ ## properName ## Structure.constructor(this); }
  • trunk/Source/JavaScriptCore/runtime/Options.h

    r247247 r247474  
    492492    v(bool, useEagerWebAssemblyModuleHashing, false, Normal, "Unnamed WebAssembly modules are identified in backtraces through their hash, if available.") \
    493493    v(bool, useWebAssemblyReferences, false, Normal, "Allow types from the wasm references spec.") \
     494    v(bool, useWeakRefs, false, Normal, "Expose the WeakRef constructor.") \
    494495    v(bool, useBigInt, false, Normal, "If true, we will enable BigInt support.") \
    495496    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.") \
  • trunk/Source/JavaScriptCore/wasm/js/JSWebAssembly.cpp

    r247457 r247474  
    5858STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(JSWebAssembly);
    5959
    60 #define DEFINE_CALLBACK_FOR_CONSTRUCTOR(capitalName, lowerName, properName, instanceType, jsName, prototypeBase) \
     60#define DEFINE_CALLBACK_FOR_CONSTRUCTOR(capitalName, lowerName, properName, instanceType, jsName, prototypeBase, featureFlag) \
    6161static JSValue create##capitalName(VM& vm, JSObject* object) \
    6262{ \
  • trunk/Tools/ChangeLog

    r247466 r247474  
     12019-07-15  Keith Miller  <keith_miller@apple.com>
     2
     3        JSGlobalObject type macros should support feature flags and WeakRef should have one
     4        https://bugs.webkit.org/show_bug.cgi?id=199601
     5
     6        Reviewed by Mark Lam.
     7
     8        JSC options need to be set before the window is created for the test.
     9
     10        * DumpRenderTree/mac/DumpRenderTree.mm:
     11        (resetWebViewToConsistentStateBeforeTesting):
     12        * DumpRenderTree/win/DumpRenderTree.cpp:
     13        (setJSCOptions):
     14        (resetWebViewToConsistentStateBeforeTesting):
     15
    1162019-07-15  Said Abou-Hallawa  <sabouhallawa@apple.com>
    217
  • trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm

    r246285 r247474  
    18421842static void resetWebViewToConsistentStateBeforeTesting(const TestOptions& options)
    18431843{
     1844    setJSCOptions(options);
     1845
    18441846    WebView *webView = [mainFrame webView];
    18451847
     
    19161918#endif
    19171919
    1918     setJSCOptions(options);
    1919 
    19201920    WebCoreTestSupport::setAdditionalSupportedImageTypesForTesting(options.additionalSupportedImageTypes.c_str());
    19211921
  • trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp

    r245733 r247474  
    4646
    4747#include <CoreFoundation/CoreFoundation.h>
     48#include <JavaScriptCore/Options.h>
    4849#include <JavaScriptCore/TestRunnerUtils.h>
    4950#include <WebKitLegacy/WebKit.h>
     
    6667#include <wtf/Vector.h>
    6768#include <wtf/text/CString.h>
     69#include <wtf/text/StringBuilder.h>
    6870#include <wtf/text/StringConcatenateNumbers.h>
    6971#include <wtf/text/StringHash.h>
     
    942944}
    943945
     946static 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
    944961static void resetWebViewToConsistentStateBeforeTesting(const TestOptions& options)
    945962{
     963    setJSCOptions(options);
     964
    946965    COMPtr<IWebView> webView;
    947966    if (FAILED(frame->webView(&webView)))
Note: See TracChangeset for help on using the changeset viewer.