| 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 // Sparse conditional constant propagation and unreachable code elimination. | 176 // Sparse conditional constant propagation and unreachable code elimination. |
| 177 // Assumes that use lists are computed and preserves them. | 177 // Assumes that use lists are computed and preserves them. |
| 178 class ConstantPropagator : public FlowGraphVisitor { | 178 class ConstantPropagator : public FlowGraphVisitor { |
| 179 public: | 179 public: |
| 180 ConstantPropagator(FlowGraph* graph, | 180 ConstantPropagator(FlowGraph* graph, |
| 181 const GrowableArray<BlockEntryInstr*>& ignored); | 181 const GrowableArray<BlockEntryInstr*>& ignored); |
| 182 | 182 |
| 183 static void Optimize(FlowGraph* graph); | 183 static void Optimize(FlowGraph* graph); |
| 184 | 184 |
| 185 // Used to initialize the abstract value of definitions. | 185 // Used to initialize the abstract value of definitions. |
| 186 static RawObject* Unknown() { return Object::transition_sentinel(); } | 186 static RawObject* Unknown() { return Object::transition_sentinel().raw(); } |
| 187 | 187 |
| 188 private: | 188 private: |
| 189 void Analyze(); | 189 void Analyze(); |
| 190 void Transform(); | 190 void Transform(); |
| 191 | 191 |
| 192 void SetReachable(BlockEntryInstr* block); | 192 void SetReachable(BlockEntryInstr* block); |
| 193 void SetValue(Definition* definition, const Object& value); | 193 void SetValue(Definition* definition, const Object& value); |
| 194 | 194 |
| 195 // Assign the join (least upper bound) of a pair of abstract values to the | 195 // Assign the join (least upper bound) of a pair of abstract values to the |
| 196 // first one. | 196 // first one. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 | 229 |
| 230 // Worklists of blocks and definitions. | 230 // Worklists of blocks and definitions. |
| 231 GrowableArray<BlockEntryInstr*> block_worklist_; | 231 GrowableArray<BlockEntryInstr*> block_worklist_; |
| 232 GrowableArray<Definition*> definition_worklist_; | 232 GrowableArray<Definition*> definition_worklist_; |
| 233 }; | 233 }; |
| 234 | 234 |
| 235 | 235 |
| 236 } // namespace dart | 236 } // namespace dart |
| 237 | 237 |
| 238 #endif // VM_FLOW_GRAPH_OPTIMIZER_H_ | 238 #endif // VM_FLOW_GRAPH_OPTIMIZER_H_ |
| OLD | NEW |