tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 4c851cb40c568abf19267fe97d044748a11eef83
parent feab854a48140a2489368bc0c7770f30292dd030
Author: Rong "Mantle" Bao <webmaster@csmantle.top>
Date:   Thu, 18 Dec 2025 15:12:39 +0000

Bug 2003226 - [riscv64] Account for jal sequence length when extracting slow call marker. r=nbp,rhunt

Differential Revision: https://phabricator.services.mozilla.com/D274548

Diffstat:
Mjs/src/jit/riscv64/MacroAssembler-riscv64.cpp | 16+++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/js/src/jit/riscv64/MacroAssembler-riscv64.cpp b/js/src/jit/riscv64/MacroAssembler-riscv64.cpp @@ -4680,8 +4680,22 @@ const int32_t SlowCallMarker = 0x8093; // addi ra, ra, 0 void MacroAssembler::wasmCheckSlowCallsite(Register ra_, Label* notSlow, Register temp1, Register temp2) { MOZ_ASSERT(ra_ != temp2); + + UseScratchRegisterScope temps(*this); + // temp1 aliases ra_, so allocating a new register. + const Register scratchMarker = temps.Acquire(); + move32(Imm32(SlowCallMarker), scratchMarker); + + Label slow; + // Handle `jalr; (ra_ here) marker`. load32(Address(ra_, 0), temp2); - branch32(Assembler::NotEqual, temp2, Imm32(SlowCallMarker), notSlow); + branch32(Assembler::Equal, temp2, scratchMarker, &slow); + // Handle `jal; (ra_ here) nop; marker`. + // See also: AssemblerRISCVI::jal(Register rd, int32_t imm21); Bug 1996840 + branch32(Assembler::NotEqual, temp2, Imm32(kNopByte), notSlow); + load32(Address(ra_, 4), temp2); + branch32(Assembler::NotEqual, temp2, scratchMarker, notSlow); + bind(&slow); } CodeOffset MacroAssembler::wasmMarkedSlowCall(const wasm::CallSiteDesc& desc,