Issue #3049 - Disable unsupported JIT features in loongarch64 contexts

This commit is contained in:
Basilisk-Dev 2026-04-23 21:42:15 -04:00 committed by wuggy
commit 08d7b89ee5
3 changed files with 33 additions and 4 deletions

View file

@ -290,13 +290,24 @@ LoadContextOptions(const char* aPrefName, void* /* aClosure */)
}
// Context options.
bool useAsmJS = GetWorkerPref<bool>(NS_LITERAL_CSTRING("asmjs"));
bool useWasm = GetWorkerPref<bool>(NS_LITERAL_CSTRING("wasm"));
bool useIon = GetWorkerPref<bool>(NS_LITERAL_CSTRING("ion"));
#if defined(JS_CODEGEN_LOONGARCH64)
// The loongarch64 port is baseline-only for now.
useAsmJS = false;
useWasm = false;
useIon = false;
#endif
JS::ContextOptions contextOptions;
contextOptions.setAsmJS(GetWorkerPref<bool>(NS_LITERAL_CSTRING("asmjs")))
.setWasm(GetWorkerPref<bool>(NS_LITERAL_CSTRING("wasm")))
contextOptions.setAsmJS(useAsmJS)
.setWasm(useWasm)
.setThrowOnAsmJSValidationFailure(GetWorkerPref<bool>(
NS_LITERAL_CSTRING("throw_on_asmjs_validation_failure")))
.setBaseline(GetWorkerPref<bool>(NS_LITERAL_CSTRING("baselinejit")))
.setIon(GetWorkerPref<bool>(NS_LITERAL_CSTRING("ion")))
.setIon(useIon)
.setNativeRegExp(GetWorkerPref<bool>(NS_LITERAL_CSTRING("native_regexp")))
.setAsyncStack(GetWorkerPref<bool>(NS_LITERAL_CSTRING("asyncstack")))
.setWerror(GetWorkerPref<bool>(NS_LITERAL_CSTRING("werror")))

View file

@ -1420,6 +1420,14 @@ ReloadPrefsCallback(const char* pref, void* data)
"throw_on_asmjs_validation_failure");
bool useNativeRegExp = Preferences::GetBool(JS_OPTIONS_DOT_STR "native_regexp") && !safeMode;
#if defined(JS_CODEGEN_LOONGARCH64)
// The loongarch64 port is baseline-only for now.
useIon = false;
useAsmJS = false;
useWasm = false;
useWasmBaseline = false;
#endif
bool parallelParsing = Preferences::GetBool(JS_OPTIONS_DOT_STR "parallel_parsing");
bool offthreadIonCompilation = Preferences::GetBool(JS_OPTIONS_DOT_STR
"ion.offthread_compilation");

View file

@ -1263,8 +1263,12 @@ pref("javascript.options.strict.debug", false);
#endif
pref("javascript.options.unboxed_objects", false);
pref("javascript.options.baselinejit", true);
#if defined(JS_CODEGEN_LOONGARCH64)
pref("javascript.options.ion", false);
pref("javascript.options.asmjs", false);
pref("javascript.options.wasm", false);
#else
pref("javascript.options.ion", true);
pref("javascript.options.ion.inlining", true);
// JIT warm-up thresholds (-1 keeps engine defaults).
// Lower values can improve sustained throughput on large script bundles
// (e.g. React/jQuery-heavy apps) at some startup compile cost.
@ -1272,10 +1276,16 @@ pref("javascript.options.baselinejit.threshold", 6);
pref("javascript.options.ion.threshold", 50);
pref("javascript.options.asmjs", true);
pref("javascript.options.wasm", true);
#endif
pref("javascript.options.ion.inlining", true);
// wasm jit crashes in 32bit builds because of 64bit casts so
// only enable it by default for 64bit builds
#ifdef HAVE_64BIT_BUILD
# if defined(JS_CODEGEN_LOONGARCH64)
pref("javascript.options.wasm_baselinejit", false);
# else
pref("javascript.options.wasm_baselinejit", true);
# endif
#else
pref("javascript.options.wasm_baselinejit", false);
#endif