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 2862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2873 // Load xmm2 with -0.5. | 2873 // Load xmm2 with -0.5. |
2874 __ mov(ecx, Immediate(0xBF000000)); | 2874 __ mov(ecx, Immediate(0xBF000000)); |
2875 __ movd(xmm2, Operand(ecx)); | 2875 __ movd(xmm2, Operand(ecx)); |
2876 __ cvtss2sd(xmm2, xmm2); | 2876 __ cvtss2sd(xmm2, xmm2); |
2877 // xmm2 now has -0.5. | 2877 // xmm2 now has -0.5. |
2878 __ ucomisd(xmm2, xmm1); | 2878 __ ucomisd(xmm2, xmm1); |
2879 __ j(not_equal, ¬_minus_half); | 2879 __ j(not_equal, ¬_minus_half); |
2880 | 2880 |
2881 // Calculates reciprocal of square root. | 2881 // Calculates reciprocal of square root. |
2882 // sqrtsd returns -0 when input is -0. ECMA spec requires +0. | 2882 // sqrtsd returns -0 when input is -0. ECMA spec requires +0. |
2883 __ xorpd(xmm1, xmm1); | 2883 __ xorps(xmm1, xmm1); |
2884 __ addsd(xmm1, xmm0); | 2884 __ addsd(xmm1, xmm0); |
2885 __ sqrtsd(xmm1, xmm1); | 2885 __ sqrtsd(xmm1, xmm1); |
2886 __ divsd(xmm3, xmm1); | 2886 __ divsd(xmm3, xmm1); |
2887 __ movsd(xmm1, xmm3); | 2887 __ movsd(xmm1, xmm3); |
2888 __ jmp(&allocate_return); | 2888 __ jmp(&allocate_return); |
2889 | 2889 |
2890 // Test for 0.5. | 2890 // Test for 0.5. |
2891 __ bind(¬_minus_half); | 2891 __ bind(¬_minus_half); |
2892 // Load xmm2 with 0.5. | 2892 // Load xmm2 with 0.5. |
2893 // Since xmm3 is 1 and xmm2 is -0.5 this is simply xmm2 + xmm3. | 2893 // Since xmm3 is 1 and xmm2 is -0.5 this is simply xmm2 + xmm3. |
2894 __ addsd(xmm2, xmm3); | 2894 __ addsd(xmm2, xmm3); |
2895 // xmm2 now has 0.5. | 2895 // xmm2 now has 0.5. |
2896 __ ucomisd(xmm2, xmm1); | 2896 __ ucomisd(xmm2, xmm1); |
2897 __ j(not_equal, &call_runtime); | 2897 __ j(not_equal, &call_runtime); |
2898 // Calculates square root. | 2898 // Calculates square root. |
2899 // sqrtsd returns -0 when input is -0. ECMA spec requires +0. | 2899 // sqrtsd returns -0 when input is -0. ECMA spec requires +0. |
2900 __ xorpd(xmm1, xmm1); | 2900 __ xorps(xmm1, xmm1); |
2901 __ addsd(xmm1, xmm0); | 2901 __ addsd(xmm1, xmm0); |
2902 __ sqrtsd(xmm1, xmm1); | 2902 __ sqrtsd(xmm1, xmm1); |
2903 | 2903 |
2904 __ bind(&allocate_return); | 2904 __ bind(&allocate_return); |
2905 __ AllocateHeapNumber(ecx, eax, edx, &call_runtime); | 2905 __ AllocateHeapNumber(ecx, eax, edx, &call_runtime); |
2906 __ movdbl(FieldOperand(ecx, HeapNumber::kValueOffset), xmm1); | 2906 __ movdbl(FieldOperand(ecx, HeapNumber::kValueOffset), xmm1); |
2907 __ mov(eax, ecx); | 2907 __ mov(eax, ecx); |
2908 __ ret(2 * kPointerSize); | 2908 __ ret(2 * kPointerSize); |
2909 | 2909 |
2910 __ bind(&call_runtime); | 2910 __ bind(&call_runtime); |
(...skipping 2946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5857 // Do a tail call to the rewritten stub. | 5857 // Do a tail call to the rewritten stub. |
5858 __ jmp(Operand(edi)); | 5858 __ jmp(Operand(edi)); |
5859 } | 5859 } |
5860 | 5860 |
5861 | 5861 |
5862 #undef __ | 5862 #undef __ |
5863 | 5863 |
5864 } } // namespace v8::internal | 5864 } } // namespace v8::internal |
5865 | 5865 |
5866 #endif // V8_TARGET_ARCH_IA32 | 5866 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |