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 6420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6431 | 6431 |
6432 __ bind(&slow_allocate_heapnumber); | 6432 __ bind(&slow_allocate_heapnumber); |
6433 // Allocate a heap number. | 6433 // Allocate a heap number. |
6434 __ CallRuntime(Runtime::kNumberAlloc, 0); | 6434 __ CallRuntime(Runtime::kNumberAlloc, 0); |
6435 __ movq(rbx, rax); | 6435 __ movq(rbx, rax); |
6436 | 6436 |
6437 __ bind(&heapnumber_allocated); | 6437 __ bind(&heapnumber_allocated); |
6438 | 6438 |
6439 // Return a random uint32 number in rax. | 6439 // Return a random uint32 number in rax. |
6440 // The fresh HeapNumber is in rbx, which is callee-save on both x64 ABIs. | 6440 // The fresh HeapNumber is in rbx, which is callee-save on both x64 ABIs. |
6441 __ PrepareCallCFunction(0); | 6441 __ PrepareCallCFunction(1); |
6442 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 0); | 6442 #ifdef _WIN64 |
| 6443 __ LoadAddress(rcx, ExternalReference::isolate_address()); |
| 6444 #else |
| 6445 __ LoadAddress(rdi, ExternalReference::isolate_address()); |
| 6446 #endif |
| 6447 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1); |
6443 | 6448 |
6444 // Convert 32 random bits in rax to 0.(32 random bits) in a double | 6449 // Convert 32 random bits in rax to 0.(32 random bits) in a double |
6445 // by computing: | 6450 // by computing: |
6446 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). | 6451 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). |
6447 __ movl(rcx, Immediate(0x49800000)); // 1.0 x 2^20 as single. | 6452 __ movl(rcx, Immediate(0x49800000)); // 1.0 x 2^20 as single. |
6448 __ movd(xmm1, rcx); | 6453 __ movd(xmm1, rcx); |
6449 __ movd(xmm0, rax); | 6454 __ movd(xmm0, rax); |
6450 __ cvtss2sd(xmm1, xmm1); | 6455 __ cvtss2sd(xmm1, xmm1); |
6451 __ xorpd(xmm0, xmm1); | 6456 __ xorpd(xmm0, xmm1); |
6452 __ subsd(xmm0, xmm1); | 6457 __ subsd(xmm0, xmm1); |
(...skipping 2376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8829 } | 8834 } |
8830 | 8835 |
8831 #endif | 8836 #endif |
8832 | 8837 |
8833 | 8838 |
8834 #undef __ | 8839 #undef __ |
8835 | 8840 |
8836 } } // namespace v8::internal | 8841 } } // namespace v8::internal |
8837 | 8842 |
8838 #endif // V8_TARGET_ARCH_X64 | 8843 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |