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 useWasm = GetWorkerPref<bool>(NS_LITERAL_CSTRING("wasm"));
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"));
#if defined(JS_CODEGEN_LOONGARCH64)
useNativeRegExp = false;
#endif
JS::ContextOptions contextOptions;
contextOptions.setAsmJS(useAsmJS)

View file

@ -424,7 +424,7 @@ NativeRegExpMacroAssembler::GenerateCode(JSContext* cx, bool match_only)
LiveGeneralRegisterSet volatileRegs(GeneralRegisterSet::Volatile());
#if defined(JS_CODEGEN_ARM) || defined(JS_CODEGEN_ARM64)
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));
#endif
volatileRegs.takeUnchecked(temp0);
@ -1365,7 +1365,7 @@ NativeRegExpMacroAssembler::CanReadUnaligned()
{
#if defined(JS_CODEGEN_ARM)
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;
#else
return true;

View file

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

View file

@ -1420,12 +1420,6 @@ 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)
// 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 offthreadIonCompilation = Preferences::GetBool(JS_OPTIONS_DOT_STR
"ion.offthread_compilation");

View file

@ -1263,11 +1263,6 @@ 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", true);
pref("javascript.options.asmjs", false);
pref("javascript.options.wasm", true);
#else
pref("javascript.options.ion", true);
// JIT warm-up thresholds (-1 keeps engine defaults).
// 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.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", true);
# else
pref("javascript.options.wasm_baselinejit", true);
# endif
#else
pref("javascript.options.wasm_baselinejit", false);
#endif
#ifdef JS_CODEGEN_LOONGARCH64
pref("javascript.options.native_regexp", false);
#else
pref("javascript.options.native_regexp", true);
#endif
pref("javascript.options.parallel_parsing", true);
// asyncstack is used for debugging promises in devtools.
pref("javascript.options.asyncstack", false);