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_MIPS. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS. |
6 #if defined(TARGET_ARCH_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
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, propagate_ic_data); | 26 DECLARE_FLAG(bool, propagate_ic_data); |
26 DECLARE_FLAG(bool, use_osr); | 27 DECLARE_FLAG(bool, use_osr); |
27 | 28 |
28 // Generic summary for call instructions that have all arguments pushed | 29 // Generic summary for call instructions that have all arguments pushed |
29 // on the stack and return the result in a fixed register V0. | 30 // on the stack and return the result in a fixed register V0. |
30 LocationSummary* Instruction::MakeCallSummary() { | 31 LocationSummary* Instruction::MakeCallSummary() { |
31 LocationSummary* result = new LocationSummary(0, 0, LocationSummary::kCall); | 32 LocationSummary* result = new LocationSummary(0, 0, LocationSummary::kCall); |
32 result->set_out(0, Location::RegisterLocation(V0)); | 33 result->set_out(0, Location::RegisterLocation(V0)); |
33 return result; | 34 return result; |
(...skipping 4440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4474 void GraphEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4475 void GraphEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
4475 if (!compiler->CanFallThroughTo(normal_entry())) { | 4476 if (!compiler->CanFallThroughTo(normal_entry())) { |
4476 __ b(compiler->GetJumpLabel(normal_entry())); | 4477 __ b(compiler->GetJumpLabel(normal_entry())); |
4477 } | 4478 } |
4478 } | 4479 } |
4479 | 4480 |
4480 | 4481 |
4481 void TargetEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4482 void TargetEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
4482 __ Bind(compiler->GetJumpLabel(this)); | 4483 __ Bind(compiler->GetJumpLabel(this)); |
4483 if (!compiler->is_optimizing()) { | 4484 if (!compiler->is_optimizing()) { |
4484 compiler->EmitEdgeCounter(); | 4485 if (FLAG_emit_edge_counters) { |
| 4486 compiler->EmitEdgeCounter(); |
| 4487 } |
4485 // On MIPS the deoptimization descriptor points after the edge counter | 4488 // On MIPS the deoptimization descriptor points after the edge counter |
4486 // code so that we can reuse the same pattern matching code as at call | 4489 // code so that we can reuse the same pattern matching code as at call |
4487 // sites, which matches backwards from the end of the pattern. | 4490 // sites, which matches backwards from the end of the pattern. |
4488 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, | 4491 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, |
4489 deopt_id_, | 4492 deopt_id_, |
4490 Scanner::kNoSourcePos); | 4493 Scanner::kNoSourcePos); |
4491 } | 4494 } |
4492 if (HasParallelMove()) { | 4495 if (HasParallelMove()) { |
4493 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); | 4496 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); |
4494 } | 4497 } |
4495 } | 4498 } |
4496 | 4499 |
4497 | 4500 |
4498 LocationSummary* GotoInstr::MakeLocationSummary(bool opt) const { | 4501 LocationSummary* GotoInstr::MakeLocationSummary(bool opt) const { |
4499 return new LocationSummary(0, 0, LocationSummary::kNoCall); | 4502 return new LocationSummary(0, 0, LocationSummary::kNoCall); |
4500 } | 4503 } |
4501 | 4504 |
4502 | 4505 |
4503 void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4506 void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
4504 __ TraceSimMsg("GotoInstr"); | 4507 __ TraceSimMsg("GotoInstr"); |
4505 if (!compiler->is_optimizing()) { | 4508 if (!compiler->is_optimizing()) { |
4506 compiler->EmitEdgeCounter(); | 4509 if (FLAG_emit_edge_counters) { |
| 4510 compiler->EmitEdgeCounter(); |
| 4511 } |
4507 // Add a deoptimization descriptor for deoptimizing instructions that | 4512 // Add a deoptimization descriptor for deoptimizing instructions that |
4508 // may be inserted before this instruction. On MIPS this descriptor | 4513 // may be inserted before this instruction. On MIPS this descriptor |
4509 // points after the edge counter code so that we can reuse the same | 4514 // points after the edge counter code so that we can reuse the same |
4510 // pattern matching code as at call sites, which matches backwards from | 4515 // pattern matching code as at call sites, which matches backwards from |
4511 // the end of the pattern. | 4516 // the end of the pattern. |
4512 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, | 4517 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, |
4513 GetDeoptId(), | 4518 GetDeoptId(), |
4514 Scanner::kNoSourcePos); | 4519 Scanner::kNoSourcePos); |
4515 } | 4520 } |
4516 if (HasParallelMove()) { | 4521 if (HasParallelMove()) { |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4650 compiler->GenerateCall(token_pos(), | 4655 compiler->GenerateCall(token_pos(), |
4651 &label, | 4656 &label, |
4652 PcDescriptors::kOther, | 4657 PcDescriptors::kOther, |
4653 locs()); | 4658 locs()); |
4654 __ Drop(ArgumentCount()); // Discard arguments. | 4659 __ Drop(ArgumentCount()); // Discard arguments. |
4655 } | 4660 } |
4656 | 4661 |
4657 } // namespace dart | 4662 } // namespace dart |
4658 | 4663 |
4659 #endif // defined TARGET_ARCH_MIPS | 4664 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |