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 2764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2775 __ CallRuntime(Runtime::kNumberAlloc, 0); | 2775 __ CallRuntime(Runtime::kNumberAlloc, 0); |
2776 __ mov(r4, Operand(r0)); | 2776 __ mov(r4, Operand(r0)); |
2777 | 2777 |
2778 __ bind(&heapnumber_allocated); | 2778 __ bind(&heapnumber_allocated); |
2779 | 2779 |
2780 // Convert 32 random bits in r0 to 0.(32 random bits) in a double | 2780 // Convert 32 random bits in r0 to 0.(32 random bits) in a double |
2781 // by computing: | 2781 // by computing: |
2782 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). | 2782 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). |
2783 if (CpuFeatures::IsSupported(VFP3)) { | 2783 if (CpuFeatures::IsSupported(VFP3)) { |
2784 __ PrepareCallCFunction(1, r0); | 2784 __ PrepareCallCFunction(1, r0); |
2785 __ mov(r0, Operand(ExternalReference::isolate_address())); | 2785 __ ldr(r0, ContextOperand(context_register(), Context::GLOBAL_INDEX)); |
| 2786 __ ldr(r0, FieldMemOperand(r0, GlobalObject::kGlobalContextOffset)); |
2786 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1); | 2787 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1); |
2787 | 2788 |
2788 CpuFeatures::Scope scope(VFP3); | 2789 CpuFeatures::Scope scope(VFP3); |
2789 // 0x41300000 is the top half of 1.0 x 2^20 as a double. | 2790 // 0x41300000 is the top half of 1.0 x 2^20 as a double. |
2790 // Create this constant using mov/orr to avoid PC relative load. | 2791 // Create this constant using mov/orr to avoid PC relative load. |
2791 __ mov(r1, Operand(0x41000000)); | 2792 __ mov(r1, Operand(0x41000000)); |
2792 __ orr(r1, r1, Operand(0x300000)); | 2793 __ orr(r1, r1, Operand(0x300000)); |
2793 // Move 0x41300000xxxxxxxx (x = random bits) to VFP. | 2794 // Move 0x41300000xxxxxxxx (x = random bits) to VFP. |
2794 __ vmov(d7, r0, r1); | 2795 __ vmov(d7, r0, r1); |
2795 // Move 0x4130000000000000 to VFP. | 2796 // Move 0x4130000000000000 to VFP. |
2796 __ mov(r0, Operand(0, RelocInfo::NONE)); | 2797 __ mov(r0, Operand(0, RelocInfo::NONE)); |
2797 __ vmov(d8, r0, r1); | 2798 __ vmov(d8, r0, r1); |
2798 // Subtract and store the result in the heap number. | 2799 // Subtract and store the result in the heap number. |
2799 __ vsub(d7, d7, d8); | 2800 __ vsub(d7, d7, d8); |
2800 __ sub(r0, r4, Operand(kHeapObjectTag)); | 2801 __ sub(r0, r4, Operand(kHeapObjectTag)); |
2801 __ vstr(d7, r0, HeapNumber::kValueOffset); | 2802 __ vstr(d7, r0, HeapNumber::kValueOffset); |
2802 __ mov(r0, r4); | 2803 __ mov(r0, r4); |
2803 } else { | 2804 } else { |
2804 __ PrepareCallCFunction(2, r0); | 2805 __ PrepareCallCFunction(2, r0); |
| 2806 __ ldr(r1, ContextOperand(context_register(), Context::GLOBAL_INDEX)); |
2805 __ mov(r0, Operand(r4)); | 2807 __ mov(r0, Operand(r4)); |
2806 __ mov(r1, Operand(ExternalReference::isolate_address())); | 2808 __ ldr(r1, FieldMemOperand(r1, GlobalObject::kGlobalContextOffset)); |
2807 __ CallCFunction( | 2809 __ CallCFunction( |
2808 ExternalReference::fill_heap_number_with_random_function(isolate()), 2); | 2810 ExternalReference::fill_heap_number_with_random_function(isolate()), 2); |
2809 } | 2811 } |
2810 | 2812 |
2811 context()->Plug(r0); | 2813 context()->Plug(r0); |
2812 } | 2814 } |
2813 | 2815 |
2814 | 2816 |
2815 void FullCodeGenerator::EmitSubString(ZoneList<Expression*>* args) { | 2817 void FullCodeGenerator::EmitSubString(ZoneList<Expression*>* args) { |
2816 // Load the arguments on the stack and call the stub. | 2818 // Load the arguments on the stack and call the stub. |
(...skipping 1449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4266 *context_length = 0; | 4268 *context_length = 0; |
4267 return previous_; | 4269 return previous_; |
4268 } | 4270 } |
4269 | 4271 |
4270 | 4272 |
4271 #undef __ | 4273 #undef __ |
4272 | 4274 |
4273 } } // namespace v8::internal | 4275 } } // namespace v8::internal |
4274 | 4276 |
4275 #endif // V8_TARGET_ARCH_ARM | 4277 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |