| 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/compiler.h" | 10 #include "vm/compiler.h" |
| 11 #include "vm/dart_entry.h" | 11 #include "vm/dart_entry.h" |
| 12 #include "vm/flow_graph.h" | 12 #include "vm/flow_graph.h" |
| 13 #include "vm/flow_graph_compiler.h" | 13 #include "vm/flow_graph_compiler.h" |
| 14 #include "vm/flow_graph_range_analysis.h" | 14 #include "vm/flow_graph_range_analysis.h" |
| 15 #include "vm/instructions.h" |
| 15 #include "vm/locations.h" | 16 #include "vm/locations.h" |
| 16 #include "vm/object_store.h" | 17 #include "vm/object_store.h" |
| 17 #include "vm/parser.h" | 18 #include "vm/parser.h" |
| 18 #include "vm/simulator.h" | 19 #include "vm/simulator.h" |
| 19 #include "vm/stack_frame.h" | 20 #include "vm/stack_frame.h" |
| 20 #include "vm/stub_code.h" | 21 #include "vm/stub_code.h" |
| 21 #include "vm/symbols.h" | 22 #include "vm/symbols.h" |
| 22 | 23 |
| 23 #define __ compiler->assembler()-> | 24 #define __ compiler->assembler()-> |
| 24 #define Z (compiler->zone()) | 25 #define Z (compiler->zone()) |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 // R2: instructions. | 223 // R2: instructions. |
| 223 // R5: Smi 0 (no IC data; the lazy-compile stub expects a GC-safe value). | 224 // R5: Smi 0 (no IC data; the lazy-compile stub expects a GC-safe value). |
| 224 __ LoadImmediate(R5, 0); | 225 __ LoadImmediate(R5, 0); |
| 225 //?? | 226 //?? |
| 226 __ blr(R2); | 227 __ blr(R2); |
| 227 compiler->RecordSafepoint(locs()); | 228 compiler->RecordSafepoint(locs()); |
| 228 // Marks either the continuation point in unoptimized code or the | 229 // Marks either the continuation point in unoptimized code or the |
| 229 // deoptimization point in optimized code, after call. | 230 // deoptimization point in optimized code, after call. |
| 230 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id()); | 231 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id()); |
| 231 if (compiler->is_optimizing()) { | 232 if (compiler->is_optimizing()) { |
| 232 compiler->AddDeoptIndexAtCall(deopt_id_after, token_pos()); | 233 compiler->AddDeoptIndexAtCall(deopt_id_after); |
| 233 } | 234 } |
| 234 // Add deoptimization continuation point after the call and before the | 235 // Add deoptimization continuation point after the call and before the |
| 235 // arguments are removed. | 236 // arguments are removed. |
| 236 // In optimized code this descriptor is needed for exception handling. | 237 // In optimized code this descriptor is needed for exception handling. |
| 237 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, | 238 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, |
| 238 deopt_id_after, | 239 deopt_id_after, |
| 239 token_pos()); | 240 token_pos()); |
| 240 __ Drop(argument_count); | 241 __ Drop(argument_count); |
| 241 } | 242 } |
| 242 | 243 |
| (...skipping 2303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2546 | 2547 |
| 2547 | 2548 |
| 2548 LocationSummary* CatchBlockEntryInstr::MakeLocationSummary(Zone* zone, | 2549 LocationSummary* CatchBlockEntryInstr::MakeLocationSummary(Zone* zone, |
| 2549 bool opt) const { | 2550 bool opt) const { |
| 2550 UNREACHABLE(); | 2551 UNREACHABLE(); |
| 2551 return NULL; | 2552 return NULL; |
| 2552 } | 2553 } |
| 2553 | 2554 |
| 2554 | 2555 |
| 2555 void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2556 void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2557 // Ensure space for patching return sites for lazy deopt. |
| 2558 if (!FLAG_precompiled_mode && compiler->is_optimizing()) { |
| 2559 for (intptr_t i = 0; |
| 2560 i < CallPattern::kDeoptCallLengthInInstructions; |
| 2561 ++i) { |
| 2562 __ orr(R0, ZR, Operand(R0)); // nop |
| 2563 } |
| 2564 } |
| 2556 __ Bind(compiler->GetJumpLabel(this)); | 2565 __ Bind(compiler->GetJumpLabel(this)); |
| 2557 compiler->AddExceptionHandler(catch_try_index(), | 2566 compiler->AddExceptionHandler(catch_try_index(), |
| 2558 try_index(), | 2567 try_index(), |
| 2559 compiler->assembler()->CodeSize(), | 2568 compiler->assembler()->CodeSize(), |
| 2560 catch_handler_types_, | 2569 catch_handler_types_, |
| 2561 needs_stacktrace()); | 2570 needs_stacktrace()); |
| 2562 | 2571 // On lazy deoptimization we patch the optimized code here to enter the |
| 2563 // Restore the pool pointer. | 2572 // deoptimization stub. |
| 2564 __ RestoreCodePointer(); | 2573 const intptr_t deopt_id = Thread::ToDeoptAfter(GetDeoptId()); |
| 2565 __ LoadPoolPointer(); | 2574 if (compiler->is_optimizing()) { |
| 2566 | 2575 compiler->AddDeoptIndexAtCall(deopt_id); |
| 2576 } else { |
| 2577 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, |
| 2578 deopt_id, |
| 2579 TokenPosition::kNoSource); |
| 2580 } |
| 2567 if (HasParallelMove()) { | 2581 if (HasParallelMove()) { |
| 2568 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); | 2582 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); |
| 2569 } | 2583 } |
| 2570 | 2584 |
| 2571 // Restore SP from FP as we are coming from a throw and the code for | 2585 // Restore SP from FP as we are coming from a throw and the code for |
| 2572 // popping arguments has not been run. | 2586 // popping arguments has not been run. |
| 2573 const intptr_t fp_sp_dist = | 2587 const intptr_t fp_sp_dist = |
| 2574 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize; | 2588 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize; |
| 2575 ASSERT(fp_sp_dist <= 0); | 2589 ASSERT(fp_sp_dist <= 0); |
| 2576 __ AddImmediate(SP, FP, fp_sp_dist); | 2590 __ AddImmediate(SP, FP, fp_sp_dist); |
| (...skipping 3196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5773 1, | 5787 1, |
| 5774 locs()); | 5788 locs()); |
| 5775 __ Drop(1); | 5789 __ Drop(1); |
| 5776 __ Pop(result); | 5790 __ Pop(result); |
| 5777 } | 5791 } |
| 5778 | 5792 |
| 5779 | 5793 |
| 5780 } // namespace dart | 5794 } // namespace dart |
| 5781 | 5795 |
| 5782 #endif // defined TARGET_ARCH_ARM64 | 5796 #endif // defined TARGET_ARCH_ARM64 |
| OLD | NEW |