From acea3a2b6b229f52a56533c0558caa7c22c4b5ab Mon Sep 17 00:00:00 2001 From: Basilisk-Dev Date: Thu, 23 Apr 2026 19:16:28 -0400 Subject: [PATCH] Issue #3049 - Wire loongarch64 non-Ion frame and patch hooks --- js/src/jit/JitFrames.cpp | 7 +++++++ js/src/jit/loongarch64/Assembler-loongarch64.cpp | 8 ++++++++ js/src/jit/loongarch64/Assembler-loongarch64.h | 12 ++++++++++++ 3 files changed, 27 insertions(+) diff --git a/js/src/jit/JitFrames.cpp b/js/src/jit/JitFrames.cpp index 65b0e8abfb..a6fee5dec6 100644 --- a/js/src/jit/JitFrames.cpp +++ b/js/src/jit/JitFrames.cpp @@ -2539,6 +2539,13 @@ MachineState::FromBailout(RegisterDump::GPRArray& regs, RegisterDump::FPUArray& machine.setRegisterLocation(FloatRegister(i, FloatRegisters::Double), &fpregs[i]); machine.setRegisterLocation(FloatRegister(i, FloatRegisters::Single), &fpregs[i]); } +#elif defined(JS_CODEGEN_LOONGARCH64) + for (unsigned i = 0; i < FloatRegisters::TotalPhys; i++) { + machine.setRegisterLocation(FloatRegister(FloatRegister::Encoding(i), FloatRegisters::Double), + &fpregs[i]); + machine.setRegisterLocation(FloatRegister(FloatRegister::Encoding(i), FloatRegisters::Single), + &fpregs[i]); + } #elif defined(JS_CODEGEN_X86) || defined(JS_CODEGEN_X64) for (unsigned i = 0; i < FloatRegisters::TotalPhys; i++) { machine.setRegisterLocation(FloatRegister(i, FloatRegisters::Single), &fpregs[i]); diff --git a/js/src/jit/loongarch64/Assembler-loongarch64.cpp b/js/src/jit/loongarch64/Assembler-loongarch64.cpp index ffa748e09b..760e2f17dd 100644 --- a/js/src/jit/loongarch64/Assembler-loongarch64.cpp +++ b/js/src/jit/loongarch64/Assembler-loongarch64.cpp @@ -19,6 +19,14 @@ using mozilla::DebugOnly; using namespace js; using namespace js::jit; +void js::jit::PatchJump(CodeLocationJump& jump_, CodeLocationLabel label, + ReprotectCode reprotect) { + (void)jump_; + (void)label; + (void)reprotect; + MOZ_CRASH("Ion patching is not supported on loongarch64"); +} + // Note this is used for inter-wasm calls and may pass arguments and results // in floating point registers even if the system ABI does not. diff --git a/js/src/jit/loongarch64/Assembler-loongarch64.h b/js/src/jit/loongarch64/Assembler-loongarch64.h index ffb14e742f..c6c23dd377 100644 --- a/js/src/jit/loongarch64/Assembler-loongarch64.h +++ b/js/src/jit/loongarch64/Assembler-loongarch64.h @@ -12,6 +12,7 @@ #include "jit/CompactBuffer.h" #include "jit/IonCode.h" +#include "jit/JitCompartment.h" #include "jit/JitSpewer.h" #include "jit/loongarch64/Architecture-loongarch64.h" #include "jit/shared/Assembler-shared.h" @@ -1448,6 +1449,7 @@ class AssemblerLOONGARCH64 : public AssemblerShared { return false; #endif } + static bool SupportsSimd() { return false; } static bool SupportsUnalignedAccesses() { return true; } static bool SupportsFastUnalignedFPAccesses() { return true; } @@ -1882,6 +1884,16 @@ static inline bool GetTempRegForIntArg(uint32_t usedIntArgs, return true; } +void PatchJump(CodeLocationJump& jump_, CodeLocationLabel label, + ReprotectCode reprotect = DontReprotect); + +static inline void PatchBackedge(CodeLocationJump& jump_, + CodeLocationLabel label, + JitRuntime::BackedgeTarget target) { + (void)target; + PatchJump(jump_, label); +} + } // namespace jit } // namespace js