| 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 6402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6413 | 6413 |
| 6414 __ bind(&slow_allocate_heapnumber); | 6414 __ bind(&slow_allocate_heapnumber); |
| 6415 // Allocate a heap number. | 6415 // Allocate a heap number. |
| 6416 __ CallRuntime(Runtime::kNumberAlloc, 0); | 6416 __ CallRuntime(Runtime::kNumberAlloc, 0); |
| 6417 __ movq(rbx, rax); | 6417 __ movq(rbx, rax); |
| 6418 | 6418 |
| 6419 __ bind(&heapnumber_allocated); | 6419 __ bind(&heapnumber_allocated); |
| 6420 | 6420 |
| 6421 // Return a random uint32 number in rax. | 6421 // Return a random uint32 number in rax. |
| 6422 // The fresh HeapNumber is in rbx, which is callee-save on both x64 ABIs. | 6422 // The fresh HeapNumber is in rbx, which is callee-save on both x64 ABIs. |
| 6423 __ PrepareCallCFunction(1); | 6423 __ PrepareCallCFunction(0); |
| 6424 #ifdef _WIN64 | 6424 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 0); |
| 6425 __ LoadAddress(rcx, ExternalReference::isolate_address()); | |
| 6426 #else | |
| 6427 __ LoadAddress(rdi, ExternalReference::isolate_address()); | |
| 6428 #endif | |
| 6429 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1); | |
| 6430 | 6425 |
| 6431 // Convert 32 random bits in rax to 0.(32 random bits) in a double | 6426 // Convert 32 random bits in rax to 0.(32 random bits) in a double |
| 6432 // by computing: | 6427 // by computing: |
| 6433 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). | 6428 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). |
| 6434 __ movl(rcx, Immediate(0x49800000)); // 1.0 x 2^20 as single. | 6429 __ movl(rcx, Immediate(0x49800000)); // 1.0 x 2^20 as single. |
| 6435 __ movd(xmm1, rcx); | 6430 __ movd(xmm1, rcx); |
| 6436 __ movd(xmm0, rax); | 6431 __ movd(xmm0, rax); |
| 6437 __ cvtss2sd(xmm1, xmm1); | 6432 __ cvtss2sd(xmm1, xmm1); |
| 6438 __ xorpd(xmm0, xmm1); | 6433 __ xorpd(xmm0, xmm1); |
| 6439 __ subsd(xmm0, xmm1); | 6434 __ subsd(xmm0, xmm1); |
| (...skipping 2290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8730 | 8725 |
| 8731 #ifdef _WIN64 | 8726 #ifdef _WIN64 |
| 8732 typedef double (*ModuloFunction)(double, double); | 8727 typedef double (*ModuloFunction)(double, double); |
| 8733 // Define custom fmod implementation. | 8728 // Define custom fmod implementation. |
| 8734 ModuloFunction CreateModuloFunction() { | 8729 ModuloFunction CreateModuloFunction() { |
| 8735 size_t actual_size; | 8730 size_t actual_size; |
| 8736 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, | 8731 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, |
| 8737 &actual_size, | 8732 &actual_size, |
| 8738 true)); | 8733 true)); |
| 8739 CHECK(buffer); | 8734 CHECK(buffer); |
| 8740 Assembler masm(NULL, buffer, static_cast<int>(actual_size)); | 8735 Assembler masm(buffer, static_cast<int>(actual_size)); |
| 8741 // Generated code is put into a fixed, unmovable, buffer, and not into | 8736 // Generated code is put into a fixed, unmovable, buffer, and not into |
| 8742 // the V8 heap. We can't, and don't, refer to any relocatable addresses | 8737 // the V8 heap. We can't, and don't, refer to any relocatable addresses |
| 8743 // (e.g. the JavaScript nan-object). | 8738 // (e.g. the JavaScript nan-object). |
| 8744 | 8739 |
| 8745 // Windows 64 ABI passes double arguments in xmm0, xmm1 and | 8740 // Windows 64 ABI passes double arguments in xmm0, xmm1 and |
| 8746 // returns result in xmm0. | 8741 // returns result in xmm0. |
| 8747 // Argument backing space is allocated on the stack above | 8742 // Argument backing space is allocated on the stack above |
| 8748 // the return address. | 8743 // the return address. |
| 8749 | 8744 |
| 8750 // Compute x mod y. | 8745 // Compute x mod y. |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8816 } | 8811 } |
| 8817 | 8812 |
| 8818 #endif | 8813 #endif |
| 8819 | 8814 |
| 8820 | 8815 |
| 8821 #undef __ | 8816 #undef __ |
| 8822 | 8817 |
| 8823 } } // namespace v8::internal | 8818 } } // namespace v8::internal |
| 8824 | 8819 |
| 8825 #endif // V8_TARGET_ARCH_X64 | 8820 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |