More MIPS fixes. Fibonacci and ExceptionTest work.

In this change:
- Fixed compilation of div-int and instance-of
- Fixed VERIFY_OBJECT to compile again
- Added stack space for passing extra function arguments for
  REF_ONLY_CALLEE_SAVE functions
- Fixed AbstractMethodErrorStub to match stack layout

Change-Id: I3d4540a3285a0acf49522ffc6f01d04b888bb8ef
diff --git a/src/compiler/codegen/GenCommon.cc b/src/compiler/codegen/GenCommon.cc
index c1d4661..21f824d 100644
--- a/src/compiler/codegen/GenCommon.cc
+++ b/src/compiler/codegen/GenCommon.cc
@@ -1321,6 +1321,10 @@
     }
   }
   /* rARG0 is ref, rARG2 is class. If ref==null, use directly as bool result */
+  RegLocation rlResult = oatGetReturn(cUnit, false);
+#if defined(TARGET_MIPS)
+  opRegCopy(cUnit, rlResult.lowReg, r_ZERO);    // store false result for if branch is taken
+#endif
   LIR* branch1 = opCmpImmBranch(cUnit, kCondEq, rARG0, 0, NULL);
   /* load object->klass_ */
   DCHECK_EQ(Object::ClassOffset().Int32Value(), 0);
@@ -1339,7 +1343,7 @@
   oatFreeTemp(cUnit, rTgt);
 #else
   /* Uses branchovers */
-  loadConstant(cUnit, rARG0, 1);     // assume true
+  loadConstant(cUnit, rlResult.lowReg, 1);     // assume true
   LIR* branchover = opCmpBranch(cUnit, kCondEq, rARG1, rARG2, NULL);
 #if !defined(TARGET_X86)
   int rTgt = loadHelper(cUnit,
@@ -1356,7 +1360,6 @@
   oatClobberCalleeSave(cUnit);
   /* branch targets here */
   LIR* target = newLIR0(cUnit, kPseudoTargetLabel);
-  RegLocation rlResult = oatGetReturn(cUnit, false);
   storeValue(cUnit, rlDest, rlResult);
   branch1->target = target;
 #if !defined(TARGET_ARM)
@@ -1884,9 +1887,10 @@
     storeValue(cUnit, rlDest, rlResult);
   } else {
 #if defined(TARGET_MIPS)
+    rlSrc1 = loadValue(cUnit, rlSrc1, kCoreReg);
     rlSrc2 = loadValue(cUnit, rlSrc2, kCoreReg);
     if (checkZero) {
-        genNullCheck(cUnit, rlSrc2.sRegLow, rlSrc2.lowReg, 0);
+        genImmedCheck(cUnit, kCondEq, rlSrc2.lowReg, 0, kThrowDivZero);
     }
     newLIR4(cUnit, kMipsDiv, r_HI, r_LO, rlSrc1.lowReg, rlSrc2.lowReg);
     rlResult = oatEvalLoc(cUnit, rlDest, kCoreReg, true);
@@ -1918,8 +1922,8 @@
       rlResult = oatGetReturn(cUnit, false);
     else
       rlResult = oatGetReturnAlt(cUnit);
-    storeValue(cUnit, rlDest, rlResult);
 #endif
+    storeValue(cUnit, rlDest, rlResult);
   }
   return false;
 }