diff --git a/js/public/ProtoKey.h b/js/public/ProtoKey.h index a5ccae69386c..03e2d5382e84 100644 --- a/js/public/ProtoKey.h +++ b/js/public/ProtoKey.h @@ -40,7 +40,13 @@ # define IF_INTL(REAL, IMAGINARY) IMAGINARY #endif -#define JS_FOR_PROTOTYPES_(REAL, IMAGINARY, REAL_IF_INTL) \ +#ifdef ENABLE_WASM_TYPE_REFLECTIONS +# define IF_WASM_TYPE(REAL, IMAGINARY) REAL +#else +# define IF_WASM_TYPE(REAL, IMAGINARY) IMAGINARY +#endif + +#define JS_FOR_PROTOTYPES_(REAL, IMAGINARY, REAL_IF_INTL, REAL_IF_WASM_TYPE) \ IMAGINARY(Null, dummy) \ REAL(Object, OCLASP(Plain)) \ REAL(Function, &FunctionClass) \ @@ -122,15 +128,16 @@ REAL(WasmTable, OCLASP(WasmTable)) \ REAL(WasmGlobal, OCLASP(WasmGlobal)) \ REAL(WasmTag, OCLASP(WasmTag)) \ - REAL(WasmFunction, CLASP(WasmFunction)) \ + REAL_IF_WASM_TYPE(WasmFunction, CLASP(WasmFunction)) \ REAL(WasmException, OCLASP(WasmException)) \ REAL(FinalizationRegistry, OCLASP(FinalizationRegistry)) \ REAL(WeakRef, OCLASP(WeakRef)) \ REAL(Iterator, OCLASP(Iterator)) \ REAL(AsyncIterator, OCLASP(AsyncIterator)) -#define JS_FOR_PROTOTYPES(REAL, IMAGINARY) \ - JS_FOR_PROTOTYPES_(REAL, IMAGINARY, IF_INTL(REAL, IMAGINARY)) +#define JS_FOR_PROTOTYPES(REAL, IMAGINARY) \ + JS_FOR_PROTOTYPES_(REAL, IMAGINARY, IF_INTL(REAL, IMAGINARY), \ + IF_WASM_TYPE(REAL, IMAGINARY)) #define JS_FOR_EACH_PROTOTYPE(MACRO) JS_FOR_PROTOTYPES(MACRO, MACRO) diff --git a/js/src/vm/GlobalObject.cpp b/js/src/vm/GlobalObject.cpp index d2d4c0868b23..074c2ad33894 100644 --- a/js/src/vm/GlobalObject.cpp +++ b/js/src/vm/GlobalObject.cpp @@ -162,7 +162,9 @@ bool GlobalObject::skipDeselectedConstructor(JSContext* cx, JSProtoKey key) { case JSProto_WasmTable: case JSProto_WasmGlobal: case JSProto_WasmTag: +#ifdef ENABLE_WASM_TYPE_REFLECTIONS case JSProto_WasmFunction: +#endif case JSProto_WasmException: return false; diff --git a/js/src/wasm/WasmJS.cpp b/js/src/wasm/WasmJS.cpp index c6cc6ed7d902..7ca64b596f61 100644 --- a/js/src/wasm/WasmJS.cpp +++ b/js/src/wasm/WasmJS.cpp @@ -4310,9 +4310,6 @@ const ClassSpec WasmFunctionClassSpec = {CreateWasmFunctionConstructor, const JSClass js::WasmFunctionClass = { "WebAssembly.Function", 0, JS_NULL_CLASS_OPS, &WasmFunctionClassSpec}; -#else -const JSClass js::WasmFunctionClass = {"WebAssembly.Function", 0, - JS_NULL_CLASS_OPS, JS_NULL_CLASS_SPEC}; #endif // ============================================================================