Bug 1583088 - [MIPS64]Fix visitCompareI64{AndBranch}, handle the case that rhs operand is on the stack. r=jandem
authorZhao Jiazhong <zhaojiazhong-hf@loongson.cn>
Mon, 14 Oct 2019 02:46:19 +0000
changeset 497384 933011b28eda1f1ef628a8401e3af9e26f7727e1
parent 497383 b4479a9504d01e25d876bf0c63581869baee20fb
child 497385 deb30855228644a17c206a99d45ab248f05f542c
child 497543 585fe45563356a10a9d53cddfeda2bd699e46dd5
push id97857
push usernerli@mozilla.com
push dateMon, 14 Oct 2019 03:29:24 +0000
treeherderautoland@933011b28eda [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs1583088
milestone71.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 1583088 - [MIPS64]Fix visitCompareI64{AndBranch}, handle the case that rhs operand is on the stack. r=jandem Differential Revision: https://phabricator.services.mozilla.com/D46755
js/src/jit/mips64/CodeGenerator-mips64.cpp
--- a/js/src/jit/mips64/CodeGenerator-mips64.cpp
+++ b/js/src/jit/mips64/CodeGenerator-mips64.cpp
@@ -181,44 +181,52 @@ void CodeGenerator::visitCompareI64(LCom
   MOZ_ASSERT(mir->compareType() == MCompare::Compare_Int64 ||
              mir->compareType() == MCompare::Compare_UInt64);
 
   const LInt64Allocation lhs = lir->getInt64Operand(LCompareI64::Lhs);
   const LInt64Allocation rhs = lir->getInt64Operand(LCompareI64::Rhs);
   Register lhsReg = ToRegister64(lhs).reg;
   Register output = ToRegister(lir->output());
   Register rhsReg;
+  ScratchRegisterScope scratch(masm);
 
   if (IsConstant(rhs)) {
-    rhsReg = ScratchRegister;
+    rhsReg = scratch;
     masm.ma_li(rhsReg, ImmWord(ToInt64(rhs)));
+  } else if (rhs.value().isGeneralReg()) {
+    rhsReg = ToRegister64(rhs).reg;
   } else {
-    rhsReg = ToRegister64(rhs).reg;
+    rhsReg = scratch;
+    masm.loadPtr(ToAddress(rhs.value()), rhsReg);
   }
 
   bool isSigned = mir->compareType() == MCompare::Compare_Int64;
   masm.cmpPtrSet(JSOpToCondition(lir->jsop(), isSigned), lhsReg, rhsReg,
                  output);
 }
 
 void CodeGenerator::visitCompareI64AndBranch(LCompareI64AndBranch* lir) {
   MCompare* mir = lir->cmpMir();
   MOZ_ASSERT(mir->compareType() == MCompare::Compare_Int64 ||
              mir->compareType() == MCompare::Compare_UInt64);
 
   const LInt64Allocation lhs = lir->getInt64Operand(LCompareI64::Lhs);
   const LInt64Allocation rhs = lir->getInt64Operand(LCompareI64::Rhs);
   Register lhsReg = ToRegister64(lhs).reg;
   Register rhsReg;
+  ScratchRegisterScope scratch(masm);
 
   if (IsConstant(rhs)) {
-    rhsReg = ScratchRegister;
+    rhsReg = scratch;
     masm.ma_li(rhsReg, ImmWord(ToInt64(rhs)));
+  } else if (rhs.value().isGeneralReg()) {
+    rhsReg = ToRegister64(rhs).reg;
   } else {
-    rhsReg = ToRegister64(rhs).reg;
+    rhsReg = scratch;
+    masm.loadPtr(ToAddress(rhs.value()), rhsReg);
   }
 
   bool isSigned = mir->compareType() == MCompare::Compare_Int64;
   Assembler::Condition cond = JSOpToCondition(lir->jsop(), isSigned);
   emitBranch(lhsReg, rhsReg, cond, lir->ifTrue(), lir->ifFalse());
 }
 
 void CodeGenerator::visitDivOrModI64(LDivOrModI64* lir) {