| Index: src/ia32/code-stubs-ia32.cc
|
| ===================================================================
|
| --- src/ia32/code-stubs-ia32.cc (revision 7030)
|
| +++ src/ia32/code-stubs-ia32.cc (working copy)
|
| @@ -39,6 +39,28 @@
|
| namespace internal {
|
|
|
| #define __ ACCESS_MASM(masm)
|
| +
|
| +void ToNumberStub::Generate(MacroAssembler* masm) {
|
| + // The ToNumber stub takes one argument in eax.
|
| + NearLabel check_heap_number, call_builtin;
|
| + __ test(eax, Immediate(kSmiTagMask));
|
| + __ j(not_zero, &check_heap_number);
|
| + __ ret(0);
|
| +
|
| + __ bind(&check_heap_number);
|
| + __ mov(ebx, FieldOperand(eax, HeapObject::kMapOffset));
|
| + __ cmp(Operand(ebx), Immediate(FACTORY->heap_number_map()));
|
| + __ j(not_equal, &call_builtin);
|
| + __ ret(0);
|
| +
|
| + __ bind(&call_builtin);
|
| + __ pop(ecx); // Pop return address.
|
| + __ push(eax);
|
| + __ push(ecx); // Push return address.
|
| + __ InvokeBuiltin(Builtins::TO_NUMBER, JUMP_FUNCTION);
|
| +}
|
| +
|
| +
|
| void FastNewClosureStub::Generate(MacroAssembler* masm) {
|
| // Create a new closure from the given function info in new
|
| // space. Set the context to the current context in esi.
|
| @@ -3483,10 +3505,12 @@
|
| __ j(not_equal, ¬_minus_half);
|
|
|
| // Calculates reciprocal of square root.
|
| - // Note that 1/sqrt(x) = sqrt(1/x))
|
| - __ divsd(xmm3, xmm0);
|
| + // sqrtsd returns -0 when input is -0. ECMA spec requires +0.
|
| + __ xorpd(xmm1, xmm1);
|
| + __ addsd(xmm1, xmm0);
|
| + __ sqrtsd(xmm1, xmm1);
|
| + __ divsd(xmm3, xmm1);
|
| __ movsd(xmm1, xmm3);
|
| - __ sqrtsd(xmm1, xmm1);
|
| __ jmp(&allocate_return);
|
|
|
| // Test for 0.5.
|
| @@ -3498,7 +3522,9 @@
|
| __ ucomisd(xmm2, xmm1);
|
| __ j(not_equal, &call_runtime);
|
| // Calculates square root.
|
| - __ movsd(xmm1, xmm0);
|
| + // sqrtsd returns -0 when input is -0. ECMA spec requires +0.
|
| + __ xorpd(xmm1, xmm1);
|
| + __ addsd(xmm1, xmm0);
|
| __ sqrtsd(xmm1, xmm1);
|
|
|
| __ bind(&allocate_return);
|
|
|