| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 6952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6963 // Test for -0.5. | 6963 // Test for -0.5. |
| 6964 // Load xmm2 with -0.5. | 6964 // Load xmm2 with -0.5. |
| 6965 __ movl(answer.reg(), Immediate(0xBF000000)); | 6965 __ movl(answer.reg(), Immediate(0xBF000000)); |
| 6966 __ movd(xmm2, answer.reg()); | 6966 __ movd(xmm2, answer.reg()); |
| 6967 __ cvtss2sd(xmm2, xmm2); | 6967 __ cvtss2sd(xmm2, xmm2); |
| 6968 // xmm2 now has -0.5. | 6968 // xmm2 now has -0.5. |
| 6969 __ ucomisd(xmm2, xmm1); | 6969 __ ucomisd(xmm2, xmm1); |
| 6970 __ j(not_equal, ¬_minus_half); | 6970 __ j(not_equal, ¬_minus_half); |
| 6971 | 6971 |
| 6972 // Calculates reciprocal of square root. | 6972 // Calculates reciprocal of square root. |
| 6973 // Note that 1/sqrt(x) = sqrt(1/x)) | 6973 // sqrtsd returns -0 when input is -0. ECMA spec requires +0. |
| 6974 __ divsd(xmm3, xmm0); | 6974 __ xorpd(xmm1, xmm1); |
| 6975 __ addsd(xmm1, xmm0); |
| 6976 __ sqrtsd(xmm1, xmm1); |
| 6977 __ divsd(xmm3, xmm1); |
| 6975 __ movsd(xmm1, xmm3); | 6978 __ movsd(xmm1, xmm3); |
| 6976 __ sqrtsd(xmm1, xmm1); | |
| 6977 __ jmp(&allocate_return); | 6979 __ jmp(&allocate_return); |
| 6978 | 6980 |
| 6979 // Test for 0.5. | 6981 // Test for 0.5. |
| 6980 __ bind(¬_minus_half); | 6982 __ bind(¬_minus_half); |
| 6981 // Load xmm2 with 0.5. | 6983 // Load xmm2 with 0.5. |
| 6982 // Since xmm3 is 1 and xmm2 is -0.5 this is simply xmm2 + xmm3. | 6984 // Since xmm3 is 1 and xmm2 is -0.5 this is simply xmm2 + xmm3. |
| 6983 __ addsd(xmm2, xmm3); | 6985 __ addsd(xmm2, xmm3); |
| 6984 // xmm2 now has 0.5. | 6986 // xmm2 now has 0.5. |
| 6985 __ ucomisd(xmm2, xmm1); | 6987 __ ucomisd(xmm2, xmm1); |
| 6986 call_runtime.Branch(not_equal); | 6988 call_runtime.Branch(not_equal); |
| 6987 | 6989 |
| 6988 // Calculates square root. | 6990 // Calculates square root. |
| 6989 __ movsd(xmm1, xmm0); | 6991 // sqrtsd returns -0 when input is -0. ECMA spec requires +0. |
| 6992 __ xorpd(xmm1, xmm1); |
| 6993 __ addsd(xmm1, xmm0); |
| 6990 __ sqrtsd(xmm1, xmm1); | 6994 __ sqrtsd(xmm1, xmm1); |
| 6991 | 6995 |
| 6992 JumpTarget done; | 6996 JumpTarget done; |
| 6993 Label failure, success; | 6997 Label failure, success; |
| 6994 __ bind(&allocate_return); | 6998 __ bind(&allocate_return); |
| 6995 // Make a copy of the frame to enable us to handle allocation | 6999 // Make a copy of the frame to enable us to handle allocation |
| 6996 // failure after the JumpTarget jump. | 7000 // failure after the JumpTarget jump. |
| 6997 VirtualFrame* clone = new VirtualFrame(frame()); | 7001 VirtualFrame* clone = new VirtualFrame(frame()); |
| 6998 __ AllocateHeapNumber(answer.reg(), exponent.reg(), &failure); | 7002 __ AllocateHeapNumber(answer.reg(), exponent.reg(), &failure); |
| 6999 __ movsd(FieldOperand(answer.reg(), HeapNumber::kValueOffset), xmm1); | 7003 __ movsd(FieldOperand(answer.reg(), HeapNumber::kValueOffset), xmm1); |
| (...skipping 1802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8802 } | 8806 } |
| 8803 | 8807 |
| 8804 #endif | 8808 #endif |
| 8805 | 8809 |
| 8806 | 8810 |
| 8807 #undef __ | 8811 #undef __ |
| 8808 | 8812 |
| 8809 } } // namespace v8::internal | 8813 } } // namespace v8::internal |
| 8810 | 8814 |
| 8811 #endif // V8_TARGET_ARCH_X64 | 8815 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |