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_X64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
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/stack_frame.h" | 15 #include "vm/stack_frame.h" |
16 #include "vm/stub_code.h" | 16 #include "vm/stub_code.h" |
17 #include "vm/symbols.h" | 17 #include "vm/symbols.h" |
18 | 18 |
19 #define __ compiler->assembler()-> | 19 #define __ compiler->assembler()-> |
20 | 20 |
21 namespace dart { | 21 namespace dart { |
22 | 22 |
| 23 DECLARE_FLAG(bool, emit_edge_counters); |
23 DECLARE_FLAG(int, optimization_counter_threshold); | 24 DECLARE_FLAG(int, optimization_counter_threshold); |
24 DECLARE_FLAG(bool, propagate_ic_data); | 25 DECLARE_FLAG(bool, propagate_ic_data); |
25 DECLARE_FLAG(bool, throw_on_javascript_int_overflow); | 26 DECLARE_FLAG(bool, throw_on_javascript_int_overflow); |
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 RAX. | 30 // on the stack and return the result in a fixed register RAX. |
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(RAX)); | 33 result->set_out(0, Location::RegisterLocation(RAX)); |
(...skipping 5523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5556 void GraphEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 5557 void GraphEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
5557 if (!compiler->CanFallThroughTo(normal_entry())) { | 5558 if (!compiler->CanFallThroughTo(normal_entry())) { |
5558 __ jmp(compiler->GetJumpLabel(normal_entry())); | 5559 __ jmp(compiler->GetJumpLabel(normal_entry())); |
5559 } | 5560 } |
5560 } | 5561 } |
5561 | 5562 |
5562 | 5563 |
5563 void TargetEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 5564 void TargetEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
5564 __ Bind(compiler->GetJumpLabel(this)); | 5565 __ Bind(compiler->GetJumpLabel(this)); |
5565 if (!compiler->is_optimizing()) { | 5566 if (!compiler->is_optimizing()) { |
5566 compiler->EmitEdgeCounter(); | 5567 if (FLAG_emit_edge_counters) { |
| 5568 compiler->EmitEdgeCounter(); |
| 5569 } |
5567 // The deoptimization descriptor points after the edge counter code for | 5570 // The deoptimization descriptor points after the edge counter code for |
5568 // uniformity with ARM and MIPS, where we can reuse pattern matching | 5571 // uniformity with ARM and MIPS, where we can reuse pattern matching |
5569 // code that matches backwards from the end of the pattern. | 5572 // code that matches backwards from the end of the pattern. |
5570 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, | 5573 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, |
5571 deopt_id_, | 5574 deopt_id_, |
5572 Scanner::kNoSourcePos); | 5575 Scanner::kNoSourcePos); |
5573 } | 5576 } |
5574 if (HasParallelMove()) { | 5577 if (HasParallelMove()) { |
5575 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); | 5578 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); |
5576 } | 5579 } |
5577 } | 5580 } |
5578 | 5581 |
5579 | 5582 |
5580 LocationSummary* GotoInstr::MakeLocationSummary(bool opt) const { | 5583 LocationSummary* GotoInstr::MakeLocationSummary(bool opt) const { |
5581 return new LocationSummary(0, 0, LocationSummary::kNoCall); | 5584 return new LocationSummary(0, 0, LocationSummary::kNoCall); |
5582 } | 5585 } |
5583 | 5586 |
5584 | 5587 |
5585 void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 5588 void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
5586 if (!compiler->is_optimizing()) { | 5589 if (!compiler->is_optimizing()) { |
5587 compiler->EmitEdgeCounter(); | 5590 if (FLAG_emit_edge_counters) { |
| 5591 compiler->EmitEdgeCounter(); |
| 5592 } |
5588 // Add a deoptimization descriptor for deoptimizing instructions that | 5593 // Add a deoptimization descriptor for deoptimizing instructions that |
5589 // may be inserted before this instruction. This descriptor points | 5594 // may be inserted before this instruction. This descriptor points |
5590 // after the edge counter for uniformity with ARM and MIPS, where we can | 5595 // after the edge counter for uniformity with ARM and MIPS, where we can |
5591 // reuse pattern matching that matches backwards from the end of the | 5596 // reuse pattern matching that matches backwards from the end of the |
5592 // pattern. | 5597 // pattern. |
5593 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, | 5598 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, |
5594 GetDeoptId(), | 5599 GetDeoptId(), |
5595 Scanner::kNoSourcePos); | 5600 Scanner::kNoSourcePos); |
5596 } | 5601 } |
5597 if (HasParallelMove()) { | 5602 if (HasParallelMove()) { |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5782 PcDescriptors::kOther, | 5787 PcDescriptors::kOther, |
5783 locs()); | 5788 locs()); |
5784 __ Drop(ArgumentCount()); // Discard arguments. | 5789 __ Drop(ArgumentCount()); // Discard arguments. |
5785 } | 5790 } |
5786 | 5791 |
5787 } // namespace dart | 5792 } // namespace dart |
5788 | 5793 |
5789 #undef __ | 5794 #undef __ |
5790 | 5795 |
5791 #endif // defined TARGET_ARCH_X64 | 5796 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |