From 22b71a7d582b79f9d9cea27ff23bf3c88bd767d4 Mon Sep 17 00:00:00 2001 From: Zhao Jiazhong Date: Mon, 14 Oct 2019 02:46:19 +0000 Subject: [PATCH] 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 --HG-- extra : moz-landing-system : lando --- js/src/jit/mips64/CodeGenerator-mips64.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/js/src/jit/mips64/CodeGenerator-mips64.cpp b/js/src/jit/mips64/CodeGenerator-mips64.cpp index 68943c93d4d5..1af0ea2d2f19 100644 --- a/js/src/jit/mips64/CodeGenerator-mips64.cpp +++ b/js/src/jit/mips64/CodeGenerator-mips64.cpp @@ -186,12 +186,16 @@ void CodeGenerator::visitCompareI64(LCompareI64* lir) { 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 { + } else if (rhs.value().isGeneralReg()) { rhsReg = ToRegister64(rhs).reg; + } else { + rhsReg = scratch; + masm.loadPtr(ToAddress(rhs.value()), rhsReg); } bool isSigned = mir->compareType() == MCompare::Compare_Int64; @@ -208,12 +212,16 @@ void CodeGenerator::visitCompareI64AndBranch(LCompareI64AndBranch* lir) { 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 { + } else if (rhs.value().isGeneralReg()) { rhsReg = ToRegister64(rhs).reg; + } else { + rhsReg = scratch; + masm.loadPtr(ToAddress(rhs.value()), rhsReg); } bool isSigned = mir->compareType() == MCompare::Compare_Int64;