Issue #3049 - Re-enable loongarch64 asm.js and native regexp

This commit is contained in:
Basilisk-Dev 2026-04-24 21:40:37 -04:00 • committed by wuggy
commit 2a171ff52a
5 changed files with 3 additions and 32 deletions

View file

@ -293,16 +293,7 @@ LoadContextOptions(const char* aPrefName, void* /* aClosure */)
bool useAsmJS = GetWorkerPref<bool>(NS_LITERAL_CSTRING("asmjs")); bool useAsmJS = GetWorkerPref<bool>(NS_LITERAL_CSTRING("asmjs"));
bool useWasm = GetWorkerPref<bool>(NS_LITERAL_CSTRING("wasm")); bool useWasm = GetWorkerPref<bool>(NS_LITERAL_CSTRING("wasm"));
bool useIon = GetWorkerPref<bool>(NS_LITERAL_CSTRING("ion")); bool useIon = GetWorkerPref<bool>(NS_LITERAL_CSTRING("ion"));
#if defined(JS_CODEGEN_LOONGARCH64)
// asm.js is still disabled on loongarch64 workers.
useAsmJS = false;
#endif
bool useNativeRegExp = GetWorkerPref<bool>(NS_LITERAL_CSTRING("native_regexp")); bool useNativeRegExp = GetWorkerPref<bool>(NS_LITERAL_CSTRING("native_regexp"));
#if defined(JS_CODEGEN_LOONGARCH64)
useNativeRegExp = false;
#endif
JS::ContextOptions contextOptions; JS::ContextOptions contextOptions;
contextOptions.setAsmJS(useAsmJS) contextOptions.setAsmJS(useAsmJS)

View file

@ -424,7 +424,7 @@ NativeRegExpMacroAssembler::GenerateCode(JSContext* cx, bool match_only)
LiveGeneralRegisterSet volatileRegs(GeneralRegisterSet::Volatile()); LiveGeneralRegisterSet volatileRegs(GeneralRegisterSet::Volatile());
#if defined(JS_CODEGEN_ARM) || defined(JS_CODEGEN_ARM64) #if defined(JS_CODEGEN_ARM) || defined(JS_CODEGEN_ARM64)
volatileRegs.add(Register::FromCode(Registers::lr)); volatileRegs.add(Register::FromCode(Registers::lr));
#elif defined(JS_CODEGEN_MIPS32) || defined(JS_CODEGEN_MIPS64) #elif defined(JS_CODEGEN_MIPS32) || defined(JS_CODEGEN_MIPS64) || defined(JS_CODEGEN_LOONGARCH64)
volatileRegs.add(Register::FromCode(Registers::ra)); volatileRegs.add(Register::FromCode(Registers::ra));
#endif #endif
volatileRegs.takeUnchecked(temp0); volatileRegs.takeUnchecked(temp0);
@ -1365,7 +1365,7 @@ NativeRegExpMacroAssembler::CanReadUnaligned()
{ {
#if defined(JS_CODEGEN_ARM) #if defined(JS_CODEGEN_ARM)
return !jit::HasAlignmentFault(); return !jit::HasAlignmentFault();
#elif defined(JS_CODEGEN_MIPS32) || defined(JS_CODEGEN_MIPS64) #elif defined(JS_CODEGEN_MIPS32) || defined(JS_CODEGEN_MIPS64) || defined(JS_CODEGEN_LOONGARCH64)
return false; return false;
#else #else
return true; return true;

View file

@ -1251,7 +1251,7 @@ SampleChars(FrequencyCollator* collator, const CharT* chars, size_t length)
static bool static bool
IsNativeRegExpEnabled(JSContext* cx) IsNativeRegExpEnabled(JSContext* cx)
{ {
#if defined(JS_CODEGEN_NONE) || defined(JS_CODEGEN_LOONGARCH64) #if defined(JS_CODEGEN_NONE)
return false; return false;
#else #else
return cx->options().nativeRegExp(); return cx->options().nativeRegExp();

View file

@ -1420,12 +1420,6 @@ ReloadPrefsCallback(const char* pref, void* data)
"throw_on_asmjs_validation_failure"); "throw_on_asmjs_validation_failure");
bool useNativeRegExp = Preferences::GetBool(JS_OPTIONS_DOT_STR "native_regexp") && !safeMode; bool useNativeRegExp = Preferences::GetBool(JS_OPTIONS_DOT_STR "native_regexp") && !safeMode;
#if defined(JS_CODEGEN_LOONGARCH64)
// asm.js and native regexp JIT are still disabled on loongarch64.
useAsmJS = false;
useNativeRegExp = false;
#endif
bool parallelParsing = Preferences::GetBool(JS_OPTIONS_DOT_STR "parallel_parsing"); bool parallelParsing = Preferences::GetBool(JS_OPTIONS_DOT_STR "parallel_parsing");
bool offthreadIonCompilation = Preferences::GetBool(JS_OPTIONS_DOT_STR bool offthreadIonCompilation = Preferences::GetBool(JS_OPTIONS_DOT_STR
"ion.offthread_compilation"); "ion.offthread_compilation");

View file

@ -1263,11 +1263,6 @@ pref("javascript.options.strict.debug", false);
#endif #endif
pref("javascript.options.unboxed_objects", false); pref("javascript.options.unboxed_objects", false);
pref("javascript.options.baselinejit", true); pref("javascript.options.baselinejit", true);
#if defined(JS_CODEGEN_LOONGARCH64)
pref("javascript.options.ion", true);
pref("javascript.options.asmjs", false);
pref("javascript.options.wasm", true);
#else
pref("javascript.options.ion", true); pref("javascript.options.ion", true);
// JIT warm-up thresholds (-1 keeps engine defaults). // JIT warm-up thresholds (-1 keeps engine defaults).
// Lower values can improve sustained throughput on large script bundles // Lower values can improve sustained throughput on large script bundles
@ -1276,24 +1271,15 @@ pref("javascript.options.baselinejit.threshold", 6);
pref("javascript.options.ion.threshold", 50); pref("javascript.options.ion.threshold", 50);
pref("javascript.options.asmjs", true); pref("javascript.options.asmjs", true);
pref("javascript.options.wasm", true); pref("javascript.options.wasm", true);
#endif
pref("javascript.options.ion.inlining", true); pref("javascript.options.ion.inlining", true);
// wasm jit crashes in 32bit builds because of 64bit casts so // wasm jit crashes in 32bit builds because of 64bit casts so
// only enable it by default for 64bit builds // only enable it by default for 64bit builds
#ifdef HAVE_64BIT_BUILD #ifdef HAVE_64BIT_BUILD
# if defined(JS_CODEGEN_LOONGARCH64)
pref("javascript.options.wasm_baselinejit", true); pref("javascript.options.wasm_baselinejit", true);
# else
pref("javascript.options.wasm_baselinejit", true);
# endif
#else #else
pref("javascript.options.wasm_baselinejit", false); pref("javascript.options.wasm_baselinejit", false);
#endif #endif
#ifdef JS_CODEGEN_LOONGARCH64
pref("javascript.options.native_regexp", false);
#else
pref("javascript.options.native_regexp", true); pref("javascript.options.native_regexp", true);
#endif
pref("javascript.options.parallel_parsing", true); pref("javascript.options.parallel_parsing", true);
// asyncstack is used for debugging promises in devtools. // asyncstack is used for debugging promises in devtools.
pref("javascript.options.asyncstack", false); pref("javascript.options.asyncstack", false);