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 2675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2686 | 2686 |
2687 __ bind(&slow_allocate_heapnumber); | 2687 __ bind(&slow_allocate_heapnumber); |
2688 // Allocate a heap number. | 2688 // Allocate a heap number. |
2689 __ CallRuntime(Runtime::kNumberAlloc, 0); | 2689 __ CallRuntime(Runtime::kNumberAlloc, 0); |
2690 __ movq(rbx, rax); | 2690 __ movq(rbx, rax); |
2691 | 2691 |
2692 __ bind(&heapnumber_allocated); | 2692 __ bind(&heapnumber_allocated); |
2693 | 2693 |
2694 // Return a random uint32 number in rax. | 2694 // Return a random uint32 number in rax. |
2695 // The fresh HeapNumber is in rbx, which is callee-save on both x64 ABIs. | 2695 // The fresh HeapNumber is in rbx, which is callee-save on both x64 ABIs. |
2696 __ PrepareCallCFunction(0); | 2696 __ PrepareCallCFunction(1); |
2697 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 0); | 2697 #ifdef _WIN64 |
| 2698 __ LoadAddress(rcx, ExternalReference::isolate_address()); |
| 2699 #else |
| 2700 __ LoadAddress(rdi, ExternalReference::isolate_address()); |
| 2701 #endif |
| 2702 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1); |
2698 | 2703 |
2699 // Convert 32 random bits in rax to 0.(32 random bits) in a double | 2704 // Convert 32 random bits in rax to 0.(32 random bits) in a double |
2700 // by computing: | 2705 // by computing: |
2701 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). | 2706 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). |
2702 __ movl(rcx, Immediate(0x49800000)); // 1.0 x 2^20 as single. | 2707 __ movl(rcx, Immediate(0x49800000)); // 1.0 x 2^20 as single. |
2703 __ movd(xmm1, rcx); | 2708 __ movd(xmm1, rcx); |
2704 __ movd(xmm0, rax); | 2709 __ movd(xmm0, rax); |
2705 __ cvtss2sd(xmm1, xmm1); | 2710 __ cvtss2sd(xmm1, xmm1); |
2706 __ xorpd(xmm0, xmm1); | 2711 __ xorpd(xmm0, xmm1); |
2707 __ subsd(xmm0, xmm1); | 2712 __ subsd(xmm0, xmm1); |
(...skipping 1563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4271 __ ret(0); | 4276 __ ret(0); |
4272 } | 4277 } |
4273 | 4278 |
4274 | 4279 |
4275 #undef __ | 4280 #undef __ |
4276 | 4281 |
4277 | 4282 |
4278 } } // namespace v8::internal | 4283 } } // namespace v8::internal |
4279 | 4284 |
4280 #endif // V8_TARGET_ARCH_X64 | 4285 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |