Bug 1199719 part 3 - Move MacroAssembler::andPtr into the generic macro assembler. r=djvj
☠☠ backed out by f11cf71a5cca ☠ ☠
authorNicolas B. Pierron <nicolas.b.pierron@mozilla.com>
Thu, 10 Sep 2015 22:36:12 +0200
changeset 294468 399f2af808f36cc0c163edd099ca2cb1268028cd
parent 294467 a49cedf75457d76a64bf7f4e11b0f80811d6a32b
child 294469 e5ec584b2b69b67441323978746403c45bb53423
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdjvj
bugs1199719
milestone43.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 1199719 part 3 - Move MacroAssembler::andPtr into the generic macro assembler. r=djvj
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/mips32/MacroAssembler-mips32-inl.h
js/src/jit/mips32/MacroAssembler-mips32.cpp
js/src/jit/mips32/MacroAssembler-mips32.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
@@ -670,16 +670,19 @@ class MacroAssembler : public MacroAssem
     // Logical instructions
 
     inline void and32(Register src, Register dest) PER_SHARED_ARCH;
     inline void and32(Imm32 imm, Register dest) PER_SHARED_ARCH;
     inline void and32(Imm32 imm, Register src, Register dest) DEFINED_ON(arm64);
     inline void and32(Imm32 imm, const Address& dest) PER_SHARED_ARCH;
     inline void and32(const Address& src, Register dest) PER_SHARED_ARCH;
 
+    inline void andPtr(Register src, Register dest) PER_ARCH;
+    inline void andPtr(Imm32 imm, Register dest) PER_ARCH;
+
     //}}} check_macroassembler_style
   public:
 
     // Emits a test of a value against all types in a TypeSet. A scratch
     // register is required.
     template <typename Source>
     void guardTypeSet(const Source& address, const TypeSet* types, BarrierKind kind, Register scratch, Label* miss);
 
--- a/js/src/jit/arm/MacroAssembler-arm-inl.h
+++ b/js/src/jit/arm/MacroAssembler-arm-inl.h
@@ -40,16 +40,28 @@ MacroAssembler::and32(Imm32 imm, const A
 void
 MacroAssembler::and32(const Address& src, Register dest)
 {
     ScratchRegisterScope scratch(*this);
     load32(src, scratch);
     ma_and(scratch, dest, SetCC);
 }
 
+void
+MacroAssembler::andPtr(Register src, Register dest)
+{
+    ma_and(src, dest);
+}
+
+void
+MacroAssembler::andPtr(Imm32 imm, Register dest)
+{
+    ma_and(imm, dest);
+}
+
 //}}} check_macroassembler_style
 // ===============================================================
 
 void
 MacroAssemblerARMCompat::and64(Imm64 imm, Register64 dest)
 {
     asMasm().and32(Imm32(imm.value & 0xFFFFFFFFL), dest.low);
     asMasm().and32(Imm32((imm.value >> 32) & 0xFFFFFFFFL), dest.high);
--- a/js/src/jit/arm/MacroAssembler-arm.cpp
+++ b/js/src/jit/arm/MacroAssembler-arm.cpp
@@ -2013,28 +2013,16 @@ MacroAssemblerARMCompat::orPtr(Imm32 imm
 
 void
 MacroAssemblerARMCompat::orPtr(Register src, Register dest)
 {
     ma_orr(src, dest);
 }
 
 void
-MacroAssemblerARMCompat::andPtr(Imm32 imm, Register dest)
-{
-    ma_and(imm, dest);
-}
-
-void
-MacroAssemblerARMCompat::andPtr(Register src, Register dest)
-{
-    ma_and(src, dest);
-}
-
-void
 MacroAssemblerARMCompat::move32(Imm32 imm, Register dest)
 {
     ma_mov(imm, dest);
 }
 
 void
 MacroAssemblerARMCompat::move32(Register src, Register dest) {
     ma_mov(src, dest);
--- a/js/src/jit/arm/MacroAssembler-arm.h
+++ b/js/src/jit/arm/MacroAssembler-arm.h
@@ -1220,18 +1220,16 @@ class MacroAssemblerARMCompat : public M
     void xorPtr(Imm32 imm, Register dest);
     void xorPtr(Register src, Register dest);
     void orPtr(Imm32 imm, Register dest);
     void orPtr(Register src, Register dest);
     void or64(Register64 src, Register64 dest) {
         or32(src.low, dest.low);
         or32(src.high, dest.high);
     }
-    void andPtr(Imm32 imm, Register dest);
-    void andPtr(Register src, Register dest);
     void addPtr(Register src, Register dest);
     void addPtr(const Address& src, Register dest);
     void add64(Imm32 imm, Register64 dest) {
         ma_add(imm, dest.low, SetCC);
         ma_adc(Imm32(0), dest.high, LeaveCC);
     }
     void not32(Register reg);
 
--- a/js/src/jit/arm64/MacroAssembler-arm64-inl.h
+++ b/js/src/jit/arm64/MacroAssembler-arm64-inl.h
@@ -50,15 +50,51 @@ MacroAssembler::and32(const Address& src
 {
     vixl::UseScratchRegisterScope temps(this);
     const ARMRegister scratch32 = temps.AcquireW();
     MOZ_ASSERT(scratch32.asUnsized() != src.base);
     load32(src, scratch32.asUnsized());
     And(ARMRegister(dest, 32), ARMRegister(dest, 32), Operand(scratch32));
 }
 
+void
+MacroAssembler::andPtr(Register src, Register dest)
+{
+    And(ARMRegister(dest, 64), ARMRegister(dest, 64), Operand(ARMRegister(src, 64)));
+}
+
+void
+MacroAssembler::andPtr(Imm32 imm, Register dest)
+{
+    And(ARMRegister(dest, 64), ARMRegister(dest, 64), Operand(imm.value));
+}
+
 //}}} check_macroassembler_style
 // ===============================================================
 
+void
+MacroAssemblerCompat::and64(Imm64 imm, Register64 dest)
+{
+    vixl::UseScratchRegisterScope temps(this);
+    const Register scratch = temps.AcquireX().asUnsized();
+    mov(ImmWord(imm.value), scratch);
+    asMasm().andPtr(scratch, dest.reg);
+}
+
+template <typename T>
+void
+MacroAssemblerCompat::andToStackPtr(T t)
+{
+    asMasm().andPtr(t, getStackPointer());
+    syncStackPtr();
+}
+
+template <typename T>
+void
+MacroAssemblerCompat::andStackPtrTo(T t)
+{
+    asMasm().andPtr(getStackPointer(), t);
+}
+
 } // namespace jit
 } // namespace js
 
 #endif /* jit_arm64_MacroAssembler_arm64_inl_h */
--- a/js/src/jit/arm64/MacroAssembler-arm64.h
+++ b/js/src/jit/arm64/MacroAssembler-arm64.h
@@ -1040,20 +1040,18 @@ class MacroAssemblerCompat : public vixl
     template <typename T>
     void addStackPtrTo(T t) { addPtr(getStackPointer(), t); }
 
     template <typename T>
     void subFromStackPtr(T t) { subPtr(t, getStackPointer()); syncStackPtr(); }
     template <typename T>
     void subStackPtrFrom(T t) { subPtr(getStackPointer(), t); }
 
-    template <typename T>
-    void andToStackPtr(T t) { andPtr(t, getStackPointer()); syncStackPtr(); }
-    template <typename T>
-    void andStackPtrTo(T t) { andPtr(getStackPointer(), t); }
+    template <typename T> void andToStackPtr(T t);
+    template <typename T> void andStackPtrTo(T t);
 
     template <typename T>
     void moveToStackPtr(T t) { movePtr(t, getStackPointer()); syncStackPtr(); }
     template <typename T>
     void moveStackPtrTo(T t) { movePtr(getStackPointer(), t); }
 
     template <typename T>
     void loadStackPtr(T t) { loadPtr(t, getStackPointer()); syncStackPtr(); }
@@ -1124,28 +1122,17 @@ class MacroAssemblerCompat : public vixl
         MOZ_ASSERT(scratch32.asUnsized() != dest.base);
         load32(dest, scratch32.asUnsized());
         Orr(scratch32, scratch32, Operand(imm.value));
         store32(scratch32.asUnsized(), dest);
     }
     void or64(Register64 src, Register64 dest) {
         orPtr(src.reg, dest.reg);
     }
-    void andPtr(Imm32 imm, Register dest) {
-        And(ARMRegister(dest, 64), ARMRegister(dest, 64), Operand(imm.value));
-    }
-    void andPtr(Register src, Register dest) {
-        And(ARMRegister(dest, 64), ARMRegister(dest, 64), Operand(ARMRegister(src, 64)));
-    }
-    void and64(Imm64 imm, Register64 dest) {
-        vixl::UseScratchRegisterScope temps(this);
-        const Register scratch = temps.AcquireX().asUnsized();
-        mov(ImmWord(imm.value), scratch);
-        andPtr(scratch, dest.reg);
-    }
+    inline void and64(Imm64 imm, Register64 dest);
 
     void testPtr(Register lhs, Register rhs) {
         Tst(ARMRegister(lhs, 64), Operand(ARMRegister(rhs, 64)));
     }
     void test32(Register lhs, Register rhs) {
         Tst(ARMRegister(lhs, 32), Operand(ARMRegister(rhs, 32)));
     }
     void test32(const Address& addr, Imm32 imm) {
--- a/js/src/jit/mips32/MacroAssembler-mips32-inl.h
+++ b/js/src/jit/mips32/MacroAssembler-mips32-inl.h
@@ -38,16 +38,28 @@ MacroAssembler::and32(Imm32 imm, const A
 
 void
 MacroAssembler::and32(const Address& src, Register dest)
 {
     load32(src, SecondScratchReg);
     ma_and(dest, SecondScratchReg);
 }
 
+void
+MacroAssembler::andPtr(Register src, Register dest)
+{
+    ma_and(dest, src);
+}
+
+void
+MacroAssembler::andPtr(Imm32 imm, Register dest)
+{
+    ma_and(dest, imm);
+}
+
 //}}} check_macroassembler_style
 // ===============================================================
 
 void
 MacroAssemblerMIPSCompat::and64(Imm64 imm, Register64 dest)
 {
     asMasm().and32(Imm32(imm.value & LOW_32_MASK), dest.low);
     asMasm().and32(Imm32((imm.value >> 32) & LOW_32_MASK), dest.high);
--- a/js/src/jit/mips32/MacroAssembler-mips32.cpp
+++ b/js/src/jit/mips32/MacroAssembler-mips32.cpp
@@ -1677,28 +1677,16 @@ MacroAssemblerMIPSCompat::orPtr(Imm32 im
 
 void
 MacroAssemblerMIPSCompat::orPtr(Register src, Register dest)
 {
     ma_or(dest, src);
 }
 
 void
-MacroAssemblerMIPSCompat::andPtr(Imm32 imm, Register dest)
-{
-    ma_and(dest, imm);
-}
-
-void
-MacroAssemblerMIPSCompat::andPtr(Register src, Register dest)
-{
-    ma_and(dest, src);
-}
-
-void
 MacroAssemblerMIPSCompat::move32(Imm32 imm, Register dest)
 {
     ma_li(dest, imm);
 }
 
 void
 MacroAssemblerMIPSCompat::move32(Register src, Register dest)
 {
@@ -3105,17 +3093,17 @@ MacroAssemblerMIPSCompat::checkStackAlig
 #endif
 }
 
 void
 MacroAssemblerMIPSCompat::alignStackPointer()
 {
     movePtr(StackPointer, SecondScratchReg);
     subPtr(Imm32(sizeof(uintptr_t)), StackPointer);
-    andPtr(Imm32(~(ABIStackAlignment - 1)), StackPointer);
+    asMasm().andPtr(Imm32(~(ABIStackAlignment - 1)), StackPointer);
     storePtr(SecondScratchReg, Address(StackPointer, 0));
 }
 
 void
 MacroAssemblerMIPSCompat::restoreStackPointer()
 {
     loadPtr(Address(StackPointer, 0), StackPointer);
 }
--- a/js/src/jit/mips32/MacroAssembler-mips32.h
+++ b/js/src/jit/mips32/MacroAssembler-mips32.h
@@ -1159,18 +1159,16 @@ public:
         or32(src.low, dest.low);
         or32(src.high, dest.high);
     }
     void xor32(Imm32 imm, Register dest);
     void xorPtr(Imm32 imm, Register dest);
     void xorPtr(Register src, Register dest);
     void orPtr(Imm32 imm, Register dest);
     void orPtr(Register src, Register dest);
-    void andPtr(Imm32 imm, Register dest);
-    void andPtr(Register src, Register dest);
     void addPtr(Register src, Register dest);
     void subPtr(Register src, Register dest);
     void addPtr(const Address& src, Register dest);
     void not32(Register reg);
 
     void move32(Imm32 imm, Register dest);
     void move32(Register src, Register dest);
     void move64(Register64 src, Register64 dest) {
--- a/js/src/jit/none/MacroAssembler-none.h
+++ b/js/src/jit/none/MacroAssembler-none.h
@@ -424,17 +424,16 @@ class MacroAssemblerNone : public Assemb
 
     void rshiftPtr(Imm32, Register) { MOZ_CRASH(); }
     void rshiftPtrArithmetic(Imm32, Register) { MOZ_CRASH(); }
     void lshiftPtr(Imm32, Register) { MOZ_CRASH(); }
     template <typename T, typename S> void xorPtr(T, S) { MOZ_CRASH(); }
     template <typename T, typename S> void xor32(T, S) { MOZ_CRASH(); }
     template <typename T, typename S> void orPtr(T, S) { MOZ_CRASH(); }
     template <typename T, typename S> void or32(T, S) { MOZ_CRASH(); }
-    template <typename T, typename S> void andPtr(T, S) { MOZ_CRASH(); }
     template <typename T> void not32(T) { MOZ_CRASH(); }
     void convertUInt32ToDouble(Register, FloatRegister) { MOZ_CRASH(); }
     void convertUInt32ToFloat32(Register, FloatRegister) { MOZ_CRASH(); }
     void inc64(AbsoluteAddress) { MOZ_CRASH(); }
     void incrementInt32Value(Address) { MOZ_CRASH(); }
     void ensureDouble(ValueOperand, FloatRegister, Label*) { MOZ_CRASH(); }
     void handleFailureWithHandlerTail(void*) { MOZ_CRASH(); }
 
--- a/js/src/jit/x64/MacroAssembler-x64-inl.h
+++ b/js/src/jit/x64/MacroAssembler-x64-inl.h
@@ -12,16 +12,27 @@
 #include "jit/x86-shared/MacroAssembler-x86-shared-inl.h"
 
 namespace js {
 namespace jit {
 
 //{{{ check_macroassembler_style
 // ===============================================================
 
+void
+MacroAssembler::andPtr(Register src, Register dest)
+{
+    andq(src, dest);
+}
+
+void
+MacroAssembler::andPtr(Imm32 imm, Register dest)
+{
+    andq(imm, dest);
+}
 
 //}}} check_macroassembler_style
 // ===============================================================
 
 } // namespace jit
 } // namespace js
 
 #endif /* jit_x64_MacroAssembler_x64_inl_h */
--- a/js/src/jit/x64/MacroAssembler-x64.h
+++ b/js/src/jit/x64/MacroAssembler-x64.h
@@ -882,22 +882,16 @@ class MacroAssemblerX64 : public MacroAs
         orq(imm, dest);
     }
     void orPtr(Register src, Register dest) {
         orq(src, dest);
     }
     void or64(Register64 src, Register64 dest) {
         orq(src.reg, dest.reg);
     }
-    void andPtr(Imm32 imm, Register dest) {
-        andq(imm, dest);
-    }
-    void andPtr(Register src, Register dest) {
-        andq(src, dest);
-    }
     void and64(Imm64 imm, Register64 dest) {
         movq(ImmWord(uintptr_t(imm.value)), ScratchReg);
         andq(ScratchReg, dest.reg);
     }
 
     void splitTag(Register src, Register dest) {
         if (src != dest)
             movq(src, dest);
--- a/js/src/jit/x86/MacroAssembler-x86-inl.h
+++ b/js/src/jit/x86/MacroAssembler-x86-inl.h
@@ -12,16 +12,27 @@
 #include "jit/x86-shared/MacroAssembler-x86-shared-inl.h"
 
 namespace js {
 namespace jit {
 
 //{{{ check_macroassembler_style
 // ===============================================================
 
+void
+MacroAssembler::andPtr(Register src, Register dest)
+{
+    andl(src, dest);
+}
+
+void
+MacroAssembler::andPtr(Imm32 imm, Register dest)
+{
+    andl(imm, dest);
+}
 
 //}}} check_macroassembler_style
 // ===============================================================
 
 } // namespace jit
 } // namespace js
 
 #endif /* jit_x86_MacroAssembler_x86_inl_h */
--- a/js/src/jit/x86/MacroAssembler-x86.h
+++ b/js/src/jit/x86/MacroAssembler-x86.h
@@ -1150,22 +1150,16 @@ class MacroAssemblerX86 : public MacroAs
     }
     void orPtr(Register src, Register dest) {
         orl(src, dest);
     }
     void or64(Register64 src, Register64 dest) {
         orl(src.low, dest.low);
         orl(src.high, dest.high);
     }
-    void andPtr(Imm32 imm, Register dest) {
-        andl(imm, dest);
-    }
-    void andPtr(Register src, Register dest) {
-        andl(src, dest);
-    }
     void and64(Imm64 imm, Register64 dest) {
         andl(Imm32(imm.value & 0xFFFFFFFFL), dest.low);
         andl(Imm32((imm.value >> 32) & 0xFFFFFFFFL), dest.high);
     }
 
     void loadInstructionPointerAfterCall(Register dest) {
         movl(Operand(StackPointer, 0x0), dest);
     }