зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1515917 - Generalize testing for wasm GC availability. r=bbouvier
Generalize the testing of GC availability so that it more accurately reflects whether GC support is actually available, this is a complicated predicate at present. (This was motivated by an attempt to generalize the testing directives, but that generalization does not land yet because it has some obscure effects that need to be addressed first.) The generalization sets us up for splitting apart the code and test cases for the "reftypes" and "gctypes" proposals in a subsequent patch. --HG-- extra : rebase_source : 109b6c53206f5f51a34beb9e568ca0183211eb85 extra : intermediate-source : 7f67226aa4e4c6c1c640b6e3439e47a5c34b3f11 extra : source : 33e686de2b00f6a6f1151b113d112e0c2bd66c86
This commit is contained in:
Родитель
6568267252
Коммит
3311ddda7f
|
@ -670,23 +670,9 @@ static bool WasmBulkMemSupported(JSContext* cx, unsigned argc, Value* vp) {
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool TestGCEnabled(JSContext* cx) {
|
||||
#ifdef ENABLE_WASM_GC
|
||||
bool isSupported = cx->options().wasmBaseline() && cx->options().wasmGc();
|
||||
#ifdef ENABLE_WASM_CRANELIFT
|
||||
if (cx->options().wasmForceCranelift()) {
|
||||
isSupported = false;
|
||||
}
|
||||
#endif
|
||||
return isSupported;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool WasmGcEnabled(JSContext* cx, unsigned argc, Value* vp) {
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
args.rval().setBoolean(TestGCEnabled(cx));
|
||||
args.rval().setBoolean(wasm::HasGcSupport(cx));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -695,7 +681,7 @@ static bool WasmGeneralizedTables(JSContext* cx, unsigned argc, Value* vp) {
|
|||
#ifdef ENABLE_WASM_GENERALIZED_TABLES
|
||||
// Generalized tables depend on anyref, though not currently on (ref T)
|
||||
// types nor on structures or other GC-proposal features.
|
||||
bool isSupported = TestGCEnabled(cx);
|
||||
bool isSupported = wasm::HasGcSupport(cx);
|
||||
#else
|
||||
bool isSupported = false;
|
||||
#endif
|
||||
|
|
|
@ -225,6 +225,6 @@ JitCompileOptions::JitCompileOptions(JSContext* cx) {
|
|||
cx->runtime()->geckoProfiler().slowAssertionsEnabled();
|
||||
offThreadCompilationAvailable_ = OffThreadCompilationAvailable(cx);
|
||||
#ifdef ENABLE_WASM_GC
|
||||
wasmGcEnabled_ = cx->options().wasmGc();
|
||||
wasmGcEnabled_ = wasm::HasGcSupport(cx);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ uint32_t wasm::ObservedCPUFeatures() {
|
|||
CompileArgs::CompileArgs(JSContext* cx, ScriptedCaller&& scriptedCaller)
|
||||
: scriptedCaller(std::move(scriptedCaller)) {
|
||||
#ifdef ENABLE_WASM_GC
|
||||
bool gcEnabled = cx->options().wasmGc();
|
||||
bool gcEnabled = HasGcSupport(cx);
|
||||
#else
|
||||
bool gcEnabled = false;
|
||||
#endif
|
||||
|
|
|
@ -57,6 +57,19 @@ using mozilla::RangedPtr;
|
|||
|
||||
extern mozilla::Atomic<bool> fuzzingSafe;
|
||||
|
||||
bool wasm::HasGcSupport(JSContext* cx) {
|
||||
#ifdef ENABLE_WASM_CRANELIFT
|
||||
if (cx->options().wasmForceCranelift()) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
#ifdef ENABLE_WASM_GC
|
||||
return cx->options().wasmGc() && cx->options().wasmBaseline();
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool wasm::HasCompilerSupport(JSContext* cx) {
|
||||
#if !MOZ_LITTLE_ENDIAN || defined(JS_CODEGEN_NONE)
|
||||
return false;
|
||||
|
@ -2047,7 +2060,7 @@ bool WasmTableObject::isNewborn() const {
|
|||
tableKind = TableKind::AnyFunction;
|
||||
#ifdef ENABLE_WASM_GENERALIZED_TABLES
|
||||
} else if (StringEqualsAscii(elementLinearStr, "anyref")) {
|
||||
if (!cx->options().wasmGc()) {
|
||||
if (!HasGcSupport(cx)) {
|
||||
JS_ReportErrorNumberUTF8(cx, GetErrorMessage, nullptr,
|
||||
JSMSG_WASM_BAD_ELEMENT);
|
||||
return false;
|
||||
|
@ -2460,7 +2473,7 @@ const Class WasmGlobalObject::class_ = {
|
|||
} else if (StringEqualsAscii(typeLinearStr, "f64")) {
|
||||
globalType = ValType::F64;
|
||||
#ifdef ENABLE_WASM_GC
|
||||
} else if (cx->options().wasmGc() &&
|
||||
} else if (HasGcSupport(cx) &&
|
||||
StringEqualsAscii(typeLinearStr, "anyref")) {
|
||||
globalType = ValType::AnyRef;
|
||||
#endif
|
||||
|
|
|
@ -53,6 +53,11 @@ bool HasStreamingSupport(JSContext* cx);
|
|||
|
||||
bool HasCachingSupport(JSContext* cx);
|
||||
|
||||
// Returns true if WebAssembly as configured by compile-time flags and run-time
|
||||
// options can support reference types and stack walking.
|
||||
|
||||
bool HasGcSupport(JSContext* cx);
|
||||
|
||||
// Compiles the given binary wasm module given the ArrayBufferObject
|
||||
// and links the module's imports with the given import object.
|
||||
|
||||
|
|
|
@ -2792,7 +2792,7 @@ bool wasm::Validate(JSContext* cx, const ShareableBytes& bytecode,
|
|||
|
||||
#ifdef ENABLE_WASM_GC
|
||||
HasGcTypes gcTypesConfigured =
|
||||
cx->options().wasmGc() ? HasGcTypes::True : HasGcTypes::False;
|
||||
HasGcSupport(cx) ? HasGcTypes::True : HasGcTypes::False;
|
||||
#else
|
||||
HasGcTypes gcTypesConfigured = HasGcTypes::False;
|
||||
#endif
|
||||
|
|
Загрузка…
Ссылка в новой задаче