| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 4646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4657 ZoneList<Expression*>* args) { | 4657 ZoneList<Expression*>* args) { |
| 4658 ASSERT(args->length() == 0); | 4658 ASSERT(args->length() == 0); |
| 4659 frame_->SpillAll(); | 4659 frame_->SpillAll(); |
| 4660 | 4660 |
| 4661 Label slow_allocate_heapnumber; | 4661 Label slow_allocate_heapnumber; |
| 4662 Label heapnumber_allocated; | 4662 Label heapnumber_allocated; |
| 4663 __ AllocateHeapNumber(rbx, rcx, &slow_allocate_heapnumber); | 4663 __ AllocateHeapNumber(rbx, rcx, &slow_allocate_heapnumber); |
| 4664 __ jmp(&heapnumber_allocated); | 4664 __ jmp(&heapnumber_allocated); |
| 4665 | 4665 |
| 4666 __ bind(&slow_allocate_heapnumber); | 4666 __ bind(&slow_allocate_heapnumber); |
| 4667 // To allocate a heap number, and ensure that it is not a smi, we | 4667 // Allocate a heap number. |
| 4668 // call the runtime function FUnaryMinus on 0, returning the double | 4668 __ CallRuntime(Runtime::kNumberAlloc, 0); |
| 4669 // -0.0. A new, distinct heap number is returned each time. | |
| 4670 __ Push(Smi::FromInt(0)); | |
| 4671 __ CallRuntime(Runtime::kNumberUnaryMinus, 1); | |
| 4672 __ movq(rbx, rax); | 4669 __ movq(rbx, rax); |
| 4673 | 4670 |
| 4674 __ bind(&heapnumber_allocated); | 4671 __ bind(&heapnumber_allocated); |
| 4675 | 4672 |
| 4676 // Return a random uint32 number in rax. | 4673 // Return a random uint32 number in rax. |
| 4677 // The fresh HeapNumber is in rbx, which is callee-save on both x64 ABIs. | 4674 // The fresh HeapNumber is in rbx, which is callee-save on both x64 ABIs. |
| 4678 __ PrepareCallCFunction(0); | 4675 __ PrepareCallCFunction(0); |
| 4679 __ CallCFunction(ExternalReference::random_uint32_function(), 0); | 4676 __ CallCFunction(ExternalReference::random_uint32_function(), 0); |
| 4680 | 4677 |
| 4681 // Convert 32 random bits in rax to 0.(32 random bits) in a double | 4678 // Convert 32 random bits in rax to 0.(32 random bits) in a double |
| (...skipping 7381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12063 } | 12060 } |
| 12064 | 12061 |
| 12065 #endif | 12062 #endif |
| 12066 | 12063 |
| 12067 | 12064 |
| 12068 #undef __ | 12065 #undef __ |
| 12069 | 12066 |
| 12070 } } // namespace v8::internal | 12067 } } // namespace v8::internal |
| 12071 | 12068 |
| 12072 #endif // V8_TARGET_ARCH_X64 | 12069 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |