Bug 1229057 - Part 19: Move MacroAssembler::negateDouble into generic macro assembler. r=bbouvier
authorTooru Fujisawa <arai_a@mac.com>
Tue, 01 Dec 2015 17:04:39 +0900
changeset 316160 edc36eaff15ff316dbc6cbcea906aca974f987d9
parent 316159 7677e7466c249741d51560347285ad13fcd60945
child 316161 5ac90824efedaa33efdce5acc42d61fa0bdb7dc8
push id8516
push userjlund@mozilla.com
push dateFri, 18 Dec 2015 00:52:34 +0000
reviewersbbouvier
bugs1229057
milestone46.0a1
Bug 1229057 - Part 19: Move MacroAssembler::negateDouble into generic macro assembler. r=bbouvier
js/src/jit/MacroAssembler.h
js/src/jit/arm/MacroAssembler-arm-inl.h
js/src/jit/arm/MacroAssembler-arm.cpp
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.cpp
js/src/jit/mips32/MacroAssembler-mips32.h
js/src/jit/mips64/MacroAssembler-mips64.cpp
js/src/jit/mips64/MacroAssembler-mips64.h
js/src/jit/none/MacroAssembler-none.h
js/src/jit/x86-shared/MacroAssembler-x86-shared-inl.h
js/src/jit/x86-shared/MacroAssembler-x86-shared.h
--- a/js/src/jit/MacroAssembler.h
+++ b/js/src/jit/MacroAssembler.h
@@ -778,16 +778,18 @@ class MacroAssembler : public MacroAssem
     inline void divDouble(FloatRegister src, FloatRegister dest) PER_SHARED_ARCH;
 
     inline void inc64(AbsoluteAddress dest) PER_ARCH;
 
     inline void neg32(Register reg) PER_SHARED_ARCH;
 
     inline void negateFloat(FloatRegister reg) DEFINED_ON(arm64, x86_shared);
 
+    inline void negateDouble(FloatRegister reg) PER_SHARED_ARCH;
+
     // ===============================================================
     // 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
@@ -342,16 +342,22 @@ MacroAssembler::inc64(AbsoluteAddress de
 }
 
 void
 MacroAssembler::neg32(Register reg)
 {
     ma_neg(reg, reg, SetCC);
 }
 
+void
+MacroAssembler::negateDouble(FloatRegister reg)
+{
+    ma_vneg(reg, reg);
+}
+
 // ===============================================================
 // Shift functions
 
 void
 MacroAssembler::lshiftPtr(Imm32 imm, Register dest)
 {
     ma_lsl(imm, dest, dest);
 }
--- a/js/src/jit/arm/MacroAssembler-arm.cpp
+++ b/js/src/jit/arm/MacroAssembler-arm.cpp
@@ -241,22 +241,16 @@ MacroAssemblerARM::convertInt32ToFloat32
 void
 MacroAssemblerARM::convertInt32ToFloat32(const Address& src, FloatRegister dest)
 {
     ScratchFloat32Scope scratch(asMasm());
     ma_vldr(src, scratch);
     as_vcvt(dest, VFPRegister(scratch).sintOverlay());
 }
 
-void
-MacroAssemblerARM::negateDouble(FloatRegister reg)
-{
-    ma_vneg(reg, reg);
-}
-
 bool
 MacroAssemblerARM::alu_dbl(Register src1, Imm32 imm, Register dest, ALUOp op,
                            SBit s, Condition c)
 {
     if ((s == SetCC && ! condsAreSafe(op)) || !can_dbl(op))
         return false;
 
     ALUOp interop = getDestVariant(op);
--- a/js/src/jit/arm/MacroAssembler-arm.h
+++ b/js/src/jit/arm/MacroAssembler-arm.h
@@ -92,18 +92,16 @@ class MacroAssemblerARM : public Assembl
     void convertFloat32ToInt32(FloatRegister src, Register dest, Label* fail,
                                bool negativeZeroCheck = true);
 
     void convertFloat32ToDouble(FloatRegister src, FloatRegister dest);
     void branchTruncateFloat32(FloatRegister src, Register dest, Label* fail);
     void convertInt32ToFloat32(Register src, FloatRegister dest);
     void convertInt32ToFloat32(const Address& src, FloatRegister dest);
 
-    void negateDouble(FloatRegister reg);
-
     // Somewhat direct wrappers for the low-level assembler funcitons
     // bitops. Attempt to encode a virtual alu instruction using two real
     // instructions.
   private:
     bool alu_dbl(Register src1, Imm32 imm, Register dest, ALUOp op,
                  SBit s, Condition c);
 
   public:
--- a/js/src/jit/arm64/MacroAssembler-arm64-inl.h
+++ b/js/src/jit/arm64/MacroAssembler-arm64-inl.h
@@ -385,16 +385,22 @@ MacroAssembler::neg32(Register reg)
 }
 
 void
 MacroAssembler::negateFloat(FloatRegister reg)
 {
     fneg(ARMFPRegister(reg, 32), ARMFPRegister(reg, 32));
 }
 
+void
+MacroAssembler::negateDouble(FloatRegister reg)
+{
+    fneg(ARMFPRegister(reg, 64), ARMFPRegister(reg, 64));
+}
+
 // ===============================================================
 // 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
@@ -1221,19 +1221,16 @@ class MacroAssemblerCompat : public vixl
         fmov(ARMFPRegister(dest, 64), ARMFPRegister(src, 64));
     }
     void zeroDouble(FloatRegister reg) {
         fmov(ARMFPRegister(reg, 64), vixl::xzr);
     }
     void zeroFloat32(FloatRegister reg) {
         fmov(ARMFPRegister(reg, 32), vixl::wzr);
     }
-    void negateDouble(FloatRegister reg) {
-        fneg(ARMFPRegister(reg, 64), ARMFPRegister(reg, 64));
-    }
 
     void moveFloat32(FloatRegister src, FloatRegister dest) {
         fmov(ARMFPRegister(dest, 32), ARMFPRegister(src, 32));
     }
     void moveFloatAsDouble(Register src, FloatRegister dest) {
         MOZ_CRASH("moveFloatAsDouble");
     }
 
--- a/js/src/jit/mips-shared/MacroAssembler-mips-shared-inl.h
+++ b/js/src/jit/mips-shared/MacroAssembler-mips-shared-inl.h
@@ -180,15 +180,21 @@ MacroAssembler::divDouble(FloatRegister 
 }
 
 void
 MacroAssembler::neg32(Register reg)
 {
     ma_negu(reg, reg);
 }
 
+void
+MacroAssembler::negateDouble(FloatRegister reg)
+{
+    as_negd(reg, reg);
+}
+
 //}}} check_macroassembler_style
 // ===============================================================
 
 } // namespace jit
 } // namespace js
 
 #endif /* jit_mips_shared_MacroAssembler_mips_shared_inl_h */
--- a/js/src/jit/mips32/MacroAssembler-mips32.cpp
+++ b/js/src/jit/mips32/MacroAssembler-mips32.cpp
@@ -214,22 +214,16 @@ MacroAssemblerMIPSCompat::convertInt32To
 void
 MacroAssemblerMIPSCompat::convertInt32ToFloat32(const Address& src, FloatRegister dest)
 {
     ma_ls(dest, src);
     as_cvtsw(dest, dest);
 }
 
 void
-MacroAssemblerMIPSCompat::negateDouble(FloatRegister reg)
-{
-    as_negd(reg, reg);
-}
-
-void
 MacroAssemblerMIPS::ma_li(Register dest, CodeOffset* label)
 {
     BufferOffset bo = m_buffer.nextOffset();
     ma_liPatchable(dest, ImmWord(/* placeholder */ 0));
     label->bind(bo.getOffset());
 }
 
 void
--- a/js/src/jit/mips32/MacroAssembler-mips32.h
+++ b/js/src/jit/mips32/MacroAssembler-mips32.h
@@ -170,18 +170,16 @@ class MacroAssemblerMIPSCompat : public 
     void convertFloat32ToInt32(FloatRegister src, Register dest, Label* fail,
                                bool negativeZeroCheck = true);
 
     void convertFloat32ToDouble(FloatRegister src, FloatRegister dest);
     void branchTruncateFloat32(FloatRegister src, Register dest, Label* fail);
     void convertInt32ToFloat32(Register src, FloatRegister dest);
     void convertInt32ToFloat32(const Address& src, FloatRegister dest);
 
-    void negateDouble(FloatRegister reg);
-
     void computeScaledAddress(const BaseIndex& address, Register dest);
 
     void computeEffectiveAddress(const Address& address, Register dest) {
         ma_addu(dest, address.base, Imm32(address.offset));
     }
 
     inline void computeEffectiveAddress(const BaseIndex& address, Register dest);
 
--- a/js/src/jit/mips64/MacroAssembler-mips64.cpp
+++ b/js/src/jit/mips64/MacroAssembler-mips64.cpp
@@ -223,22 +223,16 @@ MacroAssemblerMIPS64Compat::convertInt32
 void
 MacroAssemblerMIPS64Compat::convertInt32ToFloat32(const Address& src, FloatRegister dest)
 {
     ma_ls(dest, src);
     as_cvtsw(dest, dest);
 }
 
 void
-MacroAssemblerMIPS64Compat::negateDouble(FloatRegister reg)
-{
-    as_negd(reg, reg);
-}
-
-void
 MacroAssemblerMIPS64Compat::movq(Register rs, Register rd)
 {
     ma_move(rd, rs);
 }
 
 void
 MacroAssemblerMIPS64::ma_li(Register dest, CodeOffset* label)
 {
--- a/js/src/jit/mips64/MacroAssembler-mips64.h
+++ b/js/src/jit/mips64/MacroAssembler-mips64.h
@@ -180,18 +180,16 @@ class MacroAssemblerMIPS64Compat : publi
     void convertFloat32ToInt32(FloatRegister src, Register dest, Label* fail,
                                bool negativeZeroCheck = true);
 
     void convertFloat32ToDouble(FloatRegister src, FloatRegister dest);
     void branchTruncateFloat32(FloatRegister src, Register dest, Label* fail);
     void convertInt32ToFloat32(Register src, FloatRegister dest);
     void convertInt32ToFloat32(const Address& src, FloatRegister dest);
 
-    void negateDouble(FloatRegister reg);
-
     void movq(Register rs, Register rd);
 
     void computeScaledAddress(const BaseIndex& address, Register dest);
 
     void computeEffectiveAddress(const Address& address, Register dest) {
         ma_daddu(dest, address.base, Imm32(address.offset));
     }
 
--- a/js/src/jit/none/MacroAssembler-none.h
+++ b/js/src/jit/none/MacroAssembler-none.h
@@ -229,18 +229,16 @@ class MacroAssemblerNone : public Assemb
     template <typename T, typename S> void branchTestValue(Condition, T, S, Label*) { MOZ_CRASH(); }
     void testNullSet(Condition, ValueOperand, Register) { MOZ_CRASH(); }
     void testObjectSet(Condition, ValueOperand, Register) { MOZ_CRASH(); }
     void testUndefinedSet(Condition, ValueOperand, Register) { MOZ_CRASH(); }
 
     template <typename T, typename S> void cmpPtrSet(Condition, T, S, Register) { MOZ_CRASH(); }
     template <typename T, typename S> void cmp32Set(Condition, T, S, Register) { MOZ_CRASH(); }
 
-    void negateDouble(FloatRegister) { MOZ_CRASH(); }
-
     template <typename T, typename S> void branch32(Condition, T, S, Label*) { MOZ_CRASH(); }
     template <typename T, typename S> void branchTest32(Condition, T, S, Label*) { MOZ_CRASH(); }
     template <typename T, typename S> void branchAdd32(Condition, T, S, Label*) { MOZ_CRASH(); }
     template <typename T, typename S> void branchSub32(Condition, T, S, Label*) { MOZ_CRASH(); }
     template <typename T, typename S> void branchPtr(Condition, T, S, Label*) { MOZ_CRASH(); }
     template <typename T, typename S> void branchTestPtr(Condition, T, S, Label*) { MOZ_CRASH(); }
     template <typename T, typename S> void branchDouble(DoubleCondition, T, S, Label*) { MOZ_CRASH(); }
     template <typename T, typename S> void branchFloat(DoubleCondition, T, S, Label*) { MOZ_CRASH(); }
--- a/js/src/jit/x86-shared/MacroAssembler-x86-shared-inl.h
+++ b/js/src/jit/x86-shared/MacroAssembler-x86-shared-inl.h
@@ -163,15 +163,27 @@ MacroAssembler::negateFloat(FloatRegiste
     ScratchFloat32Scope scratch(*this);
     vpcmpeqw(scratch, scratch, scratch);
     vpsllq(Imm32(31), scratch, scratch);
 
     // XOR the float in a float register with -0.0.
     vxorps(scratch, reg, reg); // s ^ 0x80000000
 }
 
+void
+MacroAssembler::negateDouble(FloatRegister reg)
+{
+    // From MacroAssemblerX86Shared::maybeInlineDouble
+    ScratchDoubleScope scratch(*this);
+    vpcmpeqw(scratch, scratch, scratch);
+    vpsllq(Imm32(63), scratch, scratch);
+
+    // XOR the float in a float register with -0.0.
+    vxorpd(scratch, reg, reg); // s ^ 0x80000000000000
+}
+
 //}}} check_macroassembler_style
 // ===============================================================
 
 } // namespace jit
 } // namespace js
 
 #endif /* jit_x86_shared_MacroAssembler_x86_shared_inl_h */
--- a/js/src/jit/x86-shared/MacroAssembler-x86-shared.h
+++ b/js/src/jit/x86-shared/MacroAssembler-x86-shared.h
@@ -897,25 +897,16 @@ class MacroAssemblerX86Shared : public A
         vmovapd(src, dest);
     }
     void zeroDouble(FloatRegister reg) {
         vxorpd(reg, reg, reg);
     }
     void zeroFloat32(FloatRegister reg) {
         vxorps(reg, reg, reg);
     }
-    void negateDouble(FloatRegister reg) {
-        // From MacroAssemblerX86Shared::maybeInlineDouble
-        ScratchDoubleScope scratch(asMasm());
-        vpcmpeqw(scratch, scratch, scratch);
-        vpsllq(Imm32(63), scratch, scratch);
-
-        // XOR the float in a float register with -0.0.
-        vxorpd(scratch, reg, reg); // s ^ 0x80000000000000
-    }
     void convertFloat32ToDouble(FloatRegister src, FloatRegister dest) {
         vcvtss2sd(src, dest, dest);
     }
     void convertDoubleToFloat32(FloatRegister src, FloatRegister dest) {
         vcvtsd2ss(src, dest, dest);
     }
 
     void convertFloat32x4ToInt32x4(FloatRegister src, FloatRegister dest) {