| 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/il_printer.h" | 9 #include "vm/il_printer.h" |
| 10 #include "vm/intermediate_language.h" | 10 #include "vm/intermediate_language.h" |
| 11 #include "vm/growable_array.h" | 11 #include "vm/growable_array.h" |
| 12 #include "vm/object_store.h" | 12 #include "vm/object_store.h" |
| 13 #include "vm/report.h" | 13 #include "vm/report.h" |
| 14 | 14 |
| 15 namespace dart { | 15 namespace dart { |
| 16 | 16 |
| 17 DEFINE_FLAG(bool, prune_dead_locals, true, "optimize dead locals away"); | 17 DEFINE_FLAG(bool, prune_dead_locals, true, "optimize dead locals away"); |
| 18 DECLARE_FLAG(bool, emit_edge_counters); |
| 18 DECLARE_FLAG(bool, reorder_basic_blocks); | 19 DECLARE_FLAG(bool, reorder_basic_blocks); |
| 19 DECLARE_FLAG(bool, trace_optimization); | 20 DECLARE_FLAG(bool, trace_optimization); |
| 20 DECLARE_FLAG(bool, verify_compiler); | 21 DECLARE_FLAG(bool, verify_compiler); |
| 21 | 22 |
| 22 | 23 |
| 23 FlowGraph::FlowGraph(const ParsedFunction& parsed_function, | 24 FlowGraph::FlowGraph(const ParsedFunction& parsed_function, |
| 24 GraphEntryInstr* graph_entry, | 25 GraphEntryInstr* graph_entry, |
| 25 intptr_t max_block_id) | 26 intptr_t max_block_id) |
| 26 : thread_(Thread::Current()), | 27 : thread_(Thread::Current()), |
| 27 parent_(), | 28 parent_(), |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 return; | 77 return; |
| 77 } | 78 } |
| 78 } | 79 } |
| 79 to->Add(prefix); | 80 to->Add(prefix); |
| 80 } | 81 } |
| 81 } | 82 } |
| 82 | 83 |
| 83 | 84 |
| 84 bool FlowGraph::ShouldReorderBlocks(const Function& function, | 85 bool FlowGraph::ShouldReorderBlocks(const Function& function, |
| 85 bool is_optimized) { | 86 bool is_optimized) { |
| 86 return is_optimized && FLAG_reorder_basic_blocks && !function.is_intrinsic(); | 87 return is_optimized && FLAG_reorder_basic_blocks && |
| 88 FLAG_emit_edge_counters && !function.is_intrinsic(); |
| 87 } | 89 } |
| 88 | 90 |
| 89 | 91 |
| 90 GrowableArray<BlockEntryInstr*>* FlowGraph::CodegenBlockOrder( | 92 GrowableArray<BlockEntryInstr*>* FlowGraph::CodegenBlockOrder( |
| 91 bool is_optimized) { | 93 bool is_optimized) { |
| 92 return ShouldReorderBlocks(function(), is_optimized) | 94 return ShouldReorderBlocks(function(), is_optimized) |
| 93 ? &optimized_block_order_ | 95 ? &optimized_block_order_ |
| 94 : &reverse_postorder_; | 96 : &reverse_postorder_; |
| 95 } | 97 } |
| 96 | 98 |
| (...skipping 1291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1388 } | 1390 } |
| 1389 | 1391 |
| 1390 | 1392 |
| 1391 bool BlockEffects::IsSideEffectFreePath(BlockEntryInstr* from, | 1393 bool BlockEffects::IsSideEffectFreePath(BlockEntryInstr* from, |
| 1392 BlockEntryInstr* to) const { | 1394 BlockEntryInstr* to) const { |
| 1393 return available_at_[to->postorder_number()]->Contains( | 1395 return available_at_[to->postorder_number()]->Contains( |
| 1394 from->postorder_number()); | 1396 from->postorder_number()); |
| 1395 } | 1397 } |
| 1396 | 1398 |
| 1397 } // namespace dart | 1399 } // namespace dart |
| OLD | NEW |