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 2776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2787 // Convert 32 random bits in eax to 0.(32 random bits) in a double | 2787 // Convert 32 random bits in eax to 0.(32 random bits) in a double |
2788 // by computing: | 2788 // by computing: |
2789 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). | 2789 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). |
2790 // This is implemented on both SSE2 and FPU. | 2790 // This is implemented on both SSE2 and FPU. |
2791 if (CpuFeatures::IsSupported(SSE2)) { | 2791 if (CpuFeatures::IsSupported(SSE2)) { |
2792 CpuFeatures::Scope fscope(SSE2); | 2792 CpuFeatures::Scope fscope(SSE2); |
2793 __ mov(ebx, Immediate(0x49800000)); // 1.0 x 2^20 as single. | 2793 __ mov(ebx, Immediate(0x49800000)); // 1.0 x 2^20 as single. |
2794 __ movd(xmm1, Operand(ebx)); | 2794 __ movd(xmm1, Operand(ebx)); |
2795 __ movd(xmm0, Operand(eax)); | 2795 __ movd(xmm0, Operand(eax)); |
2796 __ cvtss2sd(xmm1, xmm1); | 2796 __ cvtss2sd(xmm1, xmm1); |
2797 __ pxor(xmm0, xmm1); | 2797 __ xorps(xmm0, xmm1); |
2798 __ subsd(xmm0, xmm1); | 2798 __ subsd(xmm0, xmm1); |
2799 __ movdbl(FieldOperand(edi, HeapNumber::kValueOffset), xmm0); | 2799 __ movdbl(FieldOperand(edi, HeapNumber::kValueOffset), xmm0); |
2800 } else { | 2800 } else { |
2801 // 0x4130000000000000 is 1.0 x 2^20 as a double. | 2801 // 0x4130000000000000 is 1.0 x 2^20 as a double. |
2802 __ mov(FieldOperand(edi, HeapNumber::kExponentOffset), | 2802 __ mov(FieldOperand(edi, HeapNumber::kExponentOffset), |
2803 Immediate(0x41300000)); | 2803 Immediate(0x41300000)); |
2804 __ mov(FieldOperand(edi, HeapNumber::kMantissaOffset), eax); | 2804 __ mov(FieldOperand(edi, HeapNumber::kMantissaOffset), eax); |
2805 __ fld_d(FieldOperand(edi, HeapNumber::kValueOffset)); | 2805 __ fld_d(FieldOperand(edi, HeapNumber::kValueOffset)); |
2806 __ mov(FieldOperand(edi, HeapNumber::kMantissaOffset), Immediate(0)); | 2806 __ mov(FieldOperand(edi, HeapNumber::kMantissaOffset), Immediate(0)); |
2807 __ fld_d(FieldOperand(edi, HeapNumber::kValueOffset)); | 2807 __ fld_d(FieldOperand(edi, HeapNumber::kValueOffset)); |
(...skipping 1510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4318 // And return. | 4318 // And return. |
4319 __ ret(0); | 4319 __ ret(0); |
4320 } | 4320 } |
4321 | 4321 |
4322 | 4322 |
4323 #undef __ | 4323 #undef __ |
4324 | 4324 |
4325 } } // namespace v8::internal | 4325 } } // namespace v8::internal |
4326 | 4326 |
4327 #endif // V8_TARGET_ARCH_IA32 | 4327 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |