tor-browser

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

commit edaeec2a44db3552ff122004a05db13a2bddd6a6
parent d822c1b481c92a5b7cf998528204bfaafa4853ca
Author: André Bargull <andre.bargull@gmail.com>
Date:   Mon, 20 Oct 2025 12:27:43 +0000

Bug 1991402 - Part 15: Support in CallNumberToString Ion ICs. r=jandem

Use `AutoScratchFloatRegister` instead of `AutoAvailableFloatRegister`, because
Ion get-property ICs don't reserve `FloatReg0`.

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

Diffstat:
Mjs/src/jit-test/tests/cacheir/inlinable-native-accessor-6.js | 10++++++++++
Mjs/src/jit/CacheIRCompiler.cpp | 11++++++-----
2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/js/src/jit-test/tests/cacheir/inlinable-native-accessor-6.js b/js/src/jit-test/tests/cacheir/inlinable-native-accessor-6.js @@ -19,3 +19,13 @@ function testDateGetTime() { } } testDateGetTime(); + +function testNumberToString() { + Object.defineProperty(Number.prototype, "tostr", {get: Number.prototype.toString}); + + for (var i = 0; i < 100; ++i) { + assertEq(0..tostr, "0"); + assertEq(0.5.tostr, "0.5"); + } +} +testNumberToString(); diff --git a/js/src/jit/CacheIRCompiler.cpp b/js/src/jit/CacheIRCompiler.cpp @@ -9855,9 +9855,6 @@ bool CacheIRCompiler::emitCallNumberToString(NumberOperandId inputId, StringOperandId resultId) { JitSpew(JitSpew_Codegen, "%s", __FUNCTION__); - AutoAvailableFloatRegister floatScratch0(*this, FloatReg0); - - allocator.ensureDoubleRegister(masm, inputId, floatScratch0); Register result = allocator.defineRegister(masm, resultId); FailurePath* failure; @@ -9865,6 +9862,9 @@ bool CacheIRCompiler::emitCallNumberToString(NumberOperandId inputId, return false; } + AutoScratchFloatRegister scratchFloat(this, failure); + allocator.ensureDoubleRegister(masm, inputId, scratchFloat); + LiveRegisterSet volatileRegs = liveVolatileRegs(); volatileRegs.takeUnchecked(result); masm.PushRegsInMask(volatileRegs); @@ -9873,13 +9873,14 @@ bool CacheIRCompiler::emitCallNumberToString(NumberOperandId inputId, masm.setupUnalignedABICall(result); masm.loadJSContext(result); masm.passABIArg(result); - masm.passABIArg(floatScratch0, ABIType::Float64); + masm.passABIArg(scratchFloat, ABIType::Float64); masm.callWithABI<Fn, js::NumberToStringPure>(); masm.storeCallPointerResult(result); masm.PopRegsInMask(volatileRegs); - masm.branchPtr(Assembler::Equal, result, ImmPtr(nullptr), failure->label()); + masm.branchPtr(Assembler::Equal, result, ImmPtr(nullptr), + scratchFloat.failure()); return true; }