| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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_ARM. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. |
| 6 #if defined(TARGET_ARCH_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
| 7 | 7 |
| 8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 | 9 |
| 10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
| 11 #include "vm/dart_entry.h" | 11 #include "vm/dart_entry.h" |
| 12 #include "vm/flow_graph_compiler.h" | 12 #include "vm/flow_graph_compiler.h" |
| 13 #include "vm/locations.h" | 13 #include "vm/locations.h" |
| 14 #include "vm/object_store.h" | 14 #include "vm/object_store.h" |
| 15 #include "vm/parser.h" | 15 #include "vm/parser.h" |
| 16 #include "vm/simulator.h" | 16 #include "vm/simulator.h" |
| 17 #include "vm/stack_frame.h" | 17 #include "vm/stack_frame.h" |
| 18 #include "vm/stub_code.h" | 18 #include "vm/stub_code.h" |
| 19 #include "vm/symbols.h" | 19 #include "vm/symbols.h" |
| 20 | 20 |
| 21 #define __ compiler->assembler()-> | 21 #define __ compiler->assembler()-> |
| 22 | 22 |
| 23 namespace dart { | 23 namespace dart { |
| 24 | 24 |
| 25 DECLARE_FLAG(bool, emit_edge_counters); |
| 25 DECLARE_FLAG(int, optimization_counter_threshold); | 26 DECLARE_FLAG(int, optimization_counter_threshold); |
| 26 DECLARE_FLAG(bool, propagate_ic_data); | 27 DECLARE_FLAG(bool, propagate_ic_data); |
| 27 DECLARE_FLAG(bool, use_osr); | 28 DECLARE_FLAG(bool, use_osr); |
| 28 | 29 |
| 29 // Generic summary for call instructions that have all arguments pushed | 30 // Generic summary for call instructions that have all arguments pushed |
| 30 // on the stack and return the result in a fixed register R0. | 31 // on the stack and return the result in a fixed register R0. |
| 31 LocationSummary* Instruction::MakeCallSummary() { | 32 LocationSummary* Instruction::MakeCallSummary() { |
| 32 LocationSummary* result = new LocationSummary(0, 0, LocationSummary::kCall); | 33 LocationSummary* result = new LocationSummary(0, 0, LocationSummary::kCall); |
| 33 result->set_out(0, Location::RegisterLocation(R0)); | 34 result->set_out(0, Location::RegisterLocation(R0)); |
| 34 return result; | 35 return result; |
| (...skipping 6133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6168 void GraphEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 6169 void GraphEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 6169 if (!compiler->CanFallThroughTo(normal_entry())) { | 6170 if (!compiler->CanFallThroughTo(normal_entry())) { |
| 6170 __ b(compiler->GetJumpLabel(normal_entry())); | 6171 __ b(compiler->GetJumpLabel(normal_entry())); |
| 6171 } | 6172 } |
| 6172 } | 6173 } |
| 6173 | 6174 |
| 6174 | 6175 |
| 6175 void TargetEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 6176 void TargetEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 6176 __ Bind(compiler->GetJumpLabel(this)); | 6177 __ Bind(compiler->GetJumpLabel(this)); |
| 6177 if (!compiler->is_optimizing()) { | 6178 if (!compiler->is_optimizing()) { |
| 6178 compiler->EmitEdgeCounter(); | 6179 if (FLAG_emit_edge_counters) { |
| 6180 compiler->EmitEdgeCounter(); |
| 6181 } |
| 6179 // Add an edge counter. | 6182 // Add an edge counter. |
| 6180 // On ARM the deoptimization descriptor points after the edge counter | 6183 // On ARM the deoptimization descriptor points after the edge counter |
| 6181 // code so that we can reuse the same pattern matching code as at call | 6184 // code so that we can reuse the same pattern matching code as at call |
| 6182 // sites, which matches backwards from the end of the pattern. | 6185 // sites, which matches backwards from the end of the pattern. |
| 6183 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, | 6186 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, |
| 6184 deopt_id_, | 6187 deopt_id_, |
| 6185 Scanner::kNoSourcePos); | 6188 Scanner::kNoSourcePos); |
| 6186 } | 6189 } |
| 6187 if (HasParallelMove()) { | 6190 if (HasParallelMove()) { |
| 6188 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); | 6191 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); |
| 6189 } | 6192 } |
| 6190 } | 6193 } |
| 6191 | 6194 |
| 6192 | 6195 |
| 6193 LocationSummary* GotoInstr::MakeLocationSummary(bool opt) const { | 6196 LocationSummary* GotoInstr::MakeLocationSummary(bool opt) const { |
| 6194 return new LocationSummary(0, 0, LocationSummary::kNoCall); | 6197 return new LocationSummary(0, 0, LocationSummary::kNoCall); |
| 6195 } | 6198 } |
| 6196 | 6199 |
| 6197 | 6200 |
| 6198 void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 6201 void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 6199 if (!compiler->is_optimizing()) { | 6202 if (!compiler->is_optimizing()) { |
| 6200 compiler->EmitEdgeCounter(); | 6203 if (FLAG_emit_edge_counters) { |
| 6204 compiler->EmitEdgeCounter(); |
| 6205 } |
| 6201 // Add a deoptimization descriptor for deoptimizing instructions that | 6206 // Add a deoptimization descriptor for deoptimizing instructions that |
| 6202 // may be inserted before this instruction. On ARM this descriptor | 6207 // may be inserted before this instruction. On ARM this descriptor |
| 6203 // points after the edge counter code so that we can reuse the same | 6208 // points after the edge counter code so that we can reuse the same |
| 6204 // pattern matching code as at call sites, which matches backwards from | 6209 // pattern matching code as at call sites, which matches backwards from |
| 6205 // the end of the pattern. | 6210 // the end of the pattern. |
| 6206 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, | 6211 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, |
| 6207 GetDeoptId(), | 6212 GetDeoptId(), |
| 6208 Scanner::kNoSourcePos); | 6213 Scanner::kNoSourcePos); |
| 6209 } | 6214 } |
| 6210 if (HasParallelMove()) { | 6215 if (HasParallelMove()) { |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6332 compiler->GenerateCall(token_pos(), | 6337 compiler->GenerateCall(token_pos(), |
| 6333 &label, | 6338 &label, |
| 6334 PcDescriptors::kOther, | 6339 PcDescriptors::kOther, |
| 6335 locs()); | 6340 locs()); |
| 6336 __ Drop(ArgumentCount()); // Discard arguments. | 6341 __ Drop(ArgumentCount()); // Discard arguments. |
| 6337 } | 6342 } |
| 6338 | 6343 |
| 6339 } // namespace dart | 6344 } // namespace dart |
| 6340 | 6345 |
| 6341 #endif // defined TARGET_ARCH_ARM | 6346 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |