Bug 1203964 - Part 4: Move MacroAssembler::lshiftPtr into generic macro assembler. r=nbp
authorTooru Fujisawa <arai_a@mac.com>
Sun, 13 Sep 2015 07:33:35 +0900
changeset 296099 067bf504578c8e21aa0a991beca20c2e9256d542
parent 296098 ce2d4944e071e2a05c572d97e86c7542b8952aec
child 296100 5f6c252853022783cb6acbb91d00fd660c5d53e2
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)
reviewersnbp
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 4: Move MacroAssembler::lshiftPtr into generic macro assembler. r=nbp
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.cpp
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/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
@@ -695,16 +695,18 @@ class MacroAssembler : public MacroAssem
     inline void xor32(Imm32 imm, Register dest) PER_SHARED_ARCH;
 
     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 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
@@ -127,16 +127,22 @@ MacroAssembler::xorPtr(Imm32 imm, Regist
 {
     ma_eor(imm, dest);
 }
 
 // ===============================================================
 // Shift functions
 
 void
+MacroAssembler::lshiftPtr(Imm32 imm, Register dest)
+{
+    ma_lsl(imm, dest, dest);
+}
+
+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,19 +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 lshiftPtr(Imm32 imm, Register dest) {
-        ma_lsl(imm, dest, dest);
-    }
     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.
--- a/js/src/jit/arm64/MacroAssembler-arm64-inl.h
+++ b/js/src/jit/arm64/MacroAssembler-arm64-inl.h
@@ -140,16 +140,22 @@ MacroAssembler::xorPtr(Imm32 imm, Regist
 {
     Eor(ARMRegister(dest, 64), ARMRegister(dest, 64), Operand(imm.value));
 }
 
 // ===============================================================
 // Shift functions
 
 void
+MacroAssembler::lshiftPtr(Imm32 imm, Register dest)
+{
+    Lsl(ARMRegister(dest, 64), ARMRegister(dest, 64), imm.value);
+}
+
+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)
 {
@@ -166,16 +172,22 @@ 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.cpp
+++ b/js/src/jit/arm64/MacroAssembler-arm64.cpp
@@ -120,16 +120,23 @@ MacroAssemblerCompat::movePatchablePtr(I
 
     // Add the entry to the pool, fix up the LDR imm19 offset,
     // and add the completed instruction to the buffer.
     return armbuffer_.allocEntry(numInst, numPoolEntries,
                                  (uint8_t*)&instructionScratch, literalAddr);
 }
 
 void
+MacroAssemblerCompat::loadPrivate(const Address& src, Register dest)
+{
+    loadPtr(src, dest);
+    asMasm().lshiftPtr(Imm32(1), dest);
+}
+
+void
 MacroAssemblerCompat::handleFailureWithHandlerTail(void* handler)
 {
     // Reserve space for exception information.
     int64_t size = (sizeof(ResumeFromException) + 7) & ~7;
     Sub(GetStackPointer64(), GetStackPointer64(), Operand(size));
     if (!GetStackPointer64().Is(sp))
         Mov(sp, GetStackPointer64());
 
--- a/js/src/jit/arm64/MacroAssembler-arm64.h
+++ b/js/src/jit/arm64/MacroAssembler-arm64.h
@@ -848,20 +848,17 @@ class MacroAssemblerCompat : public vixl
 
             Add(scratch, ARMRegister(base, 64), Operand(int64_t(src.offset)));
             Ldr(dest64, MemOperand(scratch, index64, vixl::LSL, scale));
             return;
         }
 
         Ldr(dest64, MemOperand(ARMRegister(base, 64), index64, vixl::LSL, scale));
     }
-    void loadPrivate(const Address& src, Register dest) {
-        loadPtr(src, dest);
-        lshiftPtr(Imm32(1), dest);
-    }
+    void loadPrivate(const Address& src, Register dest);
 
     void store8(Register src, const Address& address) {
         Strb(ARMRegister(src, 32), MemOperand(ARMRegister(address.base, 64), address.offset));
     }
     void store8(Imm32 imm, const Address& address) {
         vixl::UseScratchRegisterScope temps(this);
         const ARMRegister scratch32 = temps.AcquireW();
         MOZ_ASSERT(scratch32.asUnsized() != address.base);
@@ -1064,22 +1061,17 @@ 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);
     }
 
-    void lshiftPtr(Imm32 imm, Register dest) {
-        Lsl(ARMRegister(dest, 64), ARMRegister(dest, 64), imm.value);
-    }
-    void lshift64(Imm32 imm, Register64 dest) {
-        lshiftPtr(imm, dest.reg);
-    }
+    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) {
--- a/js/src/jit/mips32/MacroAssembler-mips32-inl.h
+++ b/js/src/jit/mips32/MacroAssembler-mips32-inl.h
@@ -124,16 +124,22 @@ MacroAssembler::xorPtr(Imm32 imm, Regist
 {
     ma_xor(dest, imm);
 }
 
 // ===============================================================
 // Shift functions
 
 void
+MacroAssembler::lshiftPtr(Imm32 imm, Register dest)
+{
+    ma_sll(dest, dest, imm);
+}
+
+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,19 +1344,16 @@ class MacroAssemblerMIPSCompat : public 
                      Label* label);
 
     void checkStackAlignment();
 
     void alignStackPointer();
     void restoreStackPointer();
     static void calculateAlignedStackPointer(void** stackPointer);
 
-    void lshiftPtr(Imm32 imm, Register dest) {
-        ma_sll(dest, dest, imm);
-    }
     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,
--- a/js/src/jit/none/MacroAssembler-none.h
+++ b/js/src/jit/none/MacroAssembler-none.h
@@ -417,17 +417,16 @@ class MacroAssemblerNone : public Assemb
     void branchTestBooleanTruthy(bool, ValueOperand, Label*) { MOZ_CRASH(); }
     void branchTestStringTruthy(bool, ValueOperand, Label*) { MOZ_CRASH(); }
     void branchTestDoubleTruthy(bool, FloatRegister, Label*) { MOZ_CRASH(); }
 
     template <typename T> void loadUnboxedValue(T, MIRType, AnyRegister) { MOZ_CRASH(); }
     template <typename T> void storeUnboxedValue(ConstantOrRegister, MIRType, T, MIRType) { MOZ_CRASH(); }
     template <typename T> void storeUnboxedPayload(ValueOperand value, T, size_t) { MOZ_CRASH(); }
 
-    void lshiftPtr(Imm32, Register) { 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(); }
 
     void branchPtrInNurseryRange(Condition, Register, Register, Label*) { MOZ_CRASH(); }
--- a/js/src/jit/x64/MacroAssembler-x64-inl.h
+++ b/js/src/jit/x64/MacroAssembler-x64-inl.h
@@ -65,16 +65,22 @@ MacroAssembler::xorPtr(Imm32 imm, Regist
 {
     xorq(imm, dest);
 }
 
 // ===============================================================
 // Shift functions
 
 void
+MacroAssembler::lshiftPtr(Imm32 imm, Register dest)
+{
+    shlq(imm, dest);
+}
+
+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 lshiftPtr(Imm32 imm, Register dest) {
-        shlq(imm, dest);
-    }
     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);
--- a/js/src/jit/x86/MacroAssembler-x86-inl.h
+++ b/js/src/jit/x86/MacroAssembler-x86-inl.h
@@ -66,16 +66,22 @@ MacroAssembler::xorPtr(Imm32 imm, Regist
 {
     xorl(imm, dest);
 }
 
 // ===============================================================
 // Shift functions
 
 void
+MacroAssembler::lshiftPtr(Imm32 imm, Register dest)
+{
+    shll(imm, dest);
+}
+
+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,19 +1117,16 @@ class MacroAssemblerX86 : public MacroAs
             return;
           case 1:
             store8(value.payloadReg(), address);
             return;
           default: MOZ_CRASH("Bad payload width");
         }
     }
 
-    void lshiftPtr(Imm32 imm, Register dest) {
-        shll(imm, dest);
-    }
     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);
     }