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 6660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6671 ASSERT(args->length() == 0); | 6671 ASSERT(args->length() == 0); |
6672 frame_->SpillAll(); | 6672 frame_->SpillAll(); |
6673 | 6673 |
6674 Label slow_allocate_heapnumber; | 6674 Label slow_allocate_heapnumber; |
6675 Label heapnumber_allocated; | 6675 Label heapnumber_allocated; |
6676 | 6676 |
6677 __ AllocateHeapNumber(edi, ebx, ecx, &slow_allocate_heapnumber); | 6677 __ AllocateHeapNumber(edi, ebx, ecx, &slow_allocate_heapnumber); |
6678 __ jmp(&heapnumber_allocated); | 6678 __ jmp(&heapnumber_allocated); |
6679 | 6679 |
6680 __ bind(&slow_allocate_heapnumber); | 6680 __ bind(&slow_allocate_heapnumber); |
6681 // To allocate a heap number, and ensure that it is not a smi, we | 6681 // Allocate a heap number. |
6682 // call the runtime function FUnaryMinus on 0, returning the double | 6682 __ CallRuntime(Runtime::kNumberAlloc, 0); |
6683 // -0.0. A new, distinct heap number is returned each time. | |
6684 __ push(Immediate(Smi::FromInt(0))); | |
6685 __ CallRuntime(Runtime::kNumberUnaryMinus, 1); | |
6686 __ mov(edi, eax); | 6683 __ mov(edi, eax); |
6687 | 6684 |
6688 __ bind(&heapnumber_allocated); | 6685 __ bind(&heapnumber_allocated); |
6689 | 6686 |
6690 __ PrepareCallCFunction(0, ebx); | 6687 __ PrepareCallCFunction(0, ebx); |
6691 __ CallCFunction(ExternalReference::random_uint32_function(), 0); | 6688 __ CallCFunction(ExternalReference::random_uint32_function(), 0); |
6692 | 6689 |
6693 // Convert 32 random bits in eax to 0.(32 random bits) in a double | 6690 // Convert 32 random bits in eax to 0.(32 random bits) in a double |
6694 // by computing: | 6691 // by computing: |
6695 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). | 6692 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). |
(...skipping 7056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13752 masm.GetCode(&desc); | 13749 masm.GetCode(&desc); |
13753 // Call the function from C++. | 13750 // Call the function from C++. |
13754 return FUNCTION_CAST<MemCopyFunction>(buffer); | 13751 return FUNCTION_CAST<MemCopyFunction>(buffer); |
13755 } | 13752 } |
13756 | 13753 |
13757 #undef __ | 13754 #undef __ |
13758 | 13755 |
13759 } } // namespace v8::internal | 13756 } } // namespace v8::internal |
13760 | 13757 |
13761 #endif // V8_TARGET_ARCH_IA32 | 13758 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |