Index: src/crankshaft/x87/lithium-codegen-x87.cc |
diff --git a/src/crankshaft/x87/lithium-codegen-x87.cc b/src/crankshaft/x87/lithium-codegen-x87.cc |
index 88cfc65ab6a787adf719c4cf8feedafd1fb818e3..f6c97ff18c66fecb49d03d2be0805eccf2698ea9 100644 |
--- a/src/crankshaft/x87/lithium-codegen-x87.cc |
+++ b/src/crankshaft/x87/lithium-codegen-x87.cc |
@@ -201,6 +201,13 @@ void LCodeGen::GenerateOsrPrologue() { |
osr_pc_offset_ = masm()->pc_offset(); |
+ // Interpreter is the first tier compiler now. It will run the code generated |
+ // by TurboFan compiler which will always put "1" on x87 FPU stack. |
+ // This behavior will affect crankshaft's x87 FPU stack depth check under |
+ // debug mode. |
+ // Need to reset the FPU stack here for this scenario. |
+ __ fninit(); |
+ |
// Adjust the frame size, subsuming the unoptimized frame into the |
// optimized frame. |
int slots = GetStackSlotCount() - graph()->osr()->UnoptimizedFrameSlots(); |