From d4488d30431da668026178405c9d183215bb2cb5 Mon Sep 17 00:00:00 2001 From: Eric Faust Date: Tue, 8 Jan 2013 16:50:04 -0500 Subject: [PATCH] Bug 827965 - Utilize GetTempRegForIntArg() for callNative calls. (r=sstangl) --- js/src/ion/Lowering.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) 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)); }