Bug 1213747 - IonMonkey: MIPS: Import MIPS64 support into MoveEmitter-mips-shared. r=nbp f=rankov
authorHeiher <r@hev.cc>
Sun, 25 Oct 2015 06:01:47 +0800
changeset 304561 682060676362c22c3a3141f0b73a1566869e8745
parent 304560 e6334551d3019757312d2b836144c5e6f614b717
child 304562 16c2a146a49396e19b433dc958cca731065e45e7
push id1001
push userraliiev@mozilla.com
push dateMon, 18 Jan 2016 19:06:03 +0000
treeherdermozilla-release@8b89261f3ac4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnbp
bugs1213747
milestone44.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 1213747 - IonMonkey: MIPS: Import MIPS64 support into MoveEmitter-mips-shared. r=nbp f=rankov --- js/src/jit/mips-shared/MoveEmitter-mips-shared.cpp | 39 +++++++++++++++++++++- js/src/jit/mips-shared/MoveEmitter-mips-shared.h | 1 + 2 files changed, 39 insertions(+), 1 deletion(-)
js/src/jit/mips-shared/MoveEmitter-mips-shared.cpp
js/src/jit/mips-shared/MoveEmitter-mips-shared.h
--- a/js/src/jit/mips-shared/MoveEmitter-mips-shared.cpp
+++ b/js/src/jit/mips-shared/MoveEmitter-mips-shared.cpp
@@ -89,16 +89,52 @@ MoveEmitterMIPSShared::emitMove(const Mo
             MOZ_CRASH("Invalid emitMove arguments.");
         }
     } else {
         MOZ_CRASH("Invalid emitMove arguments.");
     }
 }
 
 void
+MoveEmitterMIPSShared::emitInt32Move(const MoveOperand &from, const MoveOperand &to)
+{
+    if (from.isGeneralReg()) {
+        // Second scratch register should not be moved by MoveEmitter.
+        MOZ_ASSERT(from.reg() != spilledReg_);
+
+        if (to.isGeneralReg())
+            masm.move32(from.reg(), to.reg());
+        else if (to.isMemory())
+            masm.store32(from.reg(), getAdjustedAddress(to));
+        else
+            MOZ_CRASH("Invalid emitInt32Move arguments.");
+    } else if (from.isMemory()) {
+        if (to.isGeneralReg()) {
+            masm.load32(getAdjustedAddress(from), to.reg());
+        } else if (to.isMemory()) {
+            masm.load32(getAdjustedAddress(from), tempReg());
+            masm.store32(tempReg(), getAdjustedAddress(to));
+        } else {
+            MOZ_CRASH("Invalid emitInt32Move arguments.");
+        }
+    } else if (from.isEffectiveAddress()) {
+        if (to.isGeneralReg()) {
+            masm.computeEffectiveAddress(getAdjustedAddress(from), to.reg());
+        } else if (to.isMemory()) {
+            masm.computeEffectiveAddress(getAdjustedAddress(from), tempReg());
+            masm.store32(tempReg(), getAdjustedAddress(to));
+        } else {
+            MOZ_CRASH("Invalid emitInt32Move arguments.");
+        }
+    } else {
+        MOZ_CRASH("Invalid emitInt32Move arguments.");
+    }
+}
+
+void
 MoveEmitterMIPSShared::emitFloat32Move(const MoveOperand& from, const MoveOperand& to)
 {
     // Ensure that we can use ScratchFloat32Reg in memory move.
     MOZ_ASSERT_IF(from.isFloatReg(), from.floatReg() != ScratchFloat32Reg);
     MOZ_ASSERT_IF(to.isFloatReg(), to.floatReg() != ScratchFloat32Reg);
 
     if (from.isFloatReg()) {
         if (to.isFloatReg()) {
@@ -157,17 +193,18 @@ MoveEmitterMIPSShared::emit(const MoveOp
     switch (move.type()) {
       case MoveOp::FLOAT32:
         emitFloat32Move(from, to);
         break;
       case MoveOp::DOUBLE:
         emitDoubleMove(from, to);
         break;
       case MoveOp::INT32:
-        MOZ_ASSERT(sizeof(uintptr_t) == sizeof(int32_t));
+        emitInt32Move(from, to);
+        break;
       case MoveOp::GENERAL:
         emitMove(from, to);
         break;
       default:
         MOZ_CRASH("Unexpected move type");
     }
 }
 
--- a/js/src/jit/mips-shared/MoveEmitter-mips-shared.h
+++ b/js/src/jit/mips-shared/MoveEmitter-mips-shared.h
@@ -37,16 +37,17 @@ class MoveEmitterMIPSShared
     void assertDone();
     Register tempReg();
     FloatRegister tempFloatReg();
     Address cycleSlot(uint32_t slot, uint32_t subslot) const;
     int32_t getAdjustedOffset(const MoveOperand& operand);
     Address getAdjustedAddress(const MoveOperand& operand);
 
     void emitMove(const MoveOperand& from, const MoveOperand& to);
+    void emitInt32Move(const MoveOperand& from, const MoveOperand& to);
     void emitFloat32Move(const MoveOperand& from, const MoveOperand& to);
     virtual void emitDoubleMove(const MoveOperand& from, const MoveOperand& to) = 0;
     virtual void breakCycle(const MoveOperand& from, const MoveOperand& to,
                     MoveOp::Type type, uint32_t slot) = 0;
     virtual void completeCycle(const MoveOperand& from, const MoveOperand& to,
                        MoveOp::Type type, uint32_t slot) = 0;
     void emit(const MoveOp& move);