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 2785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2796 // Allocate a heap number. | 2796 // Allocate a heap number. |
2797 __ CallRuntime(Runtime::kNumberAlloc, 0); | 2797 __ CallRuntime(Runtime::kNumberAlloc, 0); |
2798 __ mov(r4, Operand(r0)); | 2798 __ mov(r4, Operand(r0)); |
2799 | 2799 |
2800 __ bind(&heapnumber_allocated); | 2800 __ bind(&heapnumber_allocated); |
2801 | 2801 |
2802 // Convert 32 random bits in r0 to 0.(32 random bits) in a double | 2802 // Convert 32 random bits in r0 to 0.(32 random bits) in a double |
2803 // by computing: | 2803 // by computing: |
2804 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). | 2804 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). |
2805 if (isolate()->cpu_features()->IsSupported(VFP3)) { | 2805 if (isolate()->cpu_features()->IsSupported(VFP3)) { |
2806 __ PrepareCallCFunction(0, r1); | 2806 __ PrepareCallCFunction(1, r0); |
2807 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 0); | 2807 __ mov(r0, Operand(ExternalReference::isolate_address())); |
| 2808 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1); |
2808 | 2809 |
2809 CpuFeatures::Scope scope(VFP3); | 2810 CpuFeatures::Scope scope(VFP3); |
2810 // 0x41300000 is the top half of 1.0 x 2^20 as a double. | 2811 // 0x41300000 is the top half of 1.0 x 2^20 as a double. |
2811 // Create this constant using mov/orr to avoid PC relative load. | 2812 // Create this constant using mov/orr to avoid PC relative load. |
2812 __ mov(r1, Operand(0x41000000)); | 2813 __ mov(r1, Operand(0x41000000)); |
2813 __ orr(r1, r1, Operand(0x300000)); | 2814 __ orr(r1, r1, Operand(0x300000)); |
2814 // Move 0x41300000xxxxxxxx (x = random bits) to VFP. | 2815 // Move 0x41300000xxxxxxxx (x = random bits) to VFP. |
2815 __ vmov(d7, r0, r1); | 2816 __ vmov(d7, r0, r1); |
2816 // Move 0x4130000000000000 to VFP. | 2817 // Move 0x4130000000000000 to VFP. |
2817 __ mov(r0, Operand(0, RelocInfo::NONE)); | 2818 __ mov(r0, Operand(0, RelocInfo::NONE)); |
2818 __ vmov(d8, r0, r1); | 2819 __ vmov(d8, r0, r1); |
2819 // Subtract and store the result in the heap number. | 2820 // Subtract and store the result in the heap number. |
2820 __ vsub(d7, d7, d8); | 2821 __ vsub(d7, d7, d8); |
2821 __ sub(r0, r4, Operand(kHeapObjectTag)); | 2822 __ sub(r0, r4, Operand(kHeapObjectTag)); |
2822 __ vstr(d7, r0, HeapNumber::kValueOffset); | 2823 __ vstr(d7, r0, HeapNumber::kValueOffset); |
2823 __ mov(r0, r4); | 2824 __ mov(r0, r4); |
2824 } else { | 2825 } else { |
| 2826 __ PrepareCallCFunction(2, r0); |
2825 __ mov(r0, Operand(r4)); | 2827 __ mov(r0, Operand(r4)); |
2826 __ PrepareCallCFunction(1, r1); | 2828 __ mov(r1, Operand(ExternalReference::isolate_address())); |
2827 __ CallCFunction( | 2829 __ CallCFunction( |
2828 ExternalReference::fill_heap_number_with_random_function(isolate()), 1); | 2830 ExternalReference::fill_heap_number_with_random_function(isolate()), 2); |
2829 } | 2831 } |
2830 | 2832 |
2831 context()->Plug(r0); | 2833 context()->Plug(r0); |
2832 } | 2834 } |
2833 | 2835 |
2834 | 2836 |
2835 void FullCodeGenerator::EmitSubString(ZoneList<Expression*>* args) { | 2837 void FullCodeGenerator::EmitSubString(ZoneList<Expression*>* args) { |
2836 // Load the arguments on the stack and call the stub. | 2838 // Load the arguments on the stack and call the stub. |
2837 SubStringStub stub; | 2839 SubStringStub stub; |
2838 ASSERT(args->length() == 3); | 2840 ASSERT(args->length() == 3); |
(...skipping 1467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4306 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. | 4308 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. |
4307 __ add(pc, r1, Operand(masm_->CodeObject())); | 4309 __ add(pc, r1, Operand(masm_->CodeObject())); |
4308 } | 4310 } |
4309 | 4311 |
4310 | 4312 |
4311 #undef __ | 4313 #undef __ |
4312 | 4314 |
4313 } } // namespace v8::internal | 4315 } } // namespace v8::internal |
4314 | 4316 |
4315 #endif // V8_TARGET_ARCH_ARM | 4317 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |