Bug 1229057 - Part 13: Move MacroAssembler::mulDoublePtr into generic macro assembler. r=djvj
authorTooru Fujisawa <arai_a@mac.com>
Tue, 01 Dec 2015 17:03:49 +0900
changeset 316154 c2635431b09592d64b709451db402ad053d3878b
parent 316153 0066457f638ecfb6f2a1b96e91d6d99487dcd7ce
child 316155 8c4f8ebb128fc15971f044b4f643cc85ab7172c0
push id8516
push userjlund@mozilla.com
push dateFri, 18 Dec 2015 00:52:34 +0000
reviewersdjvj
bugs1229057
milestone46.0a1
Bug 1229057 - Part 13: Move MacroAssembler::mulDoublePtr into generic macro assembler. r=djvj
js/src/jit/MacroAssembler.h
js/src/jit/arm/MacroAssembler-arm-inl.h
js/src/jit/arm/MacroAssembler-arm.h
js/src/jit/arm64/MacroAssembler-arm64-inl.h
js/src/jit/arm64/MacroAssembler-arm64.h
js/src/jit/mips-shared/MacroAssembler-mips-shared-inl.h
js/src/jit/mips32/MacroAssembler-mips32.h
js/src/jit/mips64/MacroAssembler-mips64.h
js/src/jit/none/MacroAssembler-none.h
js/src/jit/x64/MacroAssembler-x64-inl.h
js/src/jit/x64/MacroAssembler-x64.h
js/src/jit/x86/MacroAssembler-x86-inl.h
js/src/jit/x86/MacroAssembler-x86.h
--- a/js/src/jit/MacroAssembler.h
+++ b/js/src/jit/MacroAssembler.h
@@ -766,16 +766,18 @@ class MacroAssembler : public MacroAssem
     inline void subDouble(FloatRegister src, FloatRegister dest) PER_SHARED_ARCH;
 
     inline void mul32(Register src1, Register src2, Register dest, Label* onOver, Label* onZero) DEFINED_ON(arm64);
 
     inline void mul64(Imm64 imm, const Register64& dest) PER_ARCH;
 
     inline void mulBy3(Register src, Register dest) PER_ARCH;
 
+    inline void mulDoublePtr(ImmPtr imm, Register temp, FloatRegister dest) DEFINED_ON(mips_shared, arm, arm64, x86, x64);
+
     // ===============================================================
     // Shift functions
 
     inline void lshiftPtr(Imm32 imm, Register dest) PER_ARCH;
 
     inline void lshift64(Imm32 imm, Register64 dest) PER_ARCH;
 
     inline void rshiftPtr(Imm32 imm, Register dest) PER_ARCH;
--- a/js/src/jit/arm/MacroAssembler-arm-inl.h
+++ b/js/src/jit/arm/MacroAssembler-arm-inl.h
@@ -299,16 +299,24 @@ MacroAssembler::mul64(Imm64 imm, const R
 }
 
 void
 MacroAssembler::mulBy3(Register src, Register dest)
 {
     as_add(dest, src, lsl(src, 1));
 }
 
+void
+MacroAssembler::mulDoublePtr(ImmPtr imm, Register temp, FloatRegister dest)
+{
+    movePtr(imm, ScratchRegister);
+    loadDouble(Address(ScratchRegister, 0), ScratchDoubleReg);
+    mulDouble(ScratchDoubleReg, dest);
+}
+
 // ===============================================================
 // Shift functions
 
 void
 MacroAssembler::lshiftPtr(Imm32 imm, Register dest)
 {
     ma_lsl(imm, dest, dest);
 }
--- a/js/src/jit/arm/MacroAssembler-arm.h
+++ b/js/src/jit/arm/MacroAssembler-arm.h
@@ -1627,21 +1627,16 @@ class MacroAssemblerARMCompat : public M
     void cmpPtr(Register lhs, Imm32 rhs);
     void cmpPtr(const Address& lhs, Register rhs);
     void cmpPtr(const Address& lhs, ImmWord rhs);
     void cmpPtr(const Address& lhs, ImmPtr rhs);
     void cmpPtr(const Address& lhs, ImmGCPtr rhs);
     void cmpPtr(const Address& lhs, Imm32 rhs);
 
     void convertUInt64ToDouble(Register64 src, Register temp, FloatRegister dest);
-    void mulDoublePtr(ImmPtr imm, Register temp, FloatRegister dest) {
-        movePtr(imm, ScratchRegister);
-        loadDouble(Address(ScratchRegister, 0), ScratchDoubleReg);
-        mulDouble(ScratchDoubleReg, dest);
-    }
 
     void setStackArg(Register reg, uint32_t arg);
 
     void breakpoint();
     // Conditional breakpoint.
     void breakpoint(Condition cc);
 
     // Trigger the simulator's interactive read-eval-print loop.
--- a/js/src/jit/arm64/MacroAssembler-arm64-inl.h
+++ b/js/src/jit/arm64/MacroAssembler-arm64-inl.h
@@ -336,16 +336,28 @@ MacroAssembler::mul64(Imm64 imm, const R
 void
 MacroAssembler::mulBy3(Register src, Register dest)
 {
     ARMRegister xdest(dest, 64);
     ARMRegister xsrc(src, 64);
     Add(xdest, xsrc, Operand(xsrc, vixl::LSL, 1));
 }
 
+void
+MacroAssembler::mulDoublePtr(ImmPtr imm, Register temp, FloatRegister dest)
+{
+    vixl::UseScratchRegisterScope temps(this);
+    const Register scratch = temps.AcquireX().asUnsized();
+    MOZ_ASSERT(temp != scratch);
+    movePtr(imm, scratch);
+    const ARMFPRegister scratchDouble = temps.AcquireD();
+    Ldr(scratchDouble, MemOperand(Address(scratch, 0)));
+    fmul(ARMFPRegister(dest, 64), ARMFPRegister(dest, 64), scratchDouble);
+}
+
 // ===============================================================
 // Shift functions
 
 void
 MacroAssembler::lshiftPtr(Imm32 imm, Register dest)
 {
     Lsl(ARMRegister(dest, 64), ARMRegister(dest, 64), imm.value);
 }
--- a/js/src/jit/arm64/MacroAssembler-arm64.h
+++ b/js/src/jit/arm64/MacroAssembler-arm64.h
@@ -2841,25 +2841,16 @@ class MacroAssemblerCompat : public vixl
     void abiret() {
         syncStackPtr(); // SP is always used to transmit the stack between calls.
         vixl::MacroAssembler::Ret(vixl::lr);
     }
 
     void convertUInt64ToDouble(Register64 src, Register temp, FloatRegister dest) {
         Ucvtf(ARMFPRegister(dest, 64), ARMRegister(src.reg, 64));
     }
-    void mulDoublePtr(ImmPtr imm, Register temp, FloatRegister dest) {
-        vixl::UseScratchRegisterScope temps(this);
-        const Register scratch = temps.AcquireX().asUnsized();
-        MOZ_ASSERT(temp != scratch);
-        movePtr(imm, scratch);
-        const ARMFPRegister scratchDouble = temps.AcquireD();
-        Ldr(scratchDouble, MemOperand(Address(scratch, 0)));
-        fmul(ARMFPRegister(dest, 64), ARMFPRegister(dest, 64), scratchDouble);
-    }
 
     template <typename T>
     void branchAdd32(Condition cond, T src, Register dest, Label* label) {
         adds32(src, dest);
         branch(cond, label);
     }
 
     template <typename T>
--- a/js/src/jit/mips-shared/MacroAssembler-mips-shared-inl.h
+++ b/js/src/jit/mips-shared/MacroAssembler-mips-shared-inl.h
@@ -154,15 +154,23 @@ MacroAssembler::subPtr(const Address& ad
 }
 
 void
 MacroAssembler::subDouble(FloatRegister src, FloatRegister dest)
 {
     as_subd(dest, dest, src);
 }
 
+void
+MacroAssembler::mulDoublePtr(ImmPtr imm, Register temp, FloatRegister dest)
+{
+    movePtr(imm, ScratchRegister);
+    loadDouble(Address(ScratchRegister, 0), ScratchDoubleReg);
+    mulDouble(ScratchDoubleReg, dest);
+}
+
 //}}} check_macroassembler_style
 // ===============================================================
 
 } // namespace jit
 } // namespace js
 
 #endif /* jit_mips_shared_MacroAssembler_mips_shared_inl_h */
--- a/js/src/jit/mips32/MacroAssembler-mips32.h
+++ b/js/src/jit/mips32/MacroAssembler-mips32.h
@@ -1220,21 +1220,16 @@ class MacroAssemblerMIPSCompat : public 
     void zeroDouble(FloatRegister reg) {
         moveToDoubleLo(zero, reg);
         moveToDoubleHi(zero, reg);
     }
 
     void clampIntToUint8(Register reg);
 
     void convertUInt64ToDouble(Register64 src, Register temp, FloatRegister dest);
-    void mulDoublePtr(ImmPtr imm, Register temp, FloatRegister dest) {
-        movePtr(imm, ScratchRegister);
-        loadDouble(Address(ScratchRegister, 0), ScratchDoubleReg);
-        mulDouble(ScratchDoubleReg, dest);
-    }
 
     void breakpoint();
 
     void branchDouble(DoubleCondition cond, FloatRegister lhs, FloatRegister rhs,
                       Label* label);
 
     void branchFloat(DoubleCondition cond, FloatRegister lhs, FloatRegister rhs,
                      Label* label);
--- a/js/src/jit/mips64/MacroAssembler-mips64.h
+++ b/js/src/jit/mips64/MacroAssembler-mips64.h
@@ -1233,21 +1233,16 @@ class MacroAssemblerMIPS64Compat : publi
 
     void zeroDouble(FloatRegister reg) {
         moveToDouble(zero, reg);
     }
 
     void clampIntToUint8(Register reg);
 
     void convertUInt64ToDouble(Register64 src, Register temp, FloatRegister dest);
-    void mulDoublePtr(ImmPtr imm, Register temp, FloatRegister dest) {
-        movePtr(imm, ScratchRegister);
-        loadDouble(Address(ScratchRegister, 0), ScratchDoubleReg);
-        mulDouble(ScratchDoubleReg, dest);
-    }
 
     void breakpoint();
 
     void branchDouble(DoubleCondition cond, FloatRegister lhs, FloatRegister rhs,
                       Label* label);
 
     void branchFloat(DoubleCondition cond, FloatRegister lhs, FloatRegister rhs,
                      Label* label);
--- a/js/src/jit/none/MacroAssembler-none.h
+++ b/js/src/jit/none/MacroAssembler-none.h
@@ -389,17 +389,16 @@ class MacroAssemblerNone : public Assemb
     void convertBoolToInt32(Register, Register) { MOZ_CRASH(); }
 
     void convertDoubleToFloat32(FloatRegister, FloatRegister) { MOZ_CRASH(); }
     void convertInt32ToFloat32(Register, FloatRegister) { MOZ_CRASH(); }
 
     template <typename T> void convertInt32ToDouble(T, FloatRegister) { MOZ_CRASH(); }
     void convertFloat32ToDouble(FloatRegister, FloatRegister) { MOZ_CRASH(); }
     void convertUInt64ToDouble(Register64, Register, FloatRegister) { MOZ_CRASH(); }
-    void mulDoublePtr(ImmPtr, Register, FloatRegister) { MOZ_CRASH(); }
 
     void branchTruncateDouble(FloatRegister, Register, Label*) { MOZ_CRASH(); }
     void branchTruncateFloat32(FloatRegister, Register, Label*) { MOZ_CRASH(); }
 
     void boolValueToDouble(ValueOperand, FloatRegister) { MOZ_CRASH(); }
     void boolValueToFloat32(ValueOperand, FloatRegister) { MOZ_CRASH(); }
     void int32ValueToDouble(ValueOperand, FloatRegister) { MOZ_CRASH(); }
     void int32ValueToFloat32(ValueOperand, FloatRegister) { MOZ_CRASH(); }
--- a/js/src/jit/x64/MacroAssembler-x64-inl.h
+++ b/js/src/jit/x64/MacroAssembler-x64-inl.h
@@ -162,16 +162,23 @@ MacroAssembler::mul64(Imm64 imm, const R
 }
 
 void
 MacroAssembler::mulBy3(Register src, Register dest)
 {
     lea(Operand(src, src, TimesTwo), dest);
 }
 
+void
+MacroAssembler::mulDoublePtr(ImmPtr imm, Register temp, FloatRegister dest)
+{
+    movq(imm, ScratchReg);
+    vmulsd(Operand(ScratchReg, 0), dest, dest);
+}
+
 // ===============================================================
 // Shift functions
 
 void
 MacroAssembler::lshiftPtr(Imm32 imm, Register dest)
 {
     shlq(imm, dest);
 }
--- a/js/src/jit/x64/MacroAssembler-x64.h
+++ b/js/src/jit/x64/MacroAssembler-x64.h
@@ -1290,21 +1290,16 @@ class MacroAssemblerX64 : public MacroAs
     void convertUInt32ToFloat32(Register src, FloatRegister dest) {
         vcvtsq2ss(src, dest, dest);
     }
 
     void convertUInt64ToDouble(Register64 src, Register temp, FloatRegister dest) {
         vcvtsi2sdq(src.reg, dest);
     }
 
-    void mulDoublePtr(ImmPtr imm, Register temp, FloatRegister dest) {
-        movq(imm, ScratchReg);
-        vmulsd(Operand(ScratchReg, 0), dest, dest);
-    }
-
     inline void inc64(AbsoluteAddress dest);
 
     inline void incrementInt32Value(const Address& addr);
 
     // If source is a double, load it into dest. If source is int32,
     // convert it to double. Else, branch to failure.
     void ensureDouble(const ValueOperand& source, FloatRegister dest, Label* failure) {
         Label isDouble, done;
--- a/js/src/jit/x86/MacroAssembler-x86-inl.h
+++ b/js/src/jit/x86/MacroAssembler-x86-inl.h
@@ -198,16 +198,23 @@ MacroAssembler::mul64(Imm64 imm, const R
 }
 
 void
 MacroAssembler::mulBy3(Register src, Register dest)
 {
     lea(Operand(src, src, TimesTwo), dest);
 }
 
+void
+MacroAssembler::mulDoublePtr(ImmPtr imm, Register temp, FloatRegister dest)
+{
+    movl(imm, temp);
+    vmulsd(Operand(temp, 0), dest, dest);
+}
+
 // ===============================================================
 // Shift functions
 
 void
 MacroAssembler::lshiftPtr(Imm32 imm, Register dest)
 {
     shll(imm, dest);
 }
--- a/js/src/jit/x86/MacroAssembler-x86.h
+++ b/js/src/jit/x86/MacroAssembler-x86.h
@@ -1025,21 +1025,16 @@ class MacroAssemblerX86 : public MacroAs
     // Note: this function clobbers the source register.
     inline void convertUInt32ToDouble(Register src, FloatRegister dest);
 
     // Note: this function clobbers the source register.
     inline void convertUInt32ToFloat32(Register src, FloatRegister dest);
 
     void convertUInt64ToDouble(Register64 src, Register temp, FloatRegister dest);
 
-    void mulDoublePtr(ImmPtr imm, Register temp, FloatRegister dest) {
-        movl(imm, temp);
-        vmulsd(Operand(temp, 0), dest, dest);
-    }
-
     void inc64(AbsoluteAddress dest) {
         addl(Imm32(1), Operand(dest));
         Label noOverflow;
         j(NonZero, &noOverflow);
         addl(Imm32(1), Operand(dest.offset(4)));
         bind(&noOverflow);
     }