OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/flow_graph.h" | 5 #include "vm/flow_graph.h" |
6 | 6 |
7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
8 #include "vm/flow_graph_builder.h" | 8 #include "vm/flow_graph_builder.h" |
9 #include "vm/flow_graph_compiler.h" | 9 #include "vm/flow_graph_compiler.h" |
10 #include "vm/flow_graph_range_analysis.h" | 10 #include "vm/flow_graph_range_analysis.h" |
11 #include "vm/il_printer.h" | 11 #include "vm/il_printer.h" |
12 #include "vm/intermediate_language.h" | 12 #include "vm/intermediate_language.h" |
13 #include "vm/growable_array.h" | 13 #include "vm/growable_array.h" |
14 #include "vm/object_store.h" | 14 #include "vm/object_store.h" |
15 | 15 |
16 namespace dart { | 16 namespace dart { |
17 | 17 |
18 #if defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_IA32) | 18 #if defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_IA32) |
19 DEFINE_FLAG(bool, trace_smi_widening, false, "Trace Smi->Int32 widening pass."); | 19 DEFINE_FLAG(bool, trace_smi_widening, false, "Trace Smi->Int32 widening pass."); |
20 #endif | 20 #endif |
21 DEFINE_FLAG(bool, prune_dead_locals, true, "optimize dead locals away"); | 21 DEFINE_FLAG(bool, prune_dead_locals, true, "optimize dead locals away"); |
22 DECLARE_FLAG(bool, reorder_basic_blocks); | |
23 DECLARE_FLAG(bool, verify_compiler); | 22 DECLARE_FLAG(bool, verify_compiler); |
24 | 23 |
25 | 24 |
26 FlowGraph::FlowGraph(const ParsedFunction& parsed_function, | 25 FlowGraph::FlowGraph(const ParsedFunction& parsed_function, |
27 GraphEntryInstr* graph_entry, | 26 GraphEntryInstr* graph_entry, |
28 intptr_t max_block_id) | 27 intptr_t max_block_id) |
29 : thread_(Thread::Current()), | 28 : thread_(Thread::Current()), |
30 parent_(), | 29 parent_(), |
31 current_ssa_temp_index_(0), | 30 current_ssa_temp_index_(0), |
32 max_block_id_(max_block_id), | 31 max_block_id_(max_block_id), |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 return; | 97 return; |
99 } | 98 } |
100 } | 99 } |
101 to->Add(prefix); | 100 to->Add(prefix); |
102 } | 101 } |
103 } | 102 } |
104 | 103 |
105 | 104 |
106 bool FlowGraph::ShouldReorderBlocks(const Function& function, | 105 bool FlowGraph::ShouldReorderBlocks(const Function& function, |
107 bool is_optimized) { | 106 bool is_optimized) { |
108 return is_optimized && FLAG_reorder_basic_blocks && | 107 return is_optimized |
109 FLAG_emit_edge_counters && !function.is_intrinsic(); | 108 && FLAG_reorder_basic_blocks |
| 109 && !function.is_intrinsic(); |
110 } | 110 } |
111 | 111 |
112 | 112 |
113 GrowableArray<BlockEntryInstr*>* FlowGraph::CodegenBlockOrder( | 113 GrowableArray<BlockEntryInstr*>* FlowGraph::CodegenBlockOrder( |
114 bool is_optimized) { | 114 bool is_optimized) { |
115 return ShouldReorderBlocks(function(), is_optimized) | 115 return ShouldReorderBlocks(function(), is_optimized) |
116 ? &optimized_block_order_ | 116 ? &optimized_block_order_ |
117 : &reverse_postorder_; | 117 : &reverse_postorder_; |
118 } | 118 } |
119 | 119 |
(...skipping 1853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1973 ReplaceCurrentInstruction(&it, current, replacement); | 1973 ReplaceCurrentInstruction(&it, current, replacement); |
1974 changed = true; | 1974 changed = true; |
1975 } | 1975 } |
1976 } | 1976 } |
1977 } | 1977 } |
1978 return changed; | 1978 return changed; |
1979 } | 1979 } |
1980 | 1980 |
1981 | 1981 |
1982 } // namespace dart | 1982 } // namespace dart |
OLD | NEW |