| 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 2699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2710 __ AllocateHeapNumber(edi, ebx, ecx, &slow_allocate_heapnumber); | 2710 __ AllocateHeapNumber(edi, ebx, ecx, &slow_allocate_heapnumber); |
| 2711 __ jmp(&heapnumber_allocated); | 2711 __ jmp(&heapnumber_allocated); |
| 2712 | 2712 |
| 2713 __ bind(&slow_allocate_heapnumber); | 2713 __ bind(&slow_allocate_heapnumber); |
| 2714 // Allocate a heap number. | 2714 // Allocate a heap number. |
| 2715 __ CallRuntime(Runtime::kNumberAlloc, 0); | 2715 __ CallRuntime(Runtime::kNumberAlloc, 0); |
| 2716 __ mov(edi, eax); | 2716 __ mov(edi, eax); |
| 2717 | 2717 |
| 2718 __ bind(&heapnumber_allocated); | 2718 __ bind(&heapnumber_allocated); |
| 2719 | 2719 |
| 2720 __ PrepareCallCFunction(0, ebx); | 2720 __ PrepareCallCFunction(1, ebx); |
| 2721 __ mov(Operand(esp, 0), Immediate(ExternalReference::isolate_address())); |
| 2721 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), | 2722 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), |
| 2722 0); | 2723 1); |
| 2723 | 2724 |
| 2724 // Convert 32 random bits in eax to 0.(32 random bits) in a double | 2725 // Convert 32 random bits in eax to 0.(32 random bits) in a double |
| 2725 // by computing: | 2726 // by computing: |
| 2726 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). | 2727 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). |
| 2727 // This is implemented on both SSE2 and FPU. | 2728 // This is implemented on both SSE2 and FPU. |
| 2728 if (isolate()->cpu_features()->IsSupported(SSE2)) { | 2729 if (isolate()->cpu_features()->IsSupported(SSE2)) { |
| 2729 CpuFeatures::Scope fscope(SSE2); | 2730 CpuFeatures::Scope fscope(SSE2); |
| 2730 __ mov(ebx, Immediate(0x49800000)); // 1.0 x 2^20 as single. | 2731 __ mov(ebx, Immediate(0x49800000)); // 1.0 x 2^20 as single. |
| 2731 __ movd(xmm1, Operand(ebx)); | 2732 __ movd(xmm1, Operand(ebx)); |
| 2732 __ movd(xmm0, Operand(eax)); | 2733 __ movd(xmm0, Operand(eax)); |
| (...skipping 1557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4290 // And return. | 4291 // And return. |
| 4291 __ ret(0); | 4292 __ ret(0); |
| 4292 } | 4293 } |
| 4293 | 4294 |
| 4294 | 4295 |
| 4295 #undef __ | 4296 #undef __ |
| 4296 | 4297 |
| 4297 } } // namespace v8::internal | 4298 } } // namespace v8::internal |
| 4298 | 4299 |
| 4299 #endif // V8_TARGET_ARCH_IA32 | 4300 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |