Bug 1431402 - Add floating-point-to-64bit-int conversion to MacroAssembler.h. r=nbp
authorLars T Hansen <lhansen@mozilla.com>
Thu, 18 Jan 2018 15:00:45 +0100
changeset 453242 4f58e75a8a20205da6828ce9556f0b31f0b5a4ba
parent 453241 045ded11d3f810ea430b0eed3026534f2508d955
child 453243 f9d87461d51a216f8e43e8e7b5d2418f1aa1ad1a
push id8799
push usermtabara@mozilla.com
push dateThu, 01 Mar 2018 16:46:23 +0000
treeherdermozilla-beta@15334014dc67 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnbp
bugs1431402
milestone60.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1431402 - Add floating-point-to-64bit-int conversion to MacroAssembler.h. r=nbp Including ARM64 stubs here because it simplifies code in the Wasm baseline compiler, and doesn't hurt.
js/src/jit/MacroAssembler.h
js/src/jit/arm64/MacroAssembler-arm64.cpp
js/src/jit/x64/MacroAssembler-x64.cpp
js/src/jit/x64/MacroAssembler-x64.h
js/src/jit/x86/MacroAssembler-x86.cpp
js/src/jit/x86/MacroAssembler-x86.h
--- a/js/src/jit/MacroAssembler.h
+++ b/js/src/jit/MacroAssembler.h
@@ -1501,19 +1501,32 @@ class MacroAssembler : public MacroAssem
         DEFINED_ON(x86_shared);
 
     void wasmTruncateFloat32ToUInt32(FloatRegister input, Register output, Label* oolEntry) PER_ARCH;
     void wasmTruncateFloat32ToInt32(FloatRegister input, Register output, Label* oolEntry) PER_SHARED_ARCH;
     void outOfLineWasmTruncateFloat32ToInt32(FloatRegister input, bool isUnsigned,
                                              wasm::BytecodeOffset off, Label* rejoin)
         DEFINED_ON(x86_shared);
 
+    void wasmTruncateDoubleToInt64(FloatRegister input, Register64 output, Label* oolEntry,
+                                   Label* oolRejoin, FloatRegister tempDouble)
+        DEFINED_ON(arm64, x86, x64);
+    void wasmTruncateDoubleToUInt64(FloatRegister input, Register64 output, Label* oolEntry,
+                                    Label* oolRejoin, FloatRegister tempDouble)
+        DEFINED_ON(arm64, x86, x64);
     void outOfLineWasmTruncateDoubleToInt64(FloatRegister input, bool isUnsigned,
                                             wasm::BytecodeOffset off, Label* rejoin)
         DEFINED_ON(x86_shared);
+
+    void wasmTruncateFloat32ToInt64(FloatRegister input, Register64 output, Label* oolEntry,
+                                    Label* oolRejoin, FloatRegister tempDouble)
+        DEFINED_ON(arm64, x86, x64);
+    void wasmTruncateFloat32ToUInt64(FloatRegister input, Register64 output, Label* oolEntry,
+                                     Label* oolRejoin, FloatRegister tempDouble)
+        DEFINED_ON(arm64, x86, x64);
     void outOfLineWasmTruncateFloat32ToInt64(FloatRegister input, bool isUnsigned,
                                              wasm::BytecodeOffset off, Label* rejoin)
         DEFINED_ON(x86_shared);
 
     // This function takes care of loading the callee's TLS and pinned regs but
     // it is the caller's responsibility to save/restore TLS or pinned regs.
     void wasmCallImport(const wasm::CallSiteDesc& desc, const wasm::CalleeDesc& callee);
 
--- a/js/src/jit/arm64/MacroAssembler-arm64.cpp
+++ b/js/src/jit/arm64/MacroAssembler-arm64.cpp
@@ -877,16 +877,44 @@ MacroAssembler::wasmTruncateFloat32ToUIn
 }
 
 void
 MacroAssembler::wasmTruncateFloat32ToInt32(FloatRegister input, Register output, Label* oolEntry)
 {
     MOZ_CRASH("NYI");
 }
 
+void
+MacroAssembler::wasmTruncateDoubleToInt64(FloatRegister input, Register64 output, Label* oolEntry,
+                                          Label* oolRejoin, FloatRegister tempDouble)
+{
+    MOZ_CRASH("NYI");
+}
+
+void
+MacroAssembler::wasmTruncateDoubleToUInt64(FloatRegister input, Register64 output, Label* oolEntry,
+                                           Label* oolRejoin, FloatRegister tempDouble)
+{
+    MOZ_CRASH("NYI");
+}
+
+void
+MacroAssembler::wasmTruncateFloat32ToInt64(FloatRegister input, Register64 output, Label* oolEntry,
+                                           Label* oolRejoin, FloatRegister tempDouble)
+{
+    MOZ_CRASH("NYI");
+}
+
+void
+MacroAssembler::wasmTruncateFloat32ToUInt64(FloatRegister input, Register64 output, Label* oolEntry,
+                                            Label* oolRejoin, FloatRegister tempDouble)
+{
+    MOZ_CRASH("NYI");
+}
+
 // ========================================================================
 // Primitive atomic operations.
 
 void
 MacroAssembler::compareExchange(Scalar::Type type, const Synchronization& sync, const Address& mem,
                                 Register oldval, Register newval, Register output)
 {
     MOZ_CRASH("NYI");
--- a/js/src/jit/x64/MacroAssembler-x64.cpp
+++ b/js/src/jit/x64/MacroAssembler-x64.cpp
@@ -154,96 +154,16 @@ MacroAssemblerX64::convertUInt64ToFloat3
 
     vcvtsq2ss(scratch, output, output);
     vaddss(output, output, output);
 
     bind(&done);
 }
 
 void
-MacroAssemblerX64::wasmTruncateDoubleToInt64(FloatRegister input, Register64 output, Label* oolEntry,
-                                             Label* oolRejoin, FloatRegister tempReg)
-{
-    vcvttsd2sq(input, output.reg);
-    cmpq(Imm32(1), output.reg);
-    j(Assembler::Overflow, oolEntry);
-    bind(oolRejoin);
-}
-
-void
-MacroAssemblerX64::wasmTruncateFloat32ToInt64(FloatRegister input, Register64 output, Label* oolEntry,
-                                              Label* oolRejoin, FloatRegister tempReg)
-{
-    vcvttss2sq(input, output.reg);
-    cmpq(Imm32(1), output.reg);
-    j(Assembler::Overflow, oolEntry);
-    bind(oolRejoin);
-}
-
-void
-MacroAssemblerX64::wasmTruncateDoubleToUInt64(FloatRegister input, Register64 output, Label* oolEntry,
-                                              Label* oolRejoin, FloatRegister tempReg)
-{
-    // If the input < INT64_MAX, vcvttsd2sq will do the right thing, so
-    // we use it directly. Else, we subtract INT64_MAX, convert to int64,
-    // and then add INT64_MAX to the result.
-
-    Label isLarge;
-
-    ScratchDoubleScope scratch(asMasm());
-    loadConstantDouble(double(0x8000000000000000), scratch);
-    asMasm().branchDouble(Assembler::DoubleGreaterThanOrEqual, input, scratch, &isLarge);
-    vcvttsd2sq(input, output.reg);
-    testq(output.reg, output.reg);
-    j(Assembler::Signed, oolEntry);
-    jump(oolRejoin);
-
-    bind(&isLarge);
-
-    moveDouble(input, tempReg);
-    vsubsd(scratch, tempReg, tempReg);
-    vcvttsd2sq(tempReg, output.reg);
-    testq(output.reg, output.reg);
-    j(Assembler::Signed, oolEntry);
-    asMasm().or64(Imm64(0x8000000000000000), output);
-
-    bind(oolRejoin);
-}
-
-void
-MacroAssemblerX64::wasmTruncateFloat32ToUInt64(FloatRegister input, Register64 output, Label* oolEntry,
-                                               Label* oolRejoin, FloatRegister tempReg)
-{
-    // If the input < INT64_MAX, vcvttss2sq will do the right thing, so
-    // we use it directly. Else, we subtract INT64_MAX, convert to int64,
-    // and then add INT64_MAX to the result.
-
-    Label isLarge;
-
-    ScratchFloat32Scope scratch(asMasm());
-    loadConstantFloat32(float(0x8000000000000000), scratch);
-    asMasm().branchFloat(Assembler::DoubleGreaterThanOrEqual, input, scratch, &isLarge);
-    vcvttss2sq(input, output.reg);
-    testq(output.reg, output.reg);
-    j(Assembler::Signed, oolEntry);
-    jump(oolRejoin);
-
-    bind(&isLarge);
-
-    moveFloat32(input, tempReg);
-    vsubss(scratch, tempReg, tempReg);
-    vcvttss2sq(tempReg, output.reg);
-    testq(output.reg, output.reg);
-    j(Assembler::Signed, oolEntry);
-    asMasm().or64(Imm64(0x8000000000000000), output);
-
-    bind(oolRejoin);
-}
-
-void
 MacroAssemblerX64::bindOffsets(const MacroAssemblerX86Shared::UsesVector& uses)
 {
     for (CodeOffset use : uses) {
         JmpDst dst(currentOffset());
         JmpSrc src(use.offset());
         // Using linkJump here is safe, as explaind in the comment in
         // loadConstantDouble.
         masm.linkJump(src, dst);
@@ -918,16 +838,96 @@ MacroAssembler::wasmTruncateFloat32ToUIn
 
     // Check that the result is in the uint32_t range.
     ScratchRegisterScope scratch(*this);
     move32(Imm32(0xffffffff), scratch);
     cmpq(scratch, output);
     j(Assembler::Above, oolEntry);
 }
 
+void
+MacroAssembler::wasmTruncateDoubleToInt64(FloatRegister input, Register64 output, Label* oolEntry,
+                                          Label* oolRejoin, FloatRegister tempReg)
+{
+    vcvttsd2sq(input, output.reg);
+    cmpq(Imm32(1), output.reg);
+    j(Assembler::Overflow, oolEntry);
+    bind(oolRejoin);
+}
+
+void
+MacroAssembler::wasmTruncateFloat32ToInt64(FloatRegister input, Register64 output, Label* oolEntry,
+                                           Label* oolRejoin, FloatRegister tempReg)
+{
+    vcvttss2sq(input, output.reg);
+    cmpq(Imm32(1), output.reg);
+    j(Assembler::Overflow, oolEntry);
+    bind(oolRejoin);
+}
+
+void
+MacroAssembler::wasmTruncateDoubleToUInt64(FloatRegister input, Register64 output, Label* oolEntry,
+                                           Label* oolRejoin, FloatRegister tempReg)
+{
+    // If the input < INT64_MAX, vcvttsd2sq will do the right thing, so
+    // we use it directly. Else, we subtract INT64_MAX, convert to int64,
+    // and then add INT64_MAX to the result.
+
+    Label isLarge;
+
+    ScratchDoubleScope scratch(*this);
+    loadConstantDouble(double(0x8000000000000000), scratch);
+    branchDouble(Assembler::DoubleGreaterThanOrEqual, input, scratch, &isLarge);
+    vcvttsd2sq(input, output.reg);
+    testq(output.reg, output.reg);
+    j(Assembler::Signed, oolEntry);
+    jump(oolRejoin);
+
+    bind(&isLarge);
+
+    moveDouble(input, tempReg);
+    vsubsd(scratch, tempReg, tempReg);
+    vcvttsd2sq(tempReg, output.reg);
+    testq(output.reg, output.reg);
+    j(Assembler::Signed, oolEntry);
+    or64(Imm64(0x8000000000000000), output);
+
+    bind(oolRejoin);
+}
+
+void
+MacroAssembler::wasmTruncateFloat32ToUInt64(FloatRegister input, Register64 output, Label* oolEntry,
+                                            Label* oolRejoin, FloatRegister tempReg)
+{
+    // If the input < INT64_MAX, vcvttss2sq will do the right thing, so
+    // we use it directly. Else, we subtract INT64_MAX, convert to int64,
+    // and then add INT64_MAX to the result.
+
+    Label isLarge;
+
+    ScratchFloat32Scope scratch(*this);
+    loadConstantFloat32(float(0x8000000000000000), scratch);
+    branchFloat(Assembler::DoubleGreaterThanOrEqual, input, scratch, &isLarge);
+    vcvttss2sq(input, output.reg);
+    testq(output.reg, output.reg);
+    j(Assembler::Signed, oolEntry);
+    jump(oolRejoin);
+
+    bind(&isLarge);
+
+    moveFloat32(input, tempReg);
+    vsubss(scratch, tempReg, tempReg);
+    vcvttss2sq(tempReg, output.reg);
+    testq(output.reg, output.reg);
+    j(Assembler::Signed, oolEntry);
+    or64(Imm64(0x8000000000000000), output);
+
+    bind(oolRejoin);
+}
+
 // ========================================================================
 // Primitive atomic operations.
 
 void
 MacroAssembler::compareExchange64(const Synchronization&, const Address& mem, Register64 expected,
                                   Register64 replacement, Register64 output)
 {
     MOZ_ASSERT(output.reg == rax);
--- a/js/src/jit/x64/MacroAssembler-x64.h
+++ b/js/src/jit/x64/MacroAssembler-x64.h
@@ -914,26 +914,16 @@ class MacroAssemblerX64 : public MacroAs
     void loadConstantSimd128Float(const SimdConstant& v, FloatRegister dest);
 
     void convertInt64ToDouble(Register64 input, FloatRegister output);
     void convertInt64ToFloat32(Register64 input, FloatRegister output);
     static bool convertUInt64ToDoubleNeedsTemp();
     void convertUInt64ToDouble(Register64 input, FloatRegister output, Register temp);
     void convertUInt64ToFloat32(Register64 input, FloatRegister output, Register temp);
 
-    void wasmTruncateDoubleToInt64(FloatRegister input, Register64 output, Label* oolEntry,
-                                   Label* oolRejoin, FloatRegister tempDouble);
-    void wasmTruncateDoubleToUInt64(FloatRegister input, Register64 output, Label* oolEntry,
-                                    Label* oolRejoin, FloatRegister tempDouble);
-
-    void wasmTruncateFloat32ToInt64(FloatRegister input, Register64 output, Label* oolEntry,
-                                    Label* oolRejoin, FloatRegister tempDouble);
-    void wasmTruncateFloat32ToUInt64(FloatRegister input, Register64 output, Label* oolEntry,
-                                     Label* oolRejoin, FloatRegister tempDouble);
-
     void loadWasmGlobalPtr(uint32_t globalDataOffset, Register dest) {
         loadPtr(Address(WasmTlsReg, offsetof(wasm::TlsData, globalArea) + globalDataOffset), dest);
     }
     void loadWasmPinnedRegsFromTls() {
         loadPtr(Address(WasmTlsReg, offsetof(wasm::TlsData, memoryBase)), HeapReg);
     }
 
   public:
--- a/js/src/jit/x86/MacroAssembler-x86.cpp
+++ b/js/src/jit/x86/MacroAssembler-x86.cpp
@@ -1073,16 +1073,137 @@ MacroAssembler::wasmTruncateFloat32ToUIn
     vcvttss2si(ScratchFloat32Reg, output);
 
     branch32(Assembler::Condition::Signed, output, Imm32(0), oolEntry);
     or32(Imm32(0x80000000), output);
 
     bind(&done);
 }
 
+void
+MacroAssembler::wasmTruncateDoubleToInt64(FloatRegister input, Register64 output, Label* oolEntry,
+                                          Label* oolRejoin, FloatRegister tempReg)
+{
+    Label fail, convert;
+    Register temp = output.high;
+
+    // Make sure input fits in (u)int64.
+    reserveStack(2 * sizeof(int32_t));
+    storeDouble(input, Operand(esp, 0));
+    branchDoubleNotInInt64Range(Address(esp, 0), temp, &fail);
+    jump(&convert);
+
+    // Handle failure in ool.
+    bind(&fail);
+    freeStack(2 * sizeof(int32_t));
+    jump(oolEntry);
+    bind(oolRejoin);
+    reserveStack(2 * sizeof(int32_t));
+    storeDouble(input, Operand(esp, 0));
+
+    // Convert the double/float to int64.
+    bind(&convert);
+    truncateDoubleToInt64(Address(esp, 0), Address(esp, 0), temp);
+
+    // Load value into int64 register.
+    load64(Address(esp, 0), output);
+    freeStack(2 * sizeof(int32_t));
+}
+
+void
+MacroAssembler::wasmTruncateFloat32ToInt64(FloatRegister input, Register64 output, Label* oolEntry,
+                                           Label* oolRejoin, FloatRegister tempReg)
+{
+    Label fail, convert;
+    Register temp = output.high;
+
+    // Make sure input fits in (u)int64.
+    reserveStack(2 * sizeof(int32_t));
+    storeFloat32(input, Operand(esp, 0));
+    branchFloat32NotInInt64Range(Address(esp, 0), temp, &fail);
+    jump(&convert);
+
+    // Handle failure in ool.
+    bind(&fail);
+    freeStack(2 * sizeof(int32_t));
+    jump(oolEntry);
+    bind(oolRejoin);
+    reserveStack(2 * sizeof(int32_t));
+    storeFloat32(input, Operand(esp, 0));
+
+    // Convert the double/float to int64.
+    bind(&convert);
+    truncateFloat32ToInt64(Address(esp, 0), Address(esp, 0), temp);
+
+    // Load value into int64 register.
+    load64(Address(esp, 0), output);
+    freeStack(2 * sizeof(int32_t));
+}
+
+void
+MacroAssembler::wasmTruncateDoubleToUInt64(FloatRegister input, Register64 output, Label* oolEntry,
+                                           Label* oolRejoin, FloatRegister tempReg)
+{
+    Label fail, convert;
+    Register temp = output.high;
+
+    // Make sure input fits in (u)int64.
+    reserveStack(2 * sizeof(int32_t));
+    storeDouble(input, Operand(esp, 0));
+    branchDoubleNotInUInt64Range(Address(esp, 0), temp, &fail);
+    jump(&convert);
+
+    // Handle failure in ool.
+    bind(&fail);
+    freeStack(2 * sizeof(int32_t));
+    jump(oolEntry);
+    bind(oolRejoin);
+    reserveStack(2 * sizeof(int32_t));
+    storeDouble(input, Operand(esp, 0));
+
+    // Convert the double/float to int64.
+    bind(&convert);
+    truncateDoubleToUInt64(Address(esp, 0), Address(esp, 0), temp, tempReg);
+
+    // Load value into int64 register.
+    load64(Address(esp, 0), output);
+    freeStack(2 * sizeof(int32_t));
+}
+
+void
+MacroAssembler::wasmTruncateFloat32ToUInt64(FloatRegister input, Register64 output, Label* oolEntry,
+                                            Label* oolRejoin, FloatRegister tempReg)
+{
+    Label fail, convert;
+    Register temp = output.high;
+
+    // Make sure input fits in (u)int64.
+    reserveStack(2 * sizeof(int32_t));
+    storeFloat32(input, Operand(esp, 0));
+    branchFloat32NotInUInt64Range(Address(esp, 0), temp, &fail);
+    jump(&convert);
+
+    // Handle failure in ool.
+    bind(&fail);
+    freeStack(2 * sizeof(int32_t));
+    jump(oolEntry);
+    bind(oolRejoin);
+    reserveStack(2 * sizeof(int32_t));
+    storeFloat32(input, Operand(esp, 0));
+
+    // Convert the double/float to int64.
+    bind(&convert);
+    truncateFloat32ToUInt64(Address(esp, 0), Address(esp, 0), temp, tempReg);
+
+    // Load value into int64 register.
+    load64(Address(esp, 0), output);
+    freeStack(2 * sizeof(int32_t));
+}
+
+
 //}}} check_macroassembler_style
 
 void
 MacroAssemblerX86::convertInt64ToDouble(Register64 input, FloatRegister output)
 {
     // Zero the output register to break dependencies, see convertInt32ToDouble.
     zeroDouble(output);
 
@@ -1142,128 +1263,8 @@ MacroAssemblerX86::convertUInt64ToFloat3
     vmovss(Address(esp, 0), output);
     asMasm().freeStack(2 * sizeof(intptr_t));
 
     // Restore FPU precision to the initial value.
     fldcw(Operand(esp, 0));
     asMasm().freeStack(2 * sizeof(intptr_t));
 }
 
-void
-MacroAssemblerX86::wasmTruncateDoubleToInt64(FloatRegister input, Register64 output, Label* oolEntry,
-                                             Label* oolRejoin, FloatRegister tempReg)
-{
-    Label fail, convert;
-    Register temp = output.high;
-
-    // Make sure input fits in (u)int64.
-    asMasm().reserveStack(2 * sizeof(int32_t));
-    asMasm().storeDouble(input, Operand(esp, 0));
-    asMasm().branchDoubleNotInInt64Range(Address(esp, 0), temp, &fail);
-    jump(&convert);
-
-    // Handle failure in ool.
-    bind(&fail);
-    asMasm().freeStack(2 * sizeof(int32_t));
-    jump(oolEntry);
-    bind(oolRejoin);
-    asMasm().reserveStack(2 * sizeof(int32_t));
-    asMasm().storeDouble(input, Operand(esp, 0));
-
-    // Convert the double/float to int64.
-    bind(&convert);
-    asMasm().truncateDoubleToInt64(Address(esp, 0), Address(esp, 0), temp);
-
-    // Load value into int64 register.
-    load64(Address(esp, 0), output);
-    asMasm().freeStack(2 * sizeof(int32_t));
-}
-
-void
-MacroAssemblerX86::wasmTruncateFloat32ToInt64(FloatRegister input, Register64 output, Label* oolEntry,
-                                              Label* oolRejoin, FloatRegister tempReg)
-{
-    Label fail, convert;
-    Register temp = output.high;
-
-    // Make sure input fits in (u)int64.
-    asMasm().reserveStack(2 * sizeof(int32_t));
-    asMasm().storeFloat32(input, Operand(esp, 0));
-    asMasm().branchFloat32NotInInt64Range(Address(esp, 0), temp, &fail);
-    jump(&convert);
-
-    // Handle failure in ool.
-    bind(&fail);
-    asMasm().freeStack(2 * sizeof(int32_t));
-    jump(oolEntry);
-    bind(oolRejoin);
-    asMasm().reserveStack(2 * sizeof(int32_t));
-    asMasm().storeFloat32(input, Operand(esp, 0));
-
-    // Convert the double/float to int64.
-    bind(&convert);
-    asMasm().truncateFloat32ToInt64(Address(esp, 0), Address(esp, 0), temp);
-
-    // Load value into int64 register.
-    load64(Address(esp, 0), output);
-    asMasm().freeStack(2 * sizeof(int32_t));
-}
-
-void
-MacroAssemblerX86::wasmTruncateDoubleToUInt64(FloatRegister input, Register64 output, Label* oolEntry,
-                                              Label* oolRejoin, FloatRegister tempReg)
-{
-    Label fail, convert;
-    Register temp = output.high;
-
-    // Make sure input fits in (u)int64.
-    asMasm().reserveStack(2 * sizeof(int32_t));
-    asMasm().storeDouble(input, Operand(esp, 0));
-    asMasm().branchDoubleNotInUInt64Range(Address(esp, 0), temp, &fail);
-    jump(&convert);
-
-    // Handle failure in ool.
-    bind(&fail);
-    asMasm().freeStack(2 * sizeof(int32_t));
-    jump(oolEntry);
-    bind(oolRejoin);
-    asMasm().reserveStack(2 * sizeof(int32_t));
-    asMasm().storeDouble(input, Operand(esp, 0));
-
-    // Convert the double/float to int64.
-    bind(&convert);
-    asMasm().truncateDoubleToUInt64(Address(esp, 0), Address(esp, 0), temp, tempReg);
-
-    // Load value into int64 register.
-    load64(Address(esp, 0), output);
-    asMasm().freeStack(2 * sizeof(int32_t));
-}
-
-void
-MacroAssemblerX86::wasmTruncateFloat32ToUInt64(FloatRegister input, Register64 output, Label* oolEntry,
-                                               Label* oolRejoin, FloatRegister tempReg)
-{
-    Label fail, convert;
-    Register temp = output.high;
-
-    // Make sure input fits in (u)int64.
-    asMasm().reserveStack(2 * sizeof(int32_t));
-    asMasm().storeFloat32(input, Operand(esp, 0));
-    asMasm().branchFloat32NotInUInt64Range(Address(esp, 0), temp, &fail);
-    jump(&convert);
-
-    // Handle failure in ool.
-    bind(&fail);
-    asMasm().freeStack(2 * sizeof(int32_t));
-    jump(oolEntry);
-    bind(oolRejoin);
-    asMasm().reserveStack(2 * sizeof(int32_t));
-    asMasm().storeFloat32(input, Operand(esp, 0));
-
-    // Convert the double/float to int64.
-    bind(&convert);
-    asMasm().truncateFloat32ToUInt64(Address(esp, 0), Address(esp, 0), temp, tempReg);
-
-    // Load value into int64 register.
-    load64(Address(esp, 0), output);
-    asMasm().freeStack(2 * sizeof(int32_t));
-}
-
--- a/js/src/jit/x86/MacroAssembler-x86.h
+++ b/js/src/jit/x86/MacroAssembler-x86.h
@@ -857,25 +857,16 @@ class MacroAssemblerX86 : public MacroAs
     inline void convertUInt32ToFloat32(Register src, FloatRegister dest);
 
     void convertUInt64ToFloat32(Register64 src, FloatRegister dest, Register temp);
     void convertInt64ToFloat32(Register64 src, FloatRegister dest);
     static bool convertUInt64ToDoubleNeedsTemp();
     void convertUInt64ToDouble(Register64 src, FloatRegister dest, Register temp);
     void convertInt64ToDouble(Register64 src, FloatRegister dest);
 
-    void wasmTruncateDoubleToInt64(FloatRegister input, Register64 output, Label* oolEntry,
-                                   Label* oolRejoin, FloatRegister tempDouble);
-    void wasmTruncateDoubleToUInt64(FloatRegister input, Register64 output, Label* oolEntry,
-                                    Label* oolRejoin, FloatRegister tempDouble);
-    void wasmTruncateFloat32ToInt64(FloatRegister input, Register64 output, Label* oolEntry,
-                                    Label* oolRejoin, FloatRegister tempDouble);
-    void wasmTruncateFloat32ToUInt64(FloatRegister input, Register64 output, Label* oolEntry,
-                                     Label* oolRejoin, FloatRegister tempDouble);
-
     void incrementInt32Value(const Address& addr) {
         addl(Imm32(1), payloadOf(addr));
     }
 
     inline void ensureDouble(const ValueOperand& source, FloatRegister dest, Label* failure);
 
     void loadWasmGlobalPtr(uint32_t globalDataOffset, Register dest) {
         loadPtr(Address(WasmTlsReg, offsetof(wasm::TlsData, globalArea) + globalDataOffset), dest);