tor-browser

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

commit af7592e9e83b84cf5af6555c246d62c562817088
parent 6eea065a3b9c8dd1a7fbc716f9ff67db393f4413
Author: Ryan Hunt <rhunt@eqrion.net>
Date:   Fri, 12 Dec 2025 20:49:59 +0000

Bug 1992240 - Rename masm.canonicalizeDouble/Float. r=jandem

Add a 'NaN' postfix as the next commit will add a 'Zero'
variant for canonicalizing denormals to zero.

Taken from a patch on bug 1971519 by nbp.

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

Diffstat:
Mjs/src/jit/CacheIRCompiler.cpp | 10+++++-----
Mjs/src/jit/CodeGenerator.cpp | 10+++++-----
Mjs/src/jit/MacroAssembler-inl.h | 4++--
Mjs/src/jit/MacroAssembler.cpp | 8++++----
Mjs/src/jit/MacroAssembler.h | 4++--
Mjs/src/wasm/WasmStubs.cpp | 14+++++++-------
6 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/js/src/jit/CacheIRCompiler.cpp b/js/src/jit/CacheIRCompiler.cpp @@ -7614,7 +7614,7 @@ bool CacheIRCompiler::emitStoreTypedArrayElement(ObjOperandId objId, // Canonicalize floating point values for differential testing. if (js::SupportDifferentialTesting()) { - masm.canonicalizeDouble(floatScratch0); + masm.canonicalizeDoubleNaN(floatScratch0); } masm.storeToTypedFloatArray(elementType, floatScratch0, dest, temp, @@ -7940,7 +7940,7 @@ bool CacheIRCompiler::emitLoadDataViewValueResult( FloatRegister scratchFloat32 = floatScratch0.get().asSingle(); masm.moveGPRToFloat16(outputScratch, scratchFloat32, scratch2, liveVolatileRegs()); - masm.canonicalizeFloat(scratchFloat32); + masm.canonicalizeFloatNaN(scratchFloat32); masm.convertFloat32ToDouble(scratchFloat32, floatScratch0); masm.boxDouble(floatScratch0, output.valueReg(), floatScratch0); break; @@ -7948,14 +7948,14 @@ bool CacheIRCompiler::emitLoadDataViewValueResult( case Scalar::Float32: { FloatRegister scratchFloat32 = floatScratch0.get().asSingle(); masm.moveGPRToFloat32(outputScratch, scratchFloat32); - masm.canonicalizeFloat(scratchFloat32); + masm.canonicalizeFloatNaN(scratchFloat32); masm.convertFloat32ToDouble(scratchFloat32, floatScratch0); masm.boxDouble(floatScratch0, output.valueReg(), floatScratch0); break; } case Scalar::Float64: masm.moveGPR64ToDouble(outputReg64, floatScratch0); - masm.canonicalizeDouble(floatScratch0); + masm.canonicalizeDoubleNaN(floatScratch0); masm.boxDouble(floatScratch0, output.valueReg(), floatScratch0); break; case Scalar::BigInt64: @@ -8134,7 +8134,7 @@ bool CacheIRCompiler::emitStoreDataViewValueResult( // Canonicalize floating point values for differential testing. if (Scalar::isFloatingType(elementType) && js::SupportDifferentialTesting()) { - masm.canonicalizeDouble(floatScratch0); + masm.canonicalizeDoubleNaN(floatScratch0); } // Load the value into a gpr register. diff --git a/js/src/jit/CodeGenerator.cpp b/js/src/jit/CodeGenerator.cpp @@ -19431,15 +19431,15 @@ void CodeGenerator::visitLoadDataViewElement(LLoadDataViewElement* lir) { break; case Scalar::Float16: masm.moveGPRToFloat16(temp1, out.fpu(), temp2, volatileRegs); - masm.canonicalizeFloat(out.fpu()); + masm.canonicalizeFloatNaN(out.fpu()); break; case Scalar::Float32: masm.moveGPRToFloat32(temp1, out.fpu()); - masm.canonicalizeFloat(out.fpu()); + masm.canonicalizeFloatNaN(out.fpu()); break; case Scalar::Float64: masm.moveGPR64ToDouble(temp64, out.fpu()); - masm.canonicalizeDouble(out.fpu()); + masm.canonicalizeDoubleNaN(out.fpu()); break; case Scalar::Int8: case Scalar::Uint8: @@ -22880,14 +22880,14 @@ void CodeGenerator::visitCanonicalizeNaND(LCanonicalizeNaND* ins) { auto output = ToFloatRegister(ins->output()); MOZ_ASSERT(output == ToFloatRegister(ins->input())); - masm.canonicalizeDouble(output); + masm.canonicalizeDoubleNaN(output); } void CodeGenerator::visitCanonicalizeNaNF(LCanonicalizeNaNF* ins) { auto output = ToFloatRegister(ins->output()); MOZ_ASSERT(output == ToFloatRegister(ins->input())); - masm.canonicalizeFloat(output); + masm.canonicalizeFloatNaN(output); } template <size_t NumDefs> diff --git a/js/src/jit/MacroAssembler-inl.h b/js/src/jit/MacroAssembler-inl.h @@ -869,14 +869,14 @@ void MacroAssembler::branchFloat32NotInUInt64Range(Address src, Register temp, // ======================================================================== // Canonicalization primitives. -void MacroAssembler::canonicalizeFloat(FloatRegister reg) { +void MacroAssembler::canonicalizeFloatNaN(FloatRegister reg) { Label notNaN; branchFloat(DoubleOrdered, reg, reg, &notNaN); loadConstantFloat32(float(JS::GenericNaN()), reg); bind(&notNaN); } -void MacroAssembler::canonicalizeDouble(FloatRegister reg) { +void MacroAssembler::canonicalizeDoubleNaN(FloatRegister reg) { Label notNaN; branchDouble(DoubleOrdered, reg, reg, &notNaN); loadConstantDouble(JS::GenericNaN(), reg); diff --git a/js/src/jit/MacroAssembler.cpp b/js/src/jit/MacroAssembler.cpp @@ -166,15 +166,15 @@ void MacroAssembler::loadFromTypedArray(Scalar::Type arrayType, const T& src, break; case Scalar::Float16: loadFloat16(src, dest.fpu(), temp1, temp2, volatileLiveRegs); - canonicalizeFloat(dest.fpu()); + canonicalizeFloatNaN(dest.fpu()); break; case Scalar::Float32: loadFloat32(src, dest.fpu()); - canonicalizeFloat(dest.fpu()); + canonicalizeFloatNaN(dest.fpu()); break; case Scalar::Float64: loadDouble(src, dest.fpu()); - canonicalizeDouble(dest.fpu()); + canonicalizeDoubleNaN(dest.fpu()); break; case Scalar::BigInt64: case Scalar::BigUint64: @@ -10753,7 +10753,7 @@ void MacroAssembler::touchFrameValues(Register numStackValues, #ifdef FUZZING_JS_FUZZILLI void MacroAssembler::fuzzilliHashDouble(FloatRegister src, Register result, Register temp) { - canonicalizeDouble(src); + canonicalizeDoubleNaN(src); # ifdef JS_PUNBOX64 Register64 r64(temp); diff --git a/js/src/jit/MacroAssembler.h b/js/src/jit/MacroAssembler.h @@ -2229,9 +2229,9 @@ class MacroAssembler : public MacroAssemblerSpecific { // ======================================================================== // Canonicalization primitives. - inline void canonicalizeDouble(FloatRegister reg); + inline void canonicalizeDoubleNaN(FloatRegister reg); - inline void canonicalizeFloat(FloatRegister reg); + inline void canonicalizeFloatNaN(FloatRegister reg); public: // ======================================================================== diff --git a/js/src/wasm/WasmStubs.cpp b/js/src/wasm/WasmStubs.cpp @@ -1254,7 +1254,7 @@ static bool GenerateJitEntry(MacroAssembler& masm, size_t funcExportIndex, masm.boxNonDouble(JSVAL_TYPE_INT32, ReturnReg, JSReturnOperand); break; case ValType::F32: { - masm.canonicalizeFloat(ReturnFloat32Reg); + masm.canonicalizeFloatNaN(ReturnFloat32Reg); masm.convertFloat32ToDouble(ReturnFloat32Reg, ReturnDoubleReg); GenPrintF64(DebugChannel::Function, masm, ReturnDoubleReg); ScratchDoubleScope fpscratch(masm); @@ -1262,7 +1262,7 @@ static bool GenerateJitEntry(MacroAssembler& masm, size_t funcExportIndex, break; } case ValType::F64: { - masm.canonicalizeDouble(ReturnDoubleReg); + masm.canonicalizeDoubleNaN(ReturnDoubleReg); GenPrintF64(DebugChannel::Function, masm, ReturnDoubleReg); ScratchDoubleScope fpscratch(masm); masm.boxDouble(ReturnDoubleReg, JSReturnOperand, fpscratch); @@ -1556,11 +1556,11 @@ void wasm::GenerateDirectCallFromJit(MacroAssembler& masm, const FuncExport& fe, GenPrintI64(DebugChannel::Function, masm, ReturnReg64); break; case wasm::ValType::F32: - masm.canonicalizeFloat(ReturnFloat32Reg); + masm.canonicalizeFloatNaN(ReturnFloat32Reg); GenPrintF32(DebugChannel::Function, masm, ReturnFloat32Reg); break; case wasm::ValType::F64: - masm.canonicalizeDouble(ReturnDoubleReg); + masm.canonicalizeDoubleNaN(ReturnDoubleReg); GenPrintF64(DebugChannel::Function, masm, ReturnDoubleReg); break; case wasm::ValType::Ref: @@ -1794,14 +1794,14 @@ static void FillArgumentArrayForJitExit(MacroAssembler& masm, Register instance, // Preserve the NaN pattern in the input. ScratchDoubleScope fpscratch(masm); masm.moveDouble(srcReg, fpscratch); - masm.canonicalizeDouble(fpscratch); + masm.canonicalizeDoubleNaN(fpscratch); GenPrintF64(DebugChannel::Import, masm, fpscratch); masm.boxDouble(fpscratch, dst); } else if (type == MIRType::Float32) { // JS::Values can't store Float32, so convert to a Double. ScratchDoubleScope fpscratch(masm); masm.convertFloat32ToDouble(srcReg, fpscratch); - masm.canonicalizeDouble(fpscratch); + masm.canonicalizeDoubleNaN(fpscratch); GenPrintF64(DebugChannel::Import, masm, fpscratch); masm.boxDouble(fpscratch, dst); } else if (type == MIRType::Simd128) { @@ -1844,7 +1844,7 @@ static void FillArgumentArrayForJitExit(MacroAssembler& masm, Register instance, } else { masm.loadDouble(src, dscratch); } - masm.canonicalizeDouble(dscratch); + masm.canonicalizeDoubleNaN(dscratch); GenPrintF64(DebugChannel::Import, masm, dscratch); masm.boxDouble(dscratch, dst); } else if (type == MIRType::Simd128) {