Bug 1203964 - Part 5: Move MacroAssembler::lshift64 into generic macro assembler. r=sstangl
authorTooru Fujisawa <arai_a@mac.com>
Sun, 13 Sep 2015 07:33:35 +0900
changeset 296100 5f6c252853022783cb6acbb91d00fd660c5d53e2
parent 296099 067bf504578c8e21aa0a991beca20c2e9256d542
child 296101 a6904700794378c465f9136cfb1eef059af4979e
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)
reviewerssstangl
bugs1203964
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 1203964 - Part 5: Move MacroAssembler::lshift64 into generic macro assembler. r=sstangl
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/mips32/MacroAssembler-mips32-inl.h
js/src/jit/mips32/MacroAssembler-mips32.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
@@ -697,16 +697,18 @@ class MacroAssembler : public MacroAssem
     inline void xorPtr(Register src, Register dest) PER_ARCH;
     inline void xorPtr(Imm32 imm, Register dest) PER_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;
     inline void rshiftPtr(Imm32 imm, Register src, Register dest) DEFINED_ON(arm64);
 
     inline void rshiftPtrArithmetic(Imm32 imm, Register dest) PER_ARCH;
 
     inline void rshift64(Imm32 imm, Register64 dest) PER_ARCH;
 
     //}}} check_macroassembler_style
--- a/js/src/jit/arm/MacroAssembler-arm-inl.h
+++ b/js/src/jit/arm/MacroAssembler-arm-inl.h
@@ -133,16 +133,24 @@ MacroAssembler::xorPtr(Imm32 imm, Regist
 
 void
 MacroAssembler::lshiftPtr(Imm32 imm, Register dest)
 {
     ma_lsl(imm, dest, dest);
 }
 
 void
+MacroAssembler::lshift64(Imm32 imm, Register64 dest)
+{
+    as_mov(dest.high, lsl(dest.high, imm.value));
+    as_orr(dest.high, dest.high, lsr(dest.low, 32 - imm.value));
+    as_mov(dest.low, lsl(dest.low, imm.value));
+}
+
+void
 MacroAssembler::rshiftPtr(Imm32 imm, Register dest)
 {
     ma_lsr(imm, dest, dest);
 }
 
 void
 MacroAssembler::rshiftPtrArithmetic(Imm32 imm, Register dest)
 {
--- a/js/src/jit/arm/MacroAssembler-arm.h
+++ b/js/src/jit/arm/MacroAssembler-arm.h
@@ -1711,22 +1711,16 @@ class MacroAssemblerARMCompat : public M
                       Label* label);
 
     void compareFloat(FloatRegister lhs, FloatRegister rhs);
     void branchFloat(DoubleCondition cond, FloatRegister lhs, FloatRegister rhs,
                      Label* label);
 
     void checkStackAlignment();
 
-    void lshift64(Imm32 imm, Register64 dest) {
-        as_mov(dest.high, lsl(dest.high, imm.value));
-        as_orr(dest.high, dest.high, lsr(dest.low, 32 - imm.value));
-        as_mov(dest.low, lsl(dest.low, imm.value));
-    }
-
     // 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);
 
     void
     emitSet(Assembler::Condition cond, Register dest)
     {
         ma_mov(Imm32(0), dest);
--- a/js/src/jit/arm64/MacroAssembler-arm64-inl.h
+++ b/js/src/jit/arm64/MacroAssembler-arm64-inl.h
@@ -146,16 +146,22 @@ MacroAssembler::xorPtr(Imm32 imm, Regist
 
 void
 MacroAssembler::lshiftPtr(Imm32 imm, Register dest)
 {
     Lsl(ARMRegister(dest, 64), ARMRegister(dest, 64), imm.value);
 }
 
 void
+MacroAssembler::lshift64(Imm32 imm, Register64 dest)
+{
+    lshiftPtr(imm, dest.reg);
+}
+
+void
 MacroAssembler::rshiftPtr(Imm32 imm, Register dest)
 {
     Lsr(ARMRegister(dest, 64), ARMRegister(dest, 64), imm.value);
 }
 
 void
 MacroAssembler::rshiftPtr(Imm32 imm, Register src, Register dest)
 {
@@ -172,22 +178,16 @@ void
 MacroAssembler::rshift64(Imm32 imm, Register64 dest)
 {
     rshiftPtr(imm, dest.reg);
 }
 
 //}}} check_macroassembler_style
 // ===============================================================
 
-void
-MacroAssemblerCompat::lshift64(Imm32 imm, Register64 dest)
-{
-    asMasm().lshiftPtr(imm, dest.reg);
-}
-
 template <typename T>
 void
 MacroAssemblerCompat::andToStackPtr(T t)
 {
     asMasm().andPtr(t, getStackPointer());
     syncStackPtr();
 }
 
--- a/js/src/jit/arm64/MacroAssembler-arm64.h
+++ b/js/src/jit/arm64/MacroAssembler-arm64.h
@@ -1061,18 +1061,16 @@ class MacroAssemblerCompat : public vixl
     void branchStackPtr(Condition cond, T rhs, Label* label) {
         branchPtr(cond, getStackPointer(), rhs, label);
     }
     template <typename T>
     void branchStackPtrRhs(Condition cond, T lhs, Label* label) {
         branchPtr(cond, lhs, getStackPointer(), label);
     }
 
-    inline void lshift64(Imm32 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) {
         vixl::UseScratchRegisterScope temps(this);
--- a/js/src/jit/mips32/MacroAssembler-mips32-inl.h
+++ b/js/src/jit/mips32/MacroAssembler-mips32-inl.h
@@ -130,16 +130,26 @@ MacroAssembler::xorPtr(Imm32 imm, Regist
 
 void
 MacroAssembler::lshiftPtr(Imm32 imm, Register dest)
 {
     ma_sll(dest, dest, imm);
 }
 
 void
+MacroAssembler::lshift64(Imm32 imm, Register64 dest)
+{
+    ScratchRegisterScope scratch(*this);
+    as_sll(dest.high, dest.high, imm.value);
+    as_srl(scratch, dest.low, 32 - imm.value);
+    as_or(dest.high, dest.high, scratch);
+    as_sll(dest.low, dest.low, imm.value);
+}
+
+void
 MacroAssembler::rshiftPtr(Imm32 imm, Register dest)
 {
     ma_srl(dest, dest, imm);
 }
 
 void
 MacroAssembler::rshiftPtrArithmetic(Imm32 imm, Register dest)
 {
--- a/js/src/jit/mips32/MacroAssembler-mips32.h
+++ b/js/src/jit/mips32/MacroAssembler-mips32.h
@@ -1344,23 +1344,16 @@ class MacroAssemblerMIPSCompat : public 
                      Label* label);
 
     void checkStackAlignment();
 
     void alignStackPointer();
     void restoreStackPointer();
     static void calculateAlignedStackPointer(void** stackPointer);
 
-    void lshift64(Imm32 imm, Register64 dest) {
-        as_sll(dest.high, dest.high, imm.value);
-        as_srl(ScratchRegister, dest.low, 32 - imm.value);
-        as_or(dest.high, dest.high, ScratchRegister);
-        as_sll(dest.low, dest.low, imm.value);
-    }
-
     // 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);
 
     template <typename T1, typename T2>
     void cmpPtrSet(Assembler::Condition cond, T1 lhs, T2 rhs, Register dest)
     {
         ma_cmp_set(dest, lhs, rhs, cond);
--- a/js/src/jit/x64/MacroAssembler-x64-inl.h
+++ b/js/src/jit/x64/MacroAssembler-x64-inl.h
@@ -71,16 +71,22 @@ MacroAssembler::xorPtr(Imm32 imm, Regist
 
 void
 MacroAssembler::lshiftPtr(Imm32 imm, Register dest)
 {
     shlq(imm, dest);
 }
 
 void
+MacroAssembler::lshift64(Imm32 imm, Register64 dest)
+{
+    shlq(imm, dest.reg);
+}
+
+void
 MacroAssembler::rshiftPtr(Imm32 imm, Register dest)
 {
     shrq(imm, dest);
 }
 
 void
 MacroAssembler::rshiftPtrArithmetic(Imm32 imm, Register dest)
 {
--- a/js/src/jit/x64/MacroAssembler-x64.h
+++ b/js/src/jit/x64/MacroAssembler-x64.h
@@ -845,19 +845,16 @@ class MacroAssemblerX64 : public MacroAs
             ScratchRegisterScope scratch(asMasm());
             mov(ImmPtr(address.addr), scratch);
             store32(src, Address(scratch, 0x0));
         }
     }
     void store64(Register64 src, Address address) {
         movq(src.reg, Operand(address));
     }
-    void lshift64(Imm32 imm, Register64 dest) {
-        shlq(imm, dest.reg);
-    }
 
     void splitTag(Register src, Register dest) {
         if (src != dest)
             movq(src, dest);
         shrq(Imm32(JSVAL_TAG_SHIFT), dest);
     }
     void splitTag(const ValueOperand& operand, Register dest) {
         splitTag(operand.valueReg(), dest);
--- a/js/src/jit/x86/MacroAssembler-x86-inl.h
+++ b/js/src/jit/x86/MacroAssembler-x86-inl.h
@@ -72,16 +72,23 @@ MacroAssembler::xorPtr(Imm32 imm, Regist
 
 void
 MacroAssembler::lshiftPtr(Imm32 imm, Register dest)
 {
     shll(imm, dest);
 }
 
 void
+MacroAssembler::lshift64(Imm32 imm, Register64 dest)
+{
+    shldl(imm, dest.low, dest.high);
+    shll(imm, dest.low);
+}
+
+void
 MacroAssembler::rshiftPtr(Imm32 imm, Register dest)
 {
     shrl(imm, dest);
 }
 
 void
 MacroAssembler::rshiftPtrArithmetic(Imm32 imm, Register dest)
 {
--- a/js/src/jit/x86/MacroAssembler-x86.h
+++ b/js/src/jit/x86/MacroAssembler-x86.h
@@ -1117,21 +1117,16 @@ class MacroAssemblerX86 : public MacroAs
             return;
           case 1:
             store8(value.payloadReg(), address);
             return;
           default: MOZ_CRASH("Bad payload width");
         }
     }
 
-    void lshift64(Imm32 imm, Register64 dest) {
-        shldl(imm, dest.low, dest.high);
-        shll(imm, dest.low);
-    }
-
     void loadInstructionPointerAfterCall(Register dest) {
         movl(Operand(StackPointer, 0x0), dest);
     }
 
     // Note: this function clobbers the source register.
     void convertUInt32ToDouble(Register src, FloatRegister dest) {
         // src is [0, 2^32-1]
         subl(Imm32(0x80000000), src);