Bug 1441765 - Guard WebAssembly.Global on EARLY_BETA_OR_EARLIER. r=luke

--HG--
extra : rebase_source : d02e3cddbce369e0e098bb9ad2fd641677697cd0
extra : histedit_source : 86ea4d95421f7b5aa057ed49c0c5729dc26d996e
This commit is contained in:
Lars T Hansen 2018-02-28 09:10:35 +01:00
Родитель 340c815d1c
Коммит 00b5199a07
4 изменённых файлов: 16 добавлений и 14 удалений

Просмотреть файл

@ -652,11 +652,13 @@ if CONFIG['NIGHTLY_BUILD']:
DEFINES['ENABLE_WASM_SATURATING_TRUNC_OPS'] = True
DEFINES['ENABLE_WASM_SIGNEXTEND_OPS'] = True
DEFINES['ENABLE_WASM_THREAD_OPS'] = True
# An experiment we want to run on Nightly: Can we change the JS
# representation of an exported global from the global's value
# to an instance of WebAssembly.Global without breaking existing
# wasm content?
DEFINES['ENABLE_WASM_GLOBAL'] = True
# An experiment we want to run on Nightly and early Beta: Can we change the JS
# representation of an exported global from the global's value to an instance
# of WebAssembly.Global without breaking existing wasm content?
#
# Additionally guarded by EARLY_BETA_OR_EARLIER in the code.
DEFINES['ENABLE_WASM_GLOBAL'] = True
if CONFIG['JS_BUILD_BINAST']:
# Using SOURCES as UNIFIED_SOURCES causes mysterious bugs on 32-bit platforms.

Просмотреть файл

@ -253,7 +253,7 @@ GetImports(JSContext* cx,
MOZ_ASSERT(global.importIndex() == globalIndex - 1);
MOZ_ASSERT(!global.isMutable());
#ifdef ENABLE_WASM_GLOBAL
#if defined(ENABLE_WASM_GLOBAL) && defined(EARLY_BETA_OR_EARLIER)
if (v.isObject() && v.toObject().is<WasmGlobalObject>())
v.set(v.toObject().as<WasmGlobalObject>().value());
#endif
@ -1935,7 +1935,7 @@ WasmTableObject::table() const
// ============================================================================
// WebAssembly.global class and methods
#ifdef ENABLE_WASM_GLOBAL
#if defined(ENABLE_WASM_GLOBAL) && defined(EARLY_BETA_OR_EARLIER)
const ClassOps WasmGlobalObject::classOps_ =
{
@ -2128,7 +2128,7 @@ WasmGlobalObject::value() const
return getReservedSlot(VALUE_SLOT);
}
#endif // ENABLE_WASM_GLOBAL
#endif // ENABLE_WASM_GLOBAL && EARLY_BETA_OR_EARLIER
// ============================================================================
// WebAssembly class and static methods
@ -2968,7 +2968,7 @@ js::InitWebAssemblyClass(JSContext* cx, HandleObject obj)
return nullptr;
RootedObject moduleProto(cx), instanceProto(cx), memoryProto(cx), tableProto(cx);
#ifdef ENABLE_WASM_GLOBAL
#if defined(ENABLE_WASM_GLOBAL) && defined(EARLY_BETA_OR_EARLIER)
RootedObject globalProto(cx);
#endif
if (!InitConstructor<WasmModuleObject>(cx, wasm, "Module", &moduleProto))
@ -2979,7 +2979,7 @@ js::InitWebAssemblyClass(JSContext* cx, HandleObject obj)
return nullptr;
if (!InitConstructor<WasmTableObject>(cx, wasm, "Table", &tableProto))
return nullptr;
#ifdef ENABLE_WASM_GLOBAL
#if defined(ENABLE_WASM_GLOBAL) && defined(EARLY_BETA_OR_EARLIER)
if (!InitConstructor<WasmGlobalObject>(cx, wasm, "Global", &globalProto))
return nullptr;
#endif
@ -3002,7 +3002,7 @@ js::InitWebAssemblyClass(JSContext* cx, HandleObject obj)
global->setPrototype(JSProto_WasmInstance, ObjectValue(*instanceProto));
global->setPrototype(JSProto_WasmMemory, ObjectValue(*memoryProto));
global->setPrototype(JSProto_WasmTable, ObjectValue(*tableProto));
#ifdef ENABLE_WASM_GLOBAL
#if defined(ENABLE_WASM_GLOBAL) && defined(EARLY_BETA_OR_EARLIER)
global->setPrototype(JSProto_WasmGlobal, ObjectValue(*globalProto));
#endif
global->setConstructor(JSProto_WebAssembly, ObjectValue(*wasm));

Просмотреть файл

@ -285,7 +285,7 @@ class WasmTableObject : public NativeObject
wasm::Table& table() const;
};
#ifdef ENABLE_WASM_GLOBAL
#if defined(ENABLE_WASM_GLOBAL) && defined(EARLY_BETA_OR_EARLIER)
// The class of WebAssembly.Global. A WasmGlobalObject holds either the value
// of an immutable wasm global or the cell of a mutable wasm global.
@ -319,7 +319,7 @@ class WasmGlobalObject : public NativeObject
Value value() const;
};
#endif // ENABLE_WASM_GLOBAL
#endif // ENABLE_WASM_GLOBAL && EARLY_BETA_OR_EARLIER
} // namespace js

Просмотреть файл

@ -1016,7 +1016,7 @@ GetGlobalExport(JSContext* cx, const GlobalDescVector& globals, uint32_t globalI
ToJSValue(val, jsval);
#ifdef ENABLE_WASM_GLOBAL
#if defined(ENABLE_WASM_GLOBAL) && defined(EARLY_BETA_OR_EARLIER)
Rooted<WasmGlobalObject*> go(cx, WasmGlobalObject::create(cx, ValType::I32, false, jsval));
if (!go)
return false;