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