Set the FPU precision control to double-precision.
The default double precision control of FPU is extended double-precision. While the number definition for JavaScript is double-precision. We use the FPU control word to set the doulbe precision and replace the original solution which store the data to memory and load it again. This patch also fixes the error that Sunspider 1.0.2 can not run with V8 if sse2 support is disabled. BUG= R=weiliang.lin@intel.com Review URL: https://codereview.chromium.org/700053003 Patch from Chunyang Dai <chunyang.dai@intel.com>. Cr-Commit-Position: refs/heads/master@{#25125} git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@25125 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
c12a127fae
commit
813b071b30
@ -2272,6 +2272,8 @@ void LCodeGen::DoArithmeticD(LArithmeticD* instr) {
|
|||||||
if (instr->op() != Token::MOD) {
|
if (instr->op() != Token::MOD) {
|
||||||
X87PrepareBinaryOp(left, right, result);
|
X87PrepareBinaryOp(left, right, result);
|
||||||
}
|
}
|
||||||
|
// Set the precision control to double-precision.
|
||||||
|
__ X87SetFPUCW(0x027F);
|
||||||
switch (instr->op()) {
|
switch (instr->op()) {
|
||||||
case Token::ADD:
|
case Token::ADD:
|
||||||
__ fadd_i(1);
|
__ fadd_i(1);
|
||||||
@ -2306,12 +2308,8 @@ void LCodeGen::DoArithmeticD(LArithmeticD* instr) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only always explicitly storing to memory to force the round-down for double
|
// Restore the default value of control word.
|
||||||
// arithmetic.
|
__ X87SetFPUCW(0x037F);
|
||||||
__ lea(esp, Operand(esp, -kDoubleSize));
|
|
||||||
__ fstp_d(Operand(esp, 0));
|
|
||||||
__ fld_d(Operand(esp, 0));
|
|
||||||
__ lea(esp, Operand(esp, kDoubleSize));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -767,6 +767,13 @@ void MacroAssembler::X87SetRC(int rc) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MacroAssembler::X87SetFPUCW(int cw) {
|
||||||
|
push(Immediate(cw));
|
||||||
|
fldcw(MemOperand(esp, 0));
|
||||||
|
add(esp, Immediate(kPointerSize));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void MacroAssembler::AssertNumber(Register object) {
|
void MacroAssembler::AssertNumber(Register object) {
|
||||||
if (emit_debug_code()) {
|
if (emit_debug_code()) {
|
||||||
Label ok;
|
Label ok;
|
||||||
|
@ -425,6 +425,7 @@ class MacroAssembler: public Assembler {
|
|||||||
void FXamSign();
|
void FXamSign();
|
||||||
void X87CheckIA();
|
void X87CheckIA();
|
||||||
void X87SetRC(int rc);
|
void X87SetRC(int rc);
|
||||||
|
void X87SetFPUCW(int cw);
|
||||||
|
|
||||||
void ClampUint8(Register reg);
|
void ClampUint8(Register reg);
|
||||||
void ClampTOSToUint8(Register result_reg);
|
void ClampTOSToUint8(Register result_reg);
|
||||||
|
Loading…
Reference in New Issue
Block a user