tor-browser

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

commit 7de83b45c326c15ed2d73108da8bc757ec9c427b
parent b5cc60f342c3b19d70d299bc03f619120e59d873
Author: André Bargull <andre.bargull@gmail.com>
Date:   Thu, 23 Oct 2025 09:56:08 +0000

Bug 1995491 - Part 3: Call Address-based loadInt32OrDouble method. r=spidermonkey-reviewers,iain

Call the `Address` overload to use the improvements from the previous part. Also
include `BaseIndex::offset` in the scaled `Address`.

Note: This method isn't currently used (, but needs to be present because it's
called from `template` code).

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

Diffstat:
Mjs/src/jit/loong64/MacroAssembler-loong64.cpp | 11+----------
Mjs/src/jit/mips64/MacroAssembler-mips64.cpp | 23++---------------------
Mjs/src/jit/riscv64/MacroAssembler-riscv64.cpp | 20+-------------------
3 files changed, 4 insertions(+), 50 deletions(-)

diff --git a/js/src/jit/loong64/MacroAssembler-loong64.cpp b/js/src/jit/loong64/MacroAssembler-loong64.cpp @@ -5611,18 +5611,9 @@ void MacroAssemblerLOONG64Compat::loadInt32OrDouble(const BaseIndex& addr, FloatRegister dest) { UseScratchRegisterScope temps(asMasm()); Register scratch = temps.Acquire(); - Label end; - // If it's an int, convert it to double. computeScaledAddress(addr, scratch); - // Since we only have one scratch, we need to stomp over it with the tag. - loadPtr(Address(scratch, 0), scratch); - as_movgr2fr_d(dest, scratch); - as_srli_d(scratch, scratch, JSVAL_TAG_SHIFT); - asMasm().branchTestInt32(Assembler::NotEqual, scratch, &end); - as_ffint_d_w(dest, dest); - - bind(&end); + loadInt32OrDouble(Address(scratch, addr.offset), dest); } void MacroAssemblerLOONG64Compat::loadConstantDouble(double dp, diff --git a/js/src/jit/mips64/MacroAssembler-mips64.cpp b/js/src/jit/mips64/MacroAssembler-mips64.cpp @@ -2033,30 +2033,11 @@ void MacroAssemblerMIPS64Compat::loadInt32OrDouble(const Address& src, void MacroAssemblerMIPS64Compat::loadInt32OrDouble(const BaseIndex& addr, FloatRegister dest) { - Label notInt32, end; - UseScratchRegisterScope temps(*this); Register scratch = temps.Acquire(); - Register scratch2 = temps.Acquire(); - // If it's an int, convert it to double. - computeScaledAddress(addr, scratch2); - // Since we only have one scratch, we need to stomp over it with the tag. - loadPtr(Address(scratch2, 0), scratch); - ma_dsrl(scratch2, scratch, Imm32(JSVAL_TAG_SHIFT)); - asMasm().branchTestInt32(Assembler::NotEqual, scratch2, &notInt32); - computeScaledAddress(addr, scratch2); - loadPtr(Address(scratch2, 0), scratch2); - convertInt32ToDouble(scratch2, dest); - ma_b(&end, ShortJump); - - // Not an int, just load as double. - bind(&notInt32); - // First, recompute the offset that had been stored in the scratch register - // since the scratch register was overwritten loading in the type. - computeScaledAddress(addr, scratch2); - unboxDouble(Address(scratch2, 0), dest); - bind(&end); + computeScaledAddress(addr, scratch); + loadInt32OrDouble(Address(scratch, addr.offset), dest); } void MacroAssemblerMIPS64Compat::loadConstantDouble(double dp, diff --git a/js/src/jit/riscv64/MacroAssembler-riscv64.cpp b/js/src/jit/riscv64/MacroAssembler-riscv64.cpp @@ -2047,29 +2047,11 @@ void MacroAssemblerRiscv64Compat::loadInt32OrDouble(const Address& src, void MacroAssemblerRiscv64Compat::loadInt32OrDouble(const BaseIndex& addr, FloatRegister dest) { - Label notInt32, end; - UseScratchRegisterScope temps(this); Register scratch = temps.Acquire(); - // If it's an int, convert it to double. - computeScaledAddress(addr, scratch); - // Since we only have one scratch, we need to stomp over it with the tag. - loadPtr(Address(scratch, 0), scratch); - srli(scratch, scratch, JSVAL_TAG_SHIFT); - asMasm().branchTestInt32(Assembler::NotEqual, scratch, &notInt32); computeScaledAddress(addr, scratch); - loadPtr(Address(scratch, 0), scratch); - convertInt32ToDouble(scratch, dest); - ma_branch(&end); - - // Not an int, just load as double. - bind(&notInt32); - // First, recompute the offset that had been stored in the scratch register - // since the scratch register was overwritten loading in the type. - computeScaledAddress(addr, scratch); - unboxDouble(Address(scratch, 0), dest); - bind(&end); + loadInt32OrDouble(Address(scratch, addr.offset), dest); } void MacroAssemblerRiscv64Compat::loadConstantDouble(double dp,