| 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 #ifndef VM_FLOW_GRAPH_OPTIMIZER_H_ | 5 #ifndef VM_FLOW_GRAPH_OPTIMIZER_H_ |
| 6 #define VM_FLOW_GRAPH_OPTIMIZER_H_ | 6 #define VM_FLOW_GRAPH_OPTIMIZER_H_ |
| 7 | 7 |
| 8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 #include "vm/flow_graph.h" | 9 #include "vm/flow_graph.h" |
| 10 | 10 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 void InlineGArrayCapacityGetter(InstanceCallInstr* call); | 78 void InlineGArrayCapacityGetter(InstanceCallInstr* call); |
| 79 void InlineStringLengthGetter(InstanceCallInstr* call); | 79 void InlineStringLengthGetter(InstanceCallInstr* call); |
| 80 void InlineStringIsEmptyTester(InstanceCallInstr* call); | 80 void InlineStringIsEmptyTester(InstanceCallInstr* call); |
| 81 | 81 |
| 82 FlowGraph* flow_graph_; | 82 FlowGraph* flow_graph_; |
| 83 | 83 |
| 84 DISALLOW_COPY_AND_ASSIGN(FlowGraphOptimizer); | 84 DISALLOW_COPY_AND_ASSIGN(FlowGraphOptimizer); |
| 85 }; | 85 }; |
| 86 | 86 |
| 87 | 87 |
| 88 // Analyze the generated flow graph. Currently only if it is a leaf | |
| 89 // method, i.e., does not contain any calls to runtime or other Dart code. | |
| 90 class FlowGraphAnalyzer : public ValueObject { | |
| 91 public: | |
| 92 explicit FlowGraphAnalyzer(const FlowGraph& flow_graph) | |
| 93 : blocks_(flow_graph.reverse_postorder()), is_leaf_(false) {} | |
| 94 virtual ~FlowGraphAnalyzer() {} | |
| 95 | |
| 96 void Analyze(); | |
| 97 | |
| 98 bool is_leaf() const { return is_leaf_; } | |
| 99 | |
| 100 private: | |
| 101 const GrowableArray<BlockEntryInstr*>& blocks_; | |
| 102 bool is_leaf_; | |
| 103 | |
| 104 DISALLOW_COPY_AND_ASSIGN(FlowGraphAnalyzer); | |
| 105 }; | |
| 106 | |
| 107 | |
| 108 class ParsedFunction; | 88 class ParsedFunction; |
| 109 | 89 |
| 110 | 90 |
| 111 class FlowGraphTypePropagator : public FlowGraphVisitor { | 91 class FlowGraphTypePropagator : public FlowGraphVisitor { |
| 112 public: | 92 public: |
| 113 explicit FlowGraphTypePropagator(FlowGraph* flow_graph) | 93 explicit FlowGraphTypePropagator(FlowGraph* flow_graph) |
| 114 : FlowGraphVisitor(flow_graph->reverse_postorder()), | 94 : FlowGraphVisitor(flow_graph->reverse_postorder()), |
| 115 parsed_function_(flow_graph->parsed_function()), | 95 parsed_function_(flow_graph->parsed_function()), |
| 116 flow_graph_(flow_graph), | 96 flow_graph_(flow_graph), |
| 117 still_changing_(false) { } | 97 still_changing_(false) { } |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 | 207 |
| 228 // Worklists of blocks and definitions. | 208 // Worklists of blocks and definitions. |
| 229 GrowableArray<BlockEntryInstr*> block_worklist_; | 209 GrowableArray<BlockEntryInstr*> block_worklist_; |
| 230 GrowableArray<Definition*> definition_worklist_; | 210 GrowableArray<Definition*> definition_worklist_; |
| 231 }; | 211 }; |
| 232 | 212 |
| 233 | 213 |
| 234 } // namespace dart | 214 } // namespace dart |
| 235 | 215 |
| 236 #endif // VM_FLOW_GRAPH_OPTIMIZER_H_ | 216 #endif // VM_FLOW_GRAPH_OPTIMIZER_H_ |
| OLD | NEW |