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