Bug 1058685 - IonMonkey MIPS: Fix warnings and style in MIPS code. r=bbouvier
authorBranislav Rankov <branislav.rankov@imgtec.com>
Wed, 27 Aug 2014 13:42:59 +0200
changeset 223585 5a908388adc08390717e71da350888b4d3a9acbc
parent 223584 0d3f50354b25b852439eb0d30526d7e8d1980710
child 223586 5c977e86af7b0ad722b08be748c7ec9ffefb6958
push id3979
push userraliiev@mozilla.com
push dateMon, 13 Oct 2014 16:35:44 +0000
treeherdermozilla-beta@30f2cc610691 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbbouvier
bugs1058685
milestone34.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 1058685 - IonMonkey MIPS: Fix warnings and style in MIPS code. r=bbouvier
js/src/jit/mips/Assembler-mips.cpp
js/src/jit/mips/Assembler-mips.h
js/src/jit/mips/Bailouts-mips.h
js/src/jit/mips/BaselineIC-mips.cpp
js/src/jit/mips/Simulator-mips.cpp
js/src/jit/mips/Simulator-mips.h
js/src/jit/mips/Trampoline-mips.cpp
--- a/js/src/jit/mips/Assembler-mips.cpp
+++ b/js/src/jit/mips/Assembler-mips.cpp
@@ -1403,17 +1403,16 @@ Assembler::retarget(Label *label, Label 
             DebugOnly<uint32_t> prev = target->use(label->offset());
             MOZ_ASSERT((int32_t)prev == Label::INVALID_OFFSET);
         }
     }
     label->reset();
 }
 
 void dbg_break() {}
-static int stopBKPT = -1;
 void
 Assembler::as_break(uint32_t code)
 {
     MOZ_ASSERT(code <= MAX_BREAK_CODE);
     writeInst(op_special | code << RTShift | ff_break);
 }
 
 uint32_t
@@ -1573,19 +1572,19 @@ InstImm Assembler::invertBranch(InstImm 
 
         branch.setBOffImm16(skipOffset);
         rt = branch.extractRT();
         if (rt & 0x1)
             branch.setRT((RTField) ((rt & ~0x1) << RTShift));
         else
             branch.setRT((RTField) ((rt | 0x1) << RTShift));
         return branch;
+      default:
+        MOZ_CRASH("Error creating long branch.");
     }
-
-    MOZ_CRASH("Error creating long branch.");
 }
 
 void
 Assembler::ToggleToJmp(CodeLocationLabel inst_)
 {
     InstImm * inst = (InstImm *)inst_.raw();
 
     MOZ_ASSERT(inst->extractOpcode() == ((uint32_t)op_andi >> OpcodeShift));
--- a/js/src/jit/mips/Assembler-mips.h
+++ b/js/src/jit/mips/Assembler-mips.h
@@ -235,17 +235,17 @@ static const uint32_t Imm28Mask = ((1 <<
 static const uint32_t RSMask = ((1 << RSBits) - 1) << RSShift;
 static const uint32_t RTMask = ((1 << RTBits) - 1) << RTShift;
 static const uint32_t RDMask = ((1 << RDBits) - 1) << RDShift;
 static const uint32_t SAMask = ((1 << SABits) - 1) << SAShift;
 static const uint32_t FunctionMask = ((1 << FunctionBits) - 1) << FunctionShift;
 static const uint32_t RegMask = Registers::Total - 1;
 static const uint32_t StackAlignmentMask = StackAlignment - 1;
 
-static const int32_t MAX_BREAK_CODE = 1024 - 1;
+static const uint32_t MAX_BREAK_CODE = 1024 - 1;
 
 class Instruction;
 class InstReg;
 class InstImm;
 class InstJump;
 class BranchInstBlock;
 
 uint32_t RS(Register r);
--- a/js/src/jit/mips/Bailouts-mips.h
+++ b/js/src/jit/mips/Bailouts-mips.h
@@ -11,19 +11,19 @@
 #include "jit/JitCompartment.h"
 
 namespace js {
 namespace jit {
 
 class BailoutStack
 {
     uintptr_t frameClassId_;
-    // This is pushed in the bailout handler.  Both entry points into the
+    // This is pushed in the bailout handler. Both entry points into the
     // handler inserts their own value int lr, which is then placed onto the
-    // stack along with frameClassId_ above.  This should be migrated to ip.
+    // stack along with frameClassId_ above. This should be migrated to ip.
   public:
     union {
         uintptr_t frameSize_;
         uintptr_t tableOffset_;
     };
 
   protected:
     mozilla::Array<double, FloatRegisters::TotalPhys> fpregs_;
--- a/js/src/jit/mips/BaselineIC-mips.cpp
+++ b/js/src/jit/mips/BaselineIC-mips.cpp
@@ -78,17 +78,16 @@ ICBinaryArith_Int32::Compiler::generateS
     masm.branchTestInt32(Assembler::NotEqual, R1, &failure);
 
     // Add R0 and R1. Don't need to explicitly unbox, just use R2's payloadReg.
     Register scratchReg = R2.payloadReg();
 
     // DIV and MOD need an extra non-volatile ValueOperand to hold R0.
     GeneralRegisterSet savedRegs = availableGeneralRegs(2);
     savedRegs = GeneralRegisterSet::Intersect(GeneralRegisterSet::NonVolatile(), savedRegs);
-    ValueOperand savedValue = savedRegs.takeAnyValue();
 
     Label goodMul, divTest1, divTest2;
     switch(op_) {
       case JSOP_ADD:
         // We know R0.typeReg() already contains the integer tag. No boxing
         // required.
         masm.ma_addTestOverflow(scratchReg, R0.payloadReg(), R1.payloadReg(), &failure);
         masm.move32(scratchReg, R0.payloadReg());
--- a/js/src/jit/mips/Simulator-mips.cpp
+++ b/js/src/jit/mips/Simulator-mips.cpp
@@ -845,17 +845,18 @@ DisassembleInstruction(uint32_t pc)
 {
     uint8_t *bytes = reinterpret_cast<uint8_t *>(pc);
     char hexbytes[256];
     sprintf(hexbytes, "0x%x 0x%x 0x%x 0x%x", bytes[0], bytes[1], bytes[2], bytes[3]);
     char llvmcmd[1024];
     sprintf(llvmcmd, "bash -c \"echo -n '%p'; echo '%s' | "
             "llvm-mc -disassemble -arch=mipsel -mcpu=mips32r2 | "
             "grep -v pure_instructions | grep -v .text\"", static_cast<void*>(bytes), hexbytes);
-    system(llvmcmd);
+    if (system(llvmcmd))
+        printf("Cannot disassemble instruction.\n");
 }
 
 void
 MipsDebugger::debug()
 {
     intptr_t lastPC = -1;
     bool done = false;
 
--- a/js/src/jit/mips/Simulator-mips.h
+++ b/js/src/jit/mips/Simulator-mips.h
@@ -91,17 +91,17 @@ const uint32_t kFCSRExceptionFlagMask = 
 // - Breaks larger than kMaxStopCode are simple breaks, dropping you into the
 //   debugger.
 const uint32_t kMaxWatchpointCode = 31;
 const uint32_t kMaxStopCode = 127;
 
 // -----------------------------------------------------------------------------
 // Utility functions
 
-typedef int32_t Instr;
+typedef uint32_t Instr;
 class SimInstruction;
 
 class Simulator {
     friend class Redirection;
     friend class MipsDebugger;
   public:
 
     // Registers are declared in order. See "See MIPS Run Linux" chapter 2.
--- a/js/src/jit/mips/Trampoline-mips.cpp
+++ b/js/src/jit/mips/Trampoline-mips.cpp
@@ -335,17 +335,16 @@ JitRuntime::generateInvalidator(JSContex
     for (uint32_t i = 0; i < Registers::Total; i++) {
         Address address = Address(StackPointer, InvalidationBailoutStack::offsetOfRegs() +
                                                 i * sizeof(uintptr_t));
         masm.storePtr(Register::FromCode(i), address);
     }
 
     // Save floating point registers
     // We can use as_sd because stack is alligned.
-    uint32_t increment = 2;
     for (uint32_t i = 0; i < FloatRegisters::TotalDouble; i ++)
         masm.as_sd(FloatRegister::FromIndex(i, FloatRegister::Double), StackPointer,
                    InvalidationBailoutStack::offsetOfFpRegs() + i * sizeof(double));
 
     // Pass pointer to InvalidationBailoutStack structure.
     masm.movePtr(StackPointer, a0);
 
     // Reserve place for return value and BailoutInfo pointer