| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 2976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2987 __ mov(eax, ContextOperand(context_register(), Context::GLOBAL_OBJECT_INDEX)); | 2987 __ mov(eax, ContextOperand(context_register(), Context::GLOBAL_OBJECT_INDEX)); |
| 2988 __ mov(eax, FieldOperand(eax, GlobalObject::kNativeContextOffset)); | 2988 __ mov(eax, FieldOperand(eax, GlobalObject::kNativeContextOffset)); |
| 2989 __ mov(Operand(esp, 0), eax); | 2989 __ mov(Operand(esp, 0), eax); |
| 2990 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1); | 2990 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1); |
| 2991 | 2991 |
| 2992 // Convert 32 random bits in eax to 0.(32 random bits) in a double | 2992 // Convert 32 random bits in eax to 0.(32 random bits) in a double |
| 2993 // by computing: | 2993 // by computing: |
| 2994 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). | 2994 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). |
| 2995 // This is implemented on both SSE2 and FPU. | 2995 // This is implemented on both SSE2 and FPU. |
| 2996 if (CpuFeatures::IsSupported(SSE2)) { | 2996 if (CpuFeatures::IsSupported(SSE2)) { |
| 2997 CpuFeatures::Scope fscope(SSE2); | 2997 CpuFeatureScope fscope(masm(), SSE2); |
| 2998 __ mov(ebx, Immediate(0x49800000)); // 1.0 x 2^20 as single. | 2998 __ mov(ebx, Immediate(0x49800000)); // 1.0 x 2^20 as single. |
| 2999 __ movd(xmm1, ebx); | 2999 __ movd(xmm1, ebx); |
| 3000 __ movd(xmm0, eax); | 3000 __ movd(xmm0, eax); |
| 3001 __ cvtss2sd(xmm1, xmm1); | 3001 __ cvtss2sd(xmm1, xmm1); |
| 3002 __ xorps(xmm0, xmm1); | 3002 __ xorps(xmm0, xmm1); |
| 3003 __ subsd(xmm0, xmm1); | 3003 __ subsd(xmm0, xmm1); |
| 3004 __ movdbl(FieldOperand(edi, HeapNumber::kValueOffset), xmm0); | 3004 __ movdbl(FieldOperand(edi, HeapNumber::kValueOffset), xmm0); |
| 3005 } else { | 3005 } else { |
| 3006 // 0x4130000000000000 is 1.0 x 2^20 as a double. | 3006 // 0x4130000000000000 is 1.0 x 2^20 as a double. |
| 3007 __ mov(FieldOperand(edi, HeapNumber::kExponentOffset), | 3007 __ mov(FieldOperand(edi, HeapNumber::kExponentOffset), |
| (...skipping 1565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4573 *stack_depth = 0; | 4573 *stack_depth = 0; |
| 4574 *context_length = 0; | 4574 *context_length = 0; |
| 4575 return previous_; | 4575 return previous_; |
| 4576 } | 4576 } |
| 4577 | 4577 |
| 4578 #undef __ | 4578 #undef __ |
| 4579 | 4579 |
| 4580 } } // namespace v8::internal | 4580 } } // namespace v8::internal |
| 4581 | 4581 |
| 4582 #endif // V8_TARGET_ARCH_IA32 | 4582 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |