Commit da1f6926 authored by sgjesse@chromium.org's avatar sgjesse@chromium.org

Avoid trashing the FPSCR when calculating Math.floor

The restoring of FPSCR could restore a random value as the restore point could be jumped to from before FPSCR was loaded.
Review URL: http://codereview.chromium.org/6344002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6332 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 4e274ca1
...@@ -1952,7 +1952,7 @@ MaybeObject* CallStubCompiler::CompileMathFloorCall(Object* object, ...@@ -1952,7 +1952,7 @@ MaybeObject* CallStubCompiler::CompileMathFloorCall(Object* object,
__ cmp(r7, Operand(HeapNumber::kMantissaBits)); __ cmp(r7, Operand(HeapNumber::kMantissaBits));
// If greater or equal, the argument is already round and in r0. // If greater or equal, the argument is already round and in r0.
__ b(&restore_fpscr_and_return, ge); __ b(&restore_fpscr_and_return, ge);
__ b(&slow); __ b(&wont_fit_smi);
__ bind(&no_vfp_exception); __ bind(&no_vfp_exception);
// Move the result back to general purpose register r0. // Move the result back to general purpose register r0.
...@@ -1980,10 +1980,10 @@ MaybeObject* CallStubCompiler::CompileMathFloorCall(Object* object, ...@@ -1980,10 +1980,10 @@ MaybeObject* CallStubCompiler::CompileMathFloorCall(Object* object,
__ Ret(); __ Ret();
__ bind(&wont_fit_smi); __ bind(&wont_fit_smi);
__ bind(&slow);
// Restore FPCSR and fall to slow case. // Restore FPCSR and fall to slow case.
__ vmsr(r3); __ vmsr(r3);
__ bind(&slow);
// Tail call the full function. We do not have to patch the receiver // Tail call the full function. We do not have to patch the receiver
// because the function makes no use of it. // because the function makes no use of it.
__ InvokeFunction(function, arguments(), JUMP_FUNCTION); __ InvokeFunction(function, arguments(), JUMP_FUNCTION);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment