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