OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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_ARM64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64. |
6 #if defined(TARGET_ARCH_ARM64) | 6 #if defined(TARGET_ARCH_ARM64) |
7 | 7 |
8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
9 | 9 |
10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 // Load arguments descriptor in R4. | 212 // Load arguments descriptor in R4. |
213 int argument_count = ArgumentCount(); | 213 int argument_count = ArgumentCount(); |
214 const Array& arguments_descriptor = | 214 const Array& arguments_descriptor = |
215 Array::ZoneHandle(ArgumentsDescriptor::New(argument_count, | 215 Array::ZoneHandle(ArgumentsDescriptor::New(argument_count, |
216 argument_names())); | 216 argument_names())); |
217 __ LoadObject(R4, arguments_descriptor); | 217 __ LoadObject(R4, arguments_descriptor); |
218 | 218 |
219 // R4: Arguments descriptor. | 219 // R4: Arguments descriptor. |
220 // R0: Function. | 220 // R0: Function. |
221 ASSERT(locs()->in(0).reg() == R0); | 221 ASSERT(locs()->in(0).reg() == R0); |
222 __ LoadFieldFromOffset(CODE_REG, R0, Function::code_offset()); | |
223 __ LoadFieldFromOffset(R2, R0, Function::entry_point_offset()); | 222 __ LoadFieldFromOffset(R2, R0, Function::entry_point_offset()); |
224 | 223 |
225 // R2: instructions. | 224 // R2: instructions. |
226 // R5: Smi 0 (no IC data; the lazy-compile stub expects a GC-safe value). | 225 // R5: Smi 0 (no IC data; the lazy-compile stub expects a GC-safe value). |
227 __ LoadImmediate(R5, 0); | 226 __ LoadImmediate(R5, 0); |
228 //?? | |
229 __ blr(R2); | 227 __ blr(R2); |
230 compiler->RecordSafepoint(locs()); | 228 compiler->RecordSafepoint(locs()); |
231 // Marks either the continuation point in unoptimized code or the | 229 // Marks either the continuation point in unoptimized code or the |
232 // deoptimization point in optimized code, after call. | 230 // deoptimization point in optimized code, after call. |
233 const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id()); | 231 const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id()); |
234 if (compiler->is_optimizing()) { | 232 if (compiler->is_optimizing()) { |
235 compiler->AddDeoptIndexAtCall(deopt_id_after, token_pos()); | 233 compiler->AddDeoptIndexAtCall(deopt_id_after, token_pos()); |
236 } | 234 } |
237 // Add deoptimization continuation point after the call and before the | 235 // Add deoptimization continuation point after the call and before the |
238 // arguments are removed. | 236 // arguments are removed. |
(...skipping 2311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2550 | 2548 |
2551 void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2549 void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
2552 __ Bind(compiler->GetJumpLabel(this)); | 2550 __ Bind(compiler->GetJumpLabel(this)); |
2553 compiler->AddExceptionHandler(catch_try_index(), | 2551 compiler->AddExceptionHandler(catch_try_index(), |
2554 try_index(), | 2552 try_index(), |
2555 compiler->assembler()->CodeSize(), | 2553 compiler->assembler()->CodeSize(), |
2556 catch_handler_types_, | 2554 catch_handler_types_, |
2557 needs_stacktrace()); | 2555 needs_stacktrace()); |
2558 | 2556 |
2559 // Restore the pool pointer. | 2557 // Restore the pool pointer. |
2560 __ RestoreCodePointer(); | |
2561 __ LoadPoolPointer(); | 2558 __ LoadPoolPointer(); |
2562 | 2559 |
2563 if (HasParallelMove()) { | 2560 if (HasParallelMove()) { |
2564 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); | 2561 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); |
2565 } | 2562 } |
2566 | 2563 |
2567 // Restore SP from FP as we are coming from a throw and the code for | 2564 // Restore SP from FP as we are coming from a throw and the code for |
2568 // popping arguments has not been run. | 2565 // popping arguments has not been run. |
2569 const intptr_t fp_sp_dist = | 2566 const intptr_t fp_sp_dist = |
2570 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize; | 2567 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize; |
(...skipping 2881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5452 summary->set_in(0, Location::RequiresRegister()); | 5449 summary->set_in(0, Location::RequiresRegister()); |
5453 summary->set_temp(0, Location::RequiresRegister()); | 5450 summary->set_temp(0, Location::RequiresRegister()); |
5454 | 5451 |
5455 return summary; | 5452 return summary; |
5456 } | 5453 } |
5457 | 5454 |
5458 | 5455 |
5459 void IndirectGotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 5456 void IndirectGotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
5460 Register target_address_reg = locs()->temp_slot(0)->reg(); | 5457 Register target_address_reg = locs()->temp_slot(0)->reg(); |
5461 | 5458 |
5462 // Load code entry point. | 5459 // Load from [current frame pointer] + kPcMarkerSlotFromFp. |
5463 const intptr_t entry_offset = __ CodeSize(); | 5460 __ ldr(target_address_reg, Address(FP, kPcMarkerSlotFromFp * kWordSize)); |
5464 if (Utils::IsInt(21, -entry_offset)) { | |
5465 __ adr(target_address_reg, Immediate(-entry_offset)); | |
5466 } else { | |
5467 __ adr(target_address_reg, Immediate(0)); | |
5468 __ AddImmediate(target_address_reg, target_address_reg, -entry_offset); | |
5469 } | |
5470 | 5461 |
5471 // Add the offset. | 5462 // Add the offset. |
5472 Register offset_reg = locs()->in(0).reg(); | 5463 Register offset_reg = locs()->in(0).reg(); |
5473 Operand offset_opr = | 5464 Operand offset_opr = |
5474 (offset()->definition()->representation() == kTagged) ? | 5465 (offset()->definition()->representation() == kTagged) ? |
5475 Operand(offset_reg, ASR, kSmiTagSize) : | 5466 Operand(offset_reg, ASR, kSmiTagSize) : |
5476 Operand(offset_reg); | 5467 Operand(offset_reg); |
5477 __ add(target_address_reg, target_address_reg, offset_opr); | 5468 __ add(target_address_reg, target_address_reg, offset_opr); |
5478 | 5469 |
5479 // Jump to the absolute address. | 5470 // Jump to the absolute address. |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5635 1, | 5626 1, |
5636 locs()); | 5627 locs()); |
5637 __ Drop(1); | 5628 __ Drop(1); |
5638 __ Pop(result); | 5629 __ Pop(result); |
5639 } | 5630 } |
5640 | 5631 |
5641 | 5632 |
5642 } // namespace dart | 5633 } // namespace dart |
5643 | 5634 |
5644 #endif // defined TARGET_ARCH_ARM64 | 5635 #endif // defined TARGET_ARCH_ARM64 |
OLD | NEW |