| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 3459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3470 // Test for -0.5. | 3470 // Test for -0.5. |
| 3471 // Load xmm2 with -0.5. | 3471 // Load xmm2 with -0.5. |
| 3472 __ mov(ecx, Immediate(0xBF000000)); | 3472 __ mov(ecx, Immediate(0xBF000000)); |
| 3473 __ movd(xmm2, Operand(ecx)); | 3473 __ movd(xmm2, Operand(ecx)); |
| 3474 __ cvtss2sd(xmm2, xmm2); | 3474 __ cvtss2sd(xmm2, xmm2); |
| 3475 // xmm2 now has -0.5. | 3475 // xmm2 now has -0.5. |
| 3476 __ ucomisd(xmm2, xmm1); | 3476 __ ucomisd(xmm2, xmm1); |
| 3477 __ j(not_equal, ¬_minus_half); | 3477 __ j(not_equal, ¬_minus_half); |
| 3478 | 3478 |
| 3479 // Calculates reciprocal of square root. | 3479 // Calculates reciprocal of square root. |
| 3480 // Note that 1/sqrt(x) = sqrt(1/x)) | 3480 // sqrtsd returns -0 when input is -0. ECMA spec requires +0. |
| 3481 __ divsd(xmm3, xmm0); | 3481 __ xorpd(xmm1, xmm1); |
| 3482 __ addsd(xmm1, xmm0); |
| 3483 __ sqrtsd(xmm1, xmm1); |
| 3484 __ divsd(xmm3, xmm1); |
| 3482 __ movsd(xmm1, xmm3); | 3485 __ movsd(xmm1, xmm3); |
| 3483 __ sqrtsd(xmm1, xmm1); | |
| 3484 __ jmp(&allocate_return); | 3486 __ jmp(&allocate_return); |
| 3485 | 3487 |
| 3486 // Test for 0.5. | 3488 // Test for 0.5. |
| 3487 __ bind(¬_minus_half); | 3489 __ bind(¬_minus_half); |
| 3488 // Load xmm2 with 0.5. | 3490 // Load xmm2 with 0.5. |
| 3489 // Since xmm3 is 1 and xmm2 is -0.5 this is simply xmm2 + xmm3. | 3491 // Since xmm3 is 1 and xmm2 is -0.5 this is simply xmm2 + xmm3. |
| 3490 __ addsd(xmm2, xmm3); | 3492 __ addsd(xmm2, xmm3); |
| 3491 // xmm2 now has 0.5. | 3493 // xmm2 now has 0.5. |
| 3492 __ ucomisd(xmm2, xmm1); | 3494 __ ucomisd(xmm2, xmm1); |
| 3493 __ j(not_equal, &call_runtime); | 3495 __ j(not_equal, &call_runtime); |
| 3494 // Calculates square root. | 3496 // Calculates square root. |
| 3495 __ movsd(xmm1, xmm0); | 3497 // sqrtsd returns -0 when input is -0. ECMA spec requires +0. |
| 3498 __ xorpd(xmm1, xmm1); |
| 3499 __ addsd(xmm1, xmm0); |
| 3496 __ sqrtsd(xmm1, xmm1); | 3500 __ sqrtsd(xmm1, xmm1); |
| 3497 | 3501 |
| 3498 __ bind(&allocate_return); | 3502 __ bind(&allocate_return); |
| 3499 __ AllocateHeapNumber(ecx, eax, edx, &call_runtime); | 3503 __ AllocateHeapNumber(ecx, eax, edx, &call_runtime); |
| 3500 __ movdbl(FieldOperand(ecx, HeapNumber::kValueOffset), xmm1); | 3504 __ movdbl(FieldOperand(ecx, HeapNumber::kValueOffset), xmm1); |
| 3501 __ mov(eax, ecx); | 3505 __ mov(eax, ecx); |
| 3502 __ ret(2); | 3506 __ ret(2); |
| 3503 | 3507 |
| 3504 __ bind(&call_runtime); | 3508 __ bind(&call_runtime); |
| 3505 __ TailCallRuntime(Runtime::kMath_pow_cfunction, 2, 1); | 3509 __ TailCallRuntime(Runtime::kMath_pow_cfunction, 2, 1); |
| (...skipping 2977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6483 // Do a tail call to the rewritten stub. | 6487 // Do a tail call to the rewritten stub. |
| 6484 __ jmp(Operand(edi)); | 6488 __ jmp(Operand(edi)); |
| 6485 } | 6489 } |
| 6486 | 6490 |
| 6487 | 6491 |
| 6488 #undef __ | 6492 #undef __ |
| 6489 | 6493 |
| 6490 } } // namespace v8::internal | 6494 } } // namespace v8::internal |
| 6491 | 6495 |
| 6492 #endif // V8_TARGET_ARCH_IA32 | 6496 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |