diff --git a/js/src/ion/Lowering.cpp b/js/src/ion/Lowering.cpp index 47b79ec14d6..ef294b29648 100644 --- a/js/src/ion/Lowering.cpp +++ b/js/src/ion/Lowering.cpp @@ -300,9 +300,20 @@ LIRGenerator::visitCall(MCall *call) // Call known functions. if (target) { if (target->isNative()) { - LCallNative *lir = new LCallNative(argslot, tempFixed(CallTempReg0), - tempFixed(CallTempReg1), tempFixed(CallTempReg2), - tempFixed(CallTempReg3)); + Register cxReg, numReg, vpReg, tmpReg; + GetTempRegForIntArg(0, 0, &cxReg); + GetTempRegForIntArg(1, 0, &numReg); + GetTempRegForIntArg(2, 0, &vpReg); + + // Even though this is just a temp reg, use the same API to avoid + // register collisions. + mozilla::DebugOnly ok = GetTempRegForIntArg(3, 0, &tmpReg); + MOZ_ASSERT(ok, "How can we not have four temp registers?"); + + LCallNative *lir = new LCallNative(argslot, tempFixed(cxReg), + tempFixed(numReg), + tempFixed(vpReg), + tempFixed(tmpReg)); return (defineReturn(lir, call) && assignSafepoint(lir, call)); }