| 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 2763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2774 __ jmp(&heapnumber_allocated); | 2774 __ jmp(&heapnumber_allocated); |
| 2775 | 2775 |
| 2776 __ bind(&slow_allocate_heapnumber); | 2776 __ bind(&slow_allocate_heapnumber); |
| 2777 // Allocate a heap number. | 2777 // Allocate a heap number. |
| 2778 __ CallRuntime(Runtime::kNumberAlloc, 0); | 2778 __ CallRuntime(Runtime::kNumberAlloc, 0); |
| 2779 __ mov(edi, eax); | 2779 __ mov(edi, eax); |
| 2780 | 2780 |
| 2781 __ bind(&heapnumber_allocated); | 2781 __ bind(&heapnumber_allocated); |
| 2782 | 2782 |
| 2783 __ PrepareCallCFunction(1, ebx); | 2783 __ PrepareCallCFunction(1, ebx); |
| 2784 __ mov(Operand(esp, 0), Immediate(ExternalReference::isolate_address())); | 2784 __ mov(eax, ContextOperand(context_register(), Context::GLOBAL_INDEX)); |
| 2785 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), | 2785 __ mov(eax, FieldOperand(eax, GlobalObject::kGlobalContextOffset)); |
| 2786 1); | 2786 __ mov(Operand(esp, 0), eax); |
| 2787 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1); |
| 2787 | 2788 |
| 2788 // Convert 32 random bits in eax to 0.(32 random bits) in a double | 2789 // Convert 32 random bits in eax to 0.(32 random bits) in a double |
| 2789 // by computing: | 2790 // by computing: |
| 2790 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). | 2791 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). |
| 2791 // This is implemented on both SSE2 and FPU. | 2792 // This is implemented on both SSE2 and FPU. |
| 2792 if (CpuFeatures::IsSupported(SSE2)) { | 2793 if (CpuFeatures::IsSupported(SSE2)) { |
| 2793 CpuFeatures::Scope fscope(SSE2); | 2794 CpuFeatures::Scope fscope(SSE2); |
| 2794 __ mov(ebx, Immediate(0x49800000)); // 1.0 x 2^20 as single. | 2795 __ mov(ebx, Immediate(0x49800000)); // 1.0 x 2^20 as single. |
| 2795 __ movd(xmm1, ebx); | 2796 __ movd(xmm1, ebx); |
| 2796 __ movd(xmm0, eax); | 2797 __ movd(xmm0, eax); |
| (...skipping 1546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4343 *context_length = 0; | 4344 *context_length = 0; |
| 4344 return previous_; | 4345 return previous_; |
| 4345 } | 4346 } |
| 4346 | 4347 |
| 4347 | 4348 |
| 4348 #undef __ | 4349 #undef __ |
| 4349 | 4350 |
| 4350 } } // namespace v8::internal | 4351 } } // namespace v8::internal |
| 4351 | 4352 |
| 4352 #endif // V8_TARGET_ARCH_IA32 | 4353 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |