| 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_BUILDER_H_ | 5 #ifndef VM_FLOW_GRAPH_BUILDER_H_ |
| 6 #define VM_FLOW_GRAPH_BUILDER_H_ | 6 #define VM_FLOW_GRAPH_BUILDER_H_ |
| 7 | 7 |
| 8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 #include "vm/ast.h" | 9 #include "vm/ast.h" |
| 10 #include "vm/growable_array.h" | 10 #include "vm/growable_array.h" |
| 11 #include "vm/intermediate_language.h" | 11 #include "vm/intermediate_language.h" |
| 12 | 12 |
| 13 namespace dart { | 13 namespace dart { |
| 14 | 14 |
| 15 class Instruction; | 15 class Instruction; |
| 16 class ParsedFunction; | 16 class ParsedFunction; |
| 17 | 17 |
| 18 // Build a flow graph from a parsed function's AST. | 18 // Build a flow graph from a parsed function's AST. |
| 19 class FlowGraphBuilder: public ValueObject { | 19 class FlowGraphBuilder: public ValueObject { |
| 20 public: | 20 public: |
| 21 explicit FlowGraphBuilder(const ParsedFunction& parsed_function) | 21 explicit FlowGraphBuilder(const ParsedFunction& parsed_function) |
| 22 : parsed_function_(parsed_function), | 22 : parsed_function_(parsed_function), |
| 23 postorder_block_entries_() { } | 23 postorder_block_entries_() { } |
| 24 | 24 |
| 25 void BuildGraph(); | 25 void BuildGraph(); |
| 26 | 26 |
| 27 const ParsedFunction& parsed_function() const { return parsed_function_; } |
| 28 |
| 27 const GrowableArray<BlockEntryInstr*>* blocks() const { | 29 const GrowableArray<BlockEntryInstr*>* blocks() const { |
| 28 return &postorder_block_entries_; | 30 return &postorder_block_entries_; |
| 29 } | 31 } |
| 30 | 32 |
| 31 const ParsedFunction& parsed_function() const { return parsed_function_; } | |
| 32 | |
| 33 void Bailout(const char* reason); | 33 void Bailout(const char* reason); |
| 34 | 34 |
| 35 private: | 35 private: |
| 36 const ParsedFunction& parsed_function_; | 36 const ParsedFunction& parsed_function_; |
| 37 GrowableArray<BlockEntryInstr*> postorder_block_entries_; | 37 GrowableArray<BlockEntryInstr*> postorder_block_entries_; |
| 38 }; | 38 }; |
| 39 | 39 |
| 40 | 40 |
| 41 class TestGraphVisitor; | 41 class TestGraphVisitor; |
| 42 | 42 |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 } | 256 } |
| 257 | 257 |
| 258 // Output parameters. | 258 // Output parameters. |
| 259 BlockEntryInstr** true_successor_address_; | 259 BlockEntryInstr** true_successor_address_; |
| 260 BlockEntryInstr** false_successor_address_; | 260 BlockEntryInstr** false_successor_address_; |
| 261 }; | 261 }; |
| 262 | 262 |
| 263 } // namespace dart | 263 } // namespace dart |
| 264 | 264 |
| 265 #endif // VM_FLOW_GRAPH_BUILDER_H_ | 265 #endif // VM_FLOW_GRAPH_BUILDER_H_ |
| OLD | NEW |