| 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" |
| 11 #include "vm/flow_graph_compiler.h" | 11 #include "vm/flow_graph_compiler.h" |
| 12 #include "vm/locations.h" | 12 #include "vm/locations.h" |
| 13 #include "vm/object_store.h" | 13 #include "vm/object_store.h" |
| 14 #include "vm/parser.h" | 14 #include "vm/parser.h" |
| 15 #include "vm/simulator.h" | 15 #include "vm/simulator.h" |
| 16 #include "vm/stack_frame.h" | 16 #include "vm/stack_frame.h" |
| 17 #include "vm/stub_code.h" | 17 #include "vm/stub_code.h" |
| 18 #include "vm/symbols.h" | 18 #include "vm/symbols.h" |
| 19 | 19 |
| 20 #define __ compiler->assembler()-> | 20 #define __ compiler->assembler()-> |
| 21 | 21 |
| 22 namespace dart { | 22 namespace dart { |
| 23 | 23 |
| 24 DECLARE_FLAG(bool, emit_edge_counters); |
| 24 DECLARE_FLAG(int, optimization_counter_threshold); | 25 DECLARE_FLAG(int, optimization_counter_threshold); |
| 25 DECLARE_FLAG(bool, use_osr); | 26 DECLARE_FLAG(bool, use_osr); |
| 26 | 27 |
| 27 // Generic summary for call instructions that have all arguments pushed | 28 // Generic summary for call instructions that have all arguments pushed |
| 28 // on the stack and return the result in a fixed register R0. | 29 // on the stack and return the result in a fixed register R0. |
| 29 LocationSummary* Instruction::MakeCallSummary() { | 30 LocationSummary* Instruction::MakeCallSummary() { |
| 30 LocationSummary* result = new LocationSummary(0, 0, LocationSummary::kCall); | 31 LocationSummary* result = new LocationSummary(0, 0, LocationSummary::kCall); |
| 31 result->set_out(0, Location::RegisterLocation(R0)); | 32 result->set_out(0, Location::RegisterLocation(R0)); |
| 32 return result; | 33 return result; |
| 33 } | 34 } |
| (...skipping 4625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4659 void GraphEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4660 void GraphEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 4660 if (!compiler->CanFallThroughTo(normal_entry())) { | 4661 if (!compiler->CanFallThroughTo(normal_entry())) { |
| 4661 __ b(compiler->GetJumpLabel(normal_entry())); | 4662 __ b(compiler->GetJumpLabel(normal_entry())); |
| 4662 } | 4663 } |
| 4663 } | 4664 } |
| 4664 | 4665 |
| 4665 | 4666 |
| 4666 void TargetEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4667 void TargetEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 4667 __ Bind(compiler->GetJumpLabel(this)); | 4668 __ Bind(compiler->GetJumpLabel(this)); |
| 4668 if (!compiler->is_optimizing()) { | 4669 if (!compiler->is_optimizing()) { |
| 4669 compiler->EmitEdgeCounter(); | 4670 if (FLAG_emit_edge_counters) { |
| 4671 compiler->EmitEdgeCounter(); |
| 4672 } |
| 4670 // Add an edge counter. | 4673 // Add an edge counter. |
| 4671 // On ARM64 the deoptimization descriptor points after the edge counter | 4674 // On ARM64 the deoptimization descriptor points after the edge counter |
| 4672 // code so that we can reuse the same pattern matching code as at call | 4675 // code so that we can reuse the same pattern matching code as at call |
| 4673 // sites, which matches backwards from the end of the pattern. | 4676 // sites, which matches backwards from the end of the pattern. |
| 4674 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, | 4677 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, |
| 4675 deopt_id_, | 4678 deopt_id_, |
| 4676 Scanner::kNoSourcePos); | 4679 Scanner::kNoSourcePos); |
| 4677 } | 4680 } |
| 4678 if (HasParallelMove()) { | 4681 if (HasParallelMove()) { |
| 4679 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); | 4682 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); |
| 4680 } | 4683 } |
| 4681 } | 4684 } |
| 4682 | 4685 |
| 4683 | 4686 |
| 4684 LocationSummary* GotoInstr::MakeLocationSummary(bool opt) const { | 4687 LocationSummary* GotoInstr::MakeLocationSummary(bool opt) const { |
| 4685 return new LocationSummary(0, 0, LocationSummary::kNoCall); | 4688 return new LocationSummary(0, 0, LocationSummary::kNoCall); |
| 4686 } | 4689 } |
| 4687 | 4690 |
| 4688 | 4691 |
| 4689 void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4692 void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 4690 if (!compiler->is_optimizing()) { | 4693 if (!compiler->is_optimizing()) { |
| 4691 compiler->EmitEdgeCounter(); | 4694 if (FLAG_emit_edge_counters) { |
| 4695 compiler->EmitEdgeCounter(); |
| 4696 } |
| 4692 // Add a deoptimization descriptor for deoptimizing instructions that | 4697 // Add a deoptimization descriptor for deoptimizing instructions that |
| 4693 // may be inserted before this instruction. On ARM64 this descriptor | 4698 // may be inserted before this instruction. On ARM64 this descriptor |
| 4694 // points after the edge counter code so that we can reuse the same | 4699 // points after the edge counter code so that we can reuse the same |
| 4695 // pattern matching code as at call sites, which matches backwards from | 4700 // pattern matching code as at call sites, which matches backwards from |
| 4696 // the end of the pattern. | 4701 // the end of the pattern. |
| 4697 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, | 4702 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, |
| 4698 GetDeoptId(), | 4703 GetDeoptId(), |
| 4699 Scanner::kNoSourcePos); | 4704 Scanner::kNoSourcePos); |
| 4700 } | 4705 } |
| 4701 if (HasParallelMove()) { | 4706 if (HasParallelMove()) { |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4831 compiler->GenerateCall(token_pos(), | 4836 compiler->GenerateCall(token_pos(), |
| 4832 &label, | 4837 &label, |
| 4833 PcDescriptors::kOther, | 4838 PcDescriptors::kOther, |
| 4834 locs()); | 4839 locs()); |
| 4835 __ Drop(ArgumentCount()); // Discard arguments. | 4840 __ Drop(ArgumentCount()); // Discard arguments. |
| 4836 } | 4841 } |
| 4837 | 4842 |
| 4838 } // namespace dart | 4843 } // namespace dart |
| 4839 | 4844 |
| 4840 #endif // defined TARGET_ARCH_ARM64 | 4845 #endif // defined TARGET_ARCH_ARM64 |
| OLD | NEW |