[INFER] Don't use FPConversionTemp in ensureInteger, it does not work without SSE 4.1. r=bhackett
authorJan de Mooij <jandemooij@gmail.com>
Wed, 11 May 2011 16:32:01 +0200
changeset 75034 725420281c328baad5b1e035363a9d892a6e747a
parent 75033 ef221c659ef0b323a9291ad5113f3c04b824f53d
child 75035 8cf9c7a55d8dc40406d4fbbd6e69669f6ec26441
push id2
push userbsmedberg@mozilla.com
push dateFri, 19 Aug 2011 14:38:13 +0000
reviewersbhackett
milestone6.0a1
[INFER] Don't use FPConversionTemp in ensureInteger, it does not work without SSE 4.1. r=bhackett
js/src/methodjit/BaseAssembler.h
js/src/methodjit/FastOps.cpp
--- a/js/src/methodjit/BaseAssembler.h
+++ b/js/src/methodjit/BaseAssembler.h
@@ -223,16 +223,17 @@ static const JSC::MacroAssembler::Regist
 
 #ifdef JS_CPU_X86
     void idiv(RegisterID reg) {
         m_assembler.cdq();
         m_assembler.idivl_r(reg);
     }
 
     void fastLoadDouble(RegisterID lo, RegisterID hi, FPRegisterID fpReg) {
+        JS_ASSERT(fpReg != Registers::FPConversionTemp);
         if (MacroAssemblerX86Common::getSSEState() >= HasSSE4_1) {
             m_assembler.movd_rr(lo, fpReg);
             m_assembler.pinsrd_rr(hi, fpReg);
         } else {
             m_assembler.movd_rr(lo, fpReg);
             m_assembler.movd_rr(hi, Registers::FPConversionTemp);
             m_assembler.unpcklps_rr(Registers::FPConversionTemp, fpReg);
         }
--- a/js/src/methodjit/FastOps.cpp
+++ b/js/src/methodjit/FastOps.cpp
@@ -94,35 +94,37 @@ mjit::Compiler::ensureInteger(FrameEntry
         stubcc.masm.addDouble(fpreg, fptemp);
         stubcc.masm.branchConvertDoubleToInt32(fptemp, data, isDouble, Registers::FPConversionTemp);
         stubcc.crossJump(stubcc.masm.jump(), masm.label());
         isDouble.linkTo(syncPath, &stubcc.masm);
 
         frame.freeReg(fptemp);
         frame.learnType(fe, JSVAL_TYPE_INT32, data);
     } else if (!fe->isType(JSVAL_TYPE_INT32)) {
+        FPRegisterID fptemp = frame.allocFPReg();
         RegisterID typeReg = frame.tempRegForType(fe);
         frame.pinReg(typeReg);
         RegisterID dataReg = frame.copyDataIntoReg(fe);
         frame.unpinReg(typeReg);
 
         Jump intGuard = masm.testInt32(Assembler::NotEqual, typeReg);
 
         Label syncPath = stubcc.syncExitAndJump(uses);
         stubcc.linkExitDirect(intGuard, stubcc.masm.label());
 
         /* Try an OOL path to truncate doubles representing int32s. */
         Jump doubleGuard = stubcc.masm.testDouble(Assembler::NotEqual, typeReg);
         doubleGuard.linkTo(syncPath, &stubcc.masm);
 
-        frame.loadDouble(fe, Registers::FPConversionTemp, stubcc.masm);
-        Jump truncateGuard = stubcc.masm.branchTruncateDoubleToInt32(Registers::FPConversionTemp, dataReg);
+        frame.loadDouble(fe, fptemp, stubcc.masm);
+        Jump truncateGuard = stubcc.masm.branchTruncateDoubleToInt32(fptemp, dataReg);
         truncateGuard.linkTo(syncPath, &stubcc.masm);
         stubcc.crossJump(stubcc.masm.jump(), masm.label());
 
+        frame.freeReg(fptemp);
         frame.learnType(fe, JSVAL_TYPE_INT32, dataReg);
     }
 }
 
 void
 mjit::Compiler::jsop_bitnot()
 {
     FrameEntry *top = frame.peek(-1);