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 3481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3492 // Test for -0.5. | 3492 // Test for -0.5. |
3493 // Load xmm2 with -0.5. | 3493 // Load xmm2 with -0.5. |
3494 __ mov(ecx, Immediate(0xBF000000)); | 3494 __ mov(ecx, Immediate(0xBF000000)); |
3495 __ movd(xmm2, Operand(ecx)); | 3495 __ movd(xmm2, Operand(ecx)); |
3496 __ cvtss2sd(xmm2, xmm2); | 3496 __ cvtss2sd(xmm2, xmm2); |
3497 // xmm2 now has -0.5. | 3497 // xmm2 now has -0.5. |
3498 __ ucomisd(xmm2, xmm1); | 3498 __ ucomisd(xmm2, xmm1); |
3499 __ j(not_equal, ¬_minus_half); | 3499 __ j(not_equal, ¬_minus_half); |
3500 | 3500 |
3501 // Calculates reciprocal of square root. | 3501 // Calculates reciprocal of square root. |
3502 // Note that 1/sqrt(x) = sqrt(1/x)) | 3502 // sqrtsd returns -0 when input is -0. ECMA spec requires +0. |
3503 __ divsd(xmm3, xmm0); | 3503 __ xorpd(xmm1, xmm1); |
| 3504 __ addsd(xmm1, xmm0); |
| 3505 __ sqrtsd(xmm1, xmm1); |
| 3506 __ divsd(xmm3, xmm1); |
3504 __ movsd(xmm1, xmm3); | 3507 __ movsd(xmm1, xmm3); |
3505 __ sqrtsd(xmm1, xmm1); | |
3506 __ jmp(&allocate_return); | 3508 __ jmp(&allocate_return); |
3507 | 3509 |
3508 // Test for 0.5. | 3510 // Test for 0.5. |
3509 __ bind(¬_minus_half); | 3511 __ bind(¬_minus_half); |
3510 // Load xmm2 with 0.5. | 3512 // Load xmm2 with 0.5. |
3511 // Since xmm3 is 1 and xmm2 is -0.5 this is simply xmm2 + xmm3. | 3513 // Since xmm3 is 1 and xmm2 is -0.5 this is simply xmm2 + xmm3. |
3512 __ addsd(xmm2, xmm3); | 3514 __ addsd(xmm2, xmm3); |
3513 // xmm2 now has 0.5. | 3515 // xmm2 now has 0.5. |
3514 __ ucomisd(xmm2, xmm1); | 3516 __ ucomisd(xmm2, xmm1); |
3515 __ j(not_equal, &call_runtime); | 3517 __ j(not_equal, &call_runtime); |
3516 // Calculates square root. | 3518 // Calculates square root. |
3517 __ movsd(xmm1, xmm0); | 3519 // sqrtsd returns -0 when input is -0. ECMA spec requires +0. |
| 3520 __ xorpd(xmm1, xmm1); |
| 3521 __ addsd(xmm1, xmm0); |
3518 __ sqrtsd(xmm1, xmm1); | 3522 __ sqrtsd(xmm1, xmm1); |
3519 | 3523 |
3520 __ bind(&allocate_return); | 3524 __ bind(&allocate_return); |
3521 __ AllocateHeapNumber(ecx, eax, edx, &call_runtime); | 3525 __ AllocateHeapNumber(ecx, eax, edx, &call_runtime); |
3522 __ movdbl(FieldOperand(ecx, HeapNumber::kValueOffset), xmm1); | 3526 __ movdbl(FieldOperand(ecx, HeapNumber::kValueOffset), xmm1); |
3523 __ mov(eax, ecx); | 3527 __ mov(eax, ecx); |
3524 __ ret(2); | 3528 __ ret(2); |
3525 | 3529 |
3526 __ bind(&call_runtime); | 3530 __ bind(&call_runtime); |
3527 __ TailCallRuntime(Runtime::kMath_pow_cfunction, 2, 1); | 3531 __ TailCallRuntime(Runtime::kMath_pow_cfunction, 2, 1); |
(...skipping 2977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6505 // Do a tail call to the rewritten stub. | 6509 // Do a tail call to the rewritten stub. |
6506 __ jmp(Operand(edi)); | 6510 __ jmp(Operand(edi)); |
6507 } | 6511 } |
6508 | 6512 |
6509 | 6513 |
6510 #undef __ | 6514 #undef __ |
6511 | 6515 |
6512 } } // namespace v8::internal | 6516 } } // namespace v8::internal |
6513 | 6517 |
6514 #endif // V8_TARGET_ARCH_IA32 | 6518 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |