if (instr->op() != Token::MOD) {
X87PrepareBinaryOp(left, right, result);
}
+ // Set the precision control to double-precision.
+ __ X87SetFPUCW(0x027F);
switch (instr->op()) {
case Token::ADD:
__ fadd_i(1);
break;
}
- // Only always explicitly storing to memory to force the round-down for double
- // arithmetic.
- __ lea(esp, Operand(esp, -kDoubleSize));
- __ fstp_d(Operand(esp, 0));
- __ fld_d(Operand(esp, 0));
- __ lea(esp, Operand(esp, kDoubleSize));
+ // Restore the default value of control word.
+ __ X87SetFPUCW(0x037F);
}
}
+void MacroAssembler::X87SetFPUCW(int cw) {
+ push(Immediate(cw));
+ fldcw(MemOperand(esp, 0));
+ add(esp, Immediate(kPointerSize));
+}
+
+
void MacroAssembler::AssertNumber(Register object) {
if (emit_debug_code()) {
Label ok;