OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. |
6 #if defined(TARGET_ARCH_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
7 | 7 |
8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
9 | 9 |
10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 // Load arguments descriptor in R4. | 215 // Load arguments descriptor in R4. |
216 int argument_count = ArgumentCount(); | 216 int argument_count = ArgumentCount(); |
217 const Array& arguments_descriptor = | 217 const Array& arguments_descriptor = |
218 Array::ZoneHandle(ArgumentsDescriptor::New(argument_count, | 218 Array::ZoneHandle(ArgumentsDescriptor::New(argument_count, |
219 argument_names())); | 219 argument_names())); |
220 __ LoadObject(R4, arguments_descriptor); | 220 __ LoadObject(R4, arguments_descriptor); |
221 | 221 |
222 // R4: Arguments descriptor. | 222 // R4: Arguments descriptor. |
223 // R0: Function. | 223 // R0: Function. |
224 ASSERT(locs()->in(0).reg() == R0); | 224 ASSERT(locs()->in(0).reg() == R0); |
| 225 __ ldr(CODE_REG, FieldAddress(R0, Function::code_offset())); |
225 __ ldr(R2, FieldAddress(R0, Function::entry_point_offset())); | 226 __ ldr(R2, FieldAddress(R0, Function::entry_point_offset())); |
226 | 227 |
227 // R2: instructions entry point. | 228 // R2: instructions entry point. |
228 // R5: Smi 0 (no IC data; the lazy-compile stub expects a GC-safe value). | 229 // R5: Smi 0 (no IC data; the lazy-compile stub expects a GC-safe value). |
229 __ LoadImmediate(R5, 0); | 230 __ LoadImmediate(R5, 0); |
230 __ blx(R2); | 231 __ blx(R2); |
231 compiler->RecordSafepoint(locs()); | 232 compiler->RecordSafepoint(locs()); |
232 // Marks either the continuation point in unoptimized code or the | 233 // Marks either the continuation point in unoptimized code or the |
233 // deoptimization point in optimized code, after call. | 234 // deoptimization point in optimized code, after call. |
234 const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id()); | 235 const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id()); |
(...skipping 2088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2323 Label* done) { | 2324 Label* done) { |
2324 const int kInlineArraySize = 12; // Same as kInlineInstanceSize. | 2325 const int kInlineArraySize = 12; // Same as kInlineInstanceSize. |
2325 const Register kLengthReg = R2; | 2326 const Register kLengthReg = R2; |
2326 const Register kElemTypeReg = R1; | 2327 const Register kElemTypeReg = R1; |
2327 const intptr_t instance_size = Array::InstanceSize(num_elements); | 2328 const intptr_t instance_size = Array::InstanceSize(num_elements); |
2328 | 2329 |
2329 __ TryAllocateArray(kArrayCid, instance_size, slow_path, | 2330 __ TryAllocateArray(kArrayCid, instance_size, slow_path, |
2330 R0, // instance | 2331 R0, // instance |
2331 R3, // end address | 2332 R3, // end address |
2332 R6, | 2333 R6, |
2333 R9); | 2334 R10); |
2334 // R0: new object start as a tagged pointer. | 2335 // R0: new object start as a tagged pointer. |
2335 // R3: new object end address. | 2336 // R3: new object end address. |
2336 | 2337 |
2337 // Store the type argument field. | 2338 // Store the type argument field. |
2338 __ InitializeFieldNoBarrier(R0, | 2339 __ InitializeFieldNoBarrier(R0, |
2339 FieldAddress(R0, Array::type_arguments_offset()), | 2340 FieldAddress(R0, Array::type_arguments_offset()), |
2340 kElemTypeReg); | 2341 kElemTypeReg); |
2341 | 2342 |
2342 // Set the length field. | 2343 // Set the length field. |
2343 __ InitializeFieldNoBarrier(R0, | 2344 __ InitializeFieldNoBarrier(R0, |
2344 FieldAddress(R0, Array::length_offset()), | 2345 FieldAddress(R0, Array::length_offset()), |
2345 kLengthReg); | 2346 kLengthReg); |
2346 | 2347 |
2347 // Initialize all array elements to raw_null. | 2348 // Initialize all array elements to raw_null. |
2348 // R0: new object start as a tagged pointer. | 2349 // R0: new object start as a tagged pointer. |
2349 // R3: new object end address. | 2350 // R3: new object end address. |
2350 // R9: iterator which initially points to the start of the variable | 2351 // R10: iterator which initially points to the start of the variable |
2351 // data area to be initialized. | 2352 // data area to be initialized. |
2352 // R6: null | 2353 // R6: null |
2353 if (num_elements > 0) { | 2354 if (num_elements > 0) { |
2354 const intptr_t array_size = instance_size - sizeof(RawArray); | 2355 const intptr_t array_size = instance_size - sizeof(RawArray); |
2355 __ LoadImmediate(R6, reinterpret_cast<intptr_t>(Object::null())); | 2356 __ LoadImmediate(R6, reinterpret_cast<intptr_t>(Object::null())); |
2356 if (num_elements >= 2) { | 2357 if (num_elements >= 2) { |
2357 __ mov(R7, Operand(R6)); | 2358 __ mov(R7, Operand(R6)); |
2358 } else { | 2359 } else { |
2359 #if defined(DEBUG) | 2360 #if defined(DEBUG) |
2360 // Clobber R7 with an invalid pointer. | 2361 // Clobber R7 with an invalid pointer. |
2361 __ LoadImmediate(R7, 0x1); | 2362 __ LoadImmediate(R7, 0x1); |
2362 #endif // DEBUG | 2363 #endif // DEBUG |
2363 } | 2364 } |
2364 __ AddImmediate(R9, R0, sizeof(RawArray) - kHeapObjectTag); | 2365 __ AddImmediate(R10, R0, sizeof(RawArray) - kHeapObjectTag); |
2365 if (array_size < (kInlineArraySize * kWordSize)) { | 2366 if (array_size < (kInlineArraySize * kWordSize)) { |
2366 __ InitializeFieldsNoBarrierUnrolled(R0, R9, 0, num_elements * kWordSize, | 2367 __ InitializeFieldsNoBarrierUnrolled(R0, R10, 0, num_elements * kWordSize, |
2367 R6, R7); | 2368 R6, R7); |
2368 } else { | 2369 } else { |
2369 __ InitializeFieldsNoBarrier(R0, R9, R3, R6, R7); | 2370 __ InitializeFieldsNoBarrier(R0, R10, R3, R6, R7); |
2370 } | 2371 } |
2371 } | 2372 } |
2372 __ b(done); | 2373 __ b(done); |
2373 } | 2374 } |
2374 | 2375 |
2375 | 2376 |
2376 void CreateArrayInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2377 void CreateArrayInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
2377 const Register kLengthReg = R2; | 2378 const Register kLengthReg = R2; |
2378 const Register kElemTypeReg = R1; | 2379 const Register kElemTypeReg = R1; |
2379 const Register kResultReg = R0; | 2380 const Register kResultReg = R0; |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2831 } | 2832 } |
2832 | 2833 |
2833 | 2834 |
2834 void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2835 void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
2835 __ Bind(compiler->GetJumpLabel(this)); | 2836 __ Bind(compiler->GetJumpLabel(this)); |
2836 compiler->AddExceptionHandler(catch_try_index(), | 2837 compiler->AddExceptionHandler(catch_try_index(), |
2837 try_index(), | 2838 try_index(), |
2838 compiler->assembler()->CodeSize(), | 2839 compiler->assembler()->CodeSize(), |
2839 catch_handler_types_, | 2840 catch_handler_types_, |
2840 needs_stacktrace()); | 2841 needs_stacktrace()); |
2841 | |
2842 // Restore the pool pointer. | 2842 // Restore the pool pointer. |
| 2843 __ RestoreCodePointer(); |
2843 __ LoadPoolPointer(); | 2844 __ LoadPoolPointer(); |
2844 | 2845 |
2845 if (HasParallelMove()) { | 2846 if (HasParallelMove()) { |
2846 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); | 2847 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); |
2847 } | 2848 } |
2848 | 2849 |
2849 // Restore SP from FP as we are coming from a throw and the code for | 2850 // Restore SP from FP as we are coming from a throw and the code for |
2850 // popping arguments has not been run. | 2851 // popping arguments has not been run. |
2851 const intptr_t fp_sp_dist = | 2852 const intptr_t fp_sp_dist = |
2852 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize; | 2853 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize; |
(...skipping 3827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6680 summary->set_in(0, Location::RequiresRegister()); | 6681 summary->set_in(0, Location::RequiresRegister()); |
6681 summary->set_temp(0, Location::RequiresRegister()); | 6682 summary->set_temp(0, Location::RequiresRegister()); |
6682 | 6683 |
6683 return summary; | 6684 return summary; |
6684 } | 6685 } |
6685 | 6686 |
6686 | 6687 |
6687 void IndirectGotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 6688 void IndirectGotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
6688 Register target_address_reg = locs()->temp_slot(0)->reg(); | 6689 Register target_address_reg = locs()->temp_slot(0)->reg(); |
6689 | 6690 |
6690 // Load from [current frame pointer] + kPcMarkerSlotFromFp. | 6691 // Offset is relative to entry pc. |
6691 __ ldr(target_address_reg, Address(FP, kPcMarkerSlotFromFp * kWordSize)); | 6692 const intptr_t entry_to_pc_offset = __ CodeSize() + Instr::kPCReadOffset; |
6692 | 6693 __ mov(target_address_reg, Operand(PC)); |
| 6694 __ AddImmediate(target_address_reg, target_address_reg, -entry_to_pc_offset); |
6693 // Add the offset. | 6695 // Add the offset. |
6694 Register offset_reg = locs()->in(0).reg(); | 6696 Register offset_reg = locs()->in(0).reg(); |
6695 Operand offset_opr = | 6697 Operand offset_opr = |
6696 (offset()->definition()->representation() == kTagged) ? | 6698 (offset()->definition()->representation() == kTagged) ? |
6697 Operand(offset_reg, ASR, kSmiTagSize) : | 6699 Operand(offset_reg, ASR, kSmiTagSize) : |
6698 Operand(offset_reg); | 6700 Operand(offset_reg); |
6699 __ add(target_address_reg, target_address_reg, offset_opr); | 6701 __ add(target_address_reg, target_address_reg, offset_opr); |
6700 | 6702 |
6701 // Jump to the absolute address. | 6703 // Jump to the absolute address. |
6702 __ bx(target_address_reg); | 6704 __ bx(target_address_reg); |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6863 1, | 6865 1, |
6864 locs()); | 6866 locs()); |
6865 __ Drop(1); | 6867 __ Drop(1); |
6866 __ Pop(result); | 6868 __ Pop(result); |
6867 } | 6869 } |
6868 | 6870 |
6869 | 6871 |
6870 } // namespace dart | 6872 } // namespace dart |
6871 | 6873 |
6872 #endif // defined TARGET_ARCH_ARM | 6874 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |