Bug 895950 - Followup: Fix for when FPU is turned off. (r=djvj)
authorShu-yu Guo <shu@rfrn.org>
Fri, 02 Aug 2013 08:24:57 -0700
changeset 141149 aba98905fc13482fa3c649f9ea54138185b9b517
parent 141148 699c21af878da8539a77b1b7b232e156c9d08bea
child 141150 701af9ee77c8720d305e037fb4b2af55bdeb1728
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersdjvj
bugs895950
milestone25.0a1
Bug 895950 - Followup: Fix for when FPU is turned off. (r=djvj)
js/src/ion/arm/Trampoline-arm.cpp
js/src/ion/shared/CodeGenerator-shared.cpp
js/src/ion/x64/Trampoline-x64.cpp
js/src/ion/x86/Trampoline-x86.cpp
--- a/js/src/ion/arm/Trampoline-arm.cpp
+++ b/js/src/ion/arm/Trampoline-arm.cpp
@@ -728,17 +728,20 @@ IonRuntime::generateVMWrapper(JSContext 
         break;
 
       case Type_Bool:
         masm.load8ZeroExtend(Address(sp, 0), ReturnReg);
         masm.freeStack(sizeof(int32_t));
         break;
 
       case Type_Double:
-        masm.loadDouble(Address(sp, 0), ReturnFloatReg);
+        if (cx->runtime()->jitSupportsFloatingPoint)
+            masm.loadDouble(Address(sp, 0), ReturnFloatReg);
+        else
+            masm.breakpoint();
         masm.freeStack(sizeof(double));
         break;
 
       default:
         JS_ASSERT(f.outParam == Type_Void);
         break;
     }
     masm.leaveExitFrame();
--- a/js/src/ion/shared/CodeGenerator-shared.cpp
+++ b/js/src/ion/shared/CodeGenerator-shared.cpp
@@ -423,16 +423,20 @@ CodeGeneratorShared::markOsiPoint(LOsiPo
 // Before doing any call to Cpp, you should ensure that volatile
 // registers are evicted by the register allocator.
 bool
 CodeGeneratorShared::callVM(const VMFunction &fun, LInstruction *ins, const Register *dynStack)
 {
     // Different execution modes have different sets of VM functions.
     JS_ASSERT(fun.executionMode == gen->info().executionMode());
 
+    // If we're calling a function with an out parameter type of double, make
+    // sure we have an FPU.
+    JS_ASSERT_IF(fun.outParam == Type_Double, GetIonContext()->runtime->jitSupportsFloatingPoint);
+
 #ifdef DEBUG
     if (ins->mirRaw()) {
         JS_ASSERT(ins->mirRaw()->isInstruction());
         MInstruction *mir = ins->mirRaw()->toInstruction();
         JS_ASSERT_IF(mir->isEffectful(), mir->resumePoint());
     }
 #endif
 
--- a/js/src/ion/x64/Trampoline-x64.cpp
+++ b/js/src/ion/x64/Trampoline-x64.cpp
@@ -616,16 +616,17 @@ IonRuntime::generateVMWrapper(JSContext 
         break;
 
       case Type_Bool:
         masm.load8ZeroExtend(Address(esp, 0), ReturnReg);
         masm.freeStack(sizeof(int32_t));
         break;
 
       case Type_Double:
+        JS_ASSERT(cx->runtime()->jitSupportsFloatingPoint);
         masm.loadDouble(Address(esp, 0), ReturnFloatReg);
         masm.freeStack(sizeof(double));
         break;
 
       case Type_Pointer:
         masm.loadPtr(Address(esp, 0), ReturnReg);
         masm.freeStack(sizeof(uintptr_t));
         break;
--- a/js/src/ion/x86/Trampoline-x86.cpp
+++ b/js/src/ion/x86/Trampoline-x86.cpp
@@ -640,17 +640,20 @@ IonRuntime::generateVMWrapper(JSContext 
         break;
 
       case Type_Bool:
         masm.Pop(ReturnReg);
         masm.movzxbl(ReturnReg, ReturnReg);
         break;
 
       case Type_Double:
-        masm.Pop(ReturnFloatReg);
+        if (cx->runtime()->jitSupportsFloatingPoint)
+            masm.Pop(ReturnFloatReg);
+        else
+            masm.breakpoint();
         break;
 
       default:
         JS_ASSERT(f.outParam == Type_Void);
         break;
     }
     masm.leaveExitFrame();
     masm.retn(Imm32(sizeof(IonExitFrameLayout) +