diff --git a/dom/workers/RuntimeService.cpp b/dom/workers/RuntimeService.cpp index f63b1de981..8d9de1e01a 100644 --- a/dom/workers/RuntimeService.cpp +++ b/dom/workers/RuntimeService.cpp @@ -290,13 +290,24 @@ LoadContextOptions(const char* aPrefName, void* /* aClosure */) } // Context options. + bool useAsmJS = GetWorkerPref(NS_LITERAL_CSTRING("asmjs")); + bool useWasm = GetWorkerPref(NS_LITERAL_CSTRING("wasm")); + bool useIon = GetWorkerPref(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(NS_LITERAL_CSTRING("asmjs"))) - .setWasm(GetWorkerPref(NS_LITERAL_CSTRING("wasm"))) + contextOptions.setAsmJS(useAsmJS) + .setWasm(useWasm) .setThrowOnAsmJSValidationFailure(GetWorkerPref( NS_LITERAL_CSTRING("throw_on_asmjs_validation_failure"))) .setBaseline(GetWorkerPref(NS_LITERAL_CSTRING("baselinejit"))) - .setIon(GetWorkerPref(NS_LITERAL_CSTRING("ion"))) + .setIon(useIon) .setNativeRegExp(GetWorkerPref(NS_LITERAL_CSTRING("native_regexp"))) .setAsyncStack(GetWorkerPref(NS_LITERAL_CSTRING("asyncstack"))) .setWerror(GetWorkerPref(NS_LITERAL_CSTRING("werror"))) diff --git a/js/xpconnect/src/XPCJSContext.cpp b/js/xpconnect/src/XPCJSContext.cpp index 3ca3da6b8b..1a102fe820 100644 --- a/js/xpconnect/src/XPCJSContext.cpp +++ b/js/xpconnect/src/XPCJSContext.cpp @@ -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"); diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index dfdfb84b2b..cbf3478dc1 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -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