Index: src/compiler/x87/code-generator-x87.cc |
diff --git a/src/compiler/x87/code-generator-x87.cc b/src/compiler/x87/code-generator-x87.cc |
index 0b182d5c711cb14184ce3665c755a936a3c8a70b..b771df24453341fc8a11c5affd9e3cc38106f524 100644 |
--- a/src/compiler/x87/code-generator-x87.cc |
+++ b/src/compiler/x87/code-generator-x87.cc |
@@ -1499,12 +1499,16 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( |
__ TruncateX87TOSToI(i.OutputRegister(0)); |
__ test(i.OutputRegister(0), i.OutputRegister(0)); |
__ j(positive, &success); |
+ // Need to reserve the input float32 data. |
+ __ fld(0); |
__ push(Immediate(INT32_MIN)); |
__ fild_s(Operand(esp, 0)); |
__ lea(esp, Operand(esp, kPointerSize)); |
__ faddp(); |
__ TruncateX87TOSToI(i.OutputRegister(0)); |
__ or_(i.OutputRegister(0), Immediate(0x80000000)); |
+ // Only keep input float32 data in x87 stack when return. |
+ __ fstp(0); |
__ bind(&success); |
if (!instr->InputAt(0)->IsFPRegister()) { |
__ fstp(0); |