OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 2143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2154 ASSERT(args->length() == 0); | 2154 ASSERT(args->length() == 0); |
2155 | 2155 |
2156 Label slow_allocate_heapnumber; | 2156 Label slow_allocate_heapnumber; |
2157 Label heapnumber_allocated; | 2157 Label heapnumber_allocated; |
2158 | 2158 |
2159 __ LoadRoot(r6, Heap::kHeapNumberMapRootIndex); | 2159 __ LoadRoot(r6, Heap::kHeapNumberMapRootIndex); |
2160 __ AllocateHeapNumber(r4, r1, r2, r6, &slow_allocate_heapnumber); | 2160 __ AllocateHeapNumber(r4, r1, r2, r6, &slow_allocate_heapnumber); |
2161 __ jmp(&heapnumber_allocated); | 2161 __ jmp(&heapnumber_allocated); |
2162 | 2162 |
2163 __ bind(&slow_allocate_heapnumber); | 2163 __ bind(&slow_allocate_heapnumber); |
2164 // To allocate a heap number, and ensure that it is not a smi, we | 2164 // Allocate a heap number. |
2165 // call the runtime function FUnaryMinus on 0, returning the double | 2165 __ CallRuntime(Runtime::kNumberAlloc, 0); |
2166 // -0.0. A new, distinct heap number is returned each time. | |
2167 __ mov(r0, Operand(Smi::FromInt(0))); | |
2168 __ push(r0); | |
2169 __ CallRuntime(Runtime::kNumberUnaryMinus, 1); | |
2170 __ mov(r4, Operand(r0)); | 2166 __ mov(r4, Operand(r0)); |
2171 | 2167 |
2172 __ bind(&heapnumber_allocated); | 2168 __ bind(&heapnumber_allocated); |
2173 | 2169 |
2174 // Convert 32 random bits in r0 to 0.(32 random bits) in a double | 2170 // Convert 32 random bits in r0 to 0.(32 random bits) in a double |
2175 // by computing: | 2171 // by computing: |
2176 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). | 2172 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). |
2177 if (CpuFeatures::IsSupported(VFP3)) { | 2173 if (CpuFeatures::IsSupported(VFP3)) { |
2178 __ PrepareCallCFunction(0, r1); | 2174 __ PrepareCallCFunction(0, r1); |
2179 __ CallCFunction(ExternalReference::random_uint32_function(), 0); | 2175 __ CallCFunction(ExternalReference::random_uint32_function(), 0); |
(...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3155 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. | 3151 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. |
3156 __ add(pc, r1, Operand(masm_->CodeObject())); | 3152 __ add(pc, r1, Operand(masm_->CodeObject())); |
3157 } | 3153 } |
3158 | 3154 |
3159 | 3155 |
3160 #undef __ | 3156 #undef __ |
3161 | 3157 |
3162 } } // namespace v8::internal | 3158 } } // namespace v8::internal |
3163 | 3159 |
3164 #endif // V8_TARGET_ARCH_ARM | 3160 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |