| 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" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 void set_context_level(intptr_t value) { context_level_ = value; } | 33 void set_context_level(intptr_t value) { context_level_ = value; } |
| 34 intptr_t context_level() const { return context_level_; } | 34 intptr_t context_level() const { return context_level_; } |
| 35 | 35 |
| 36 // Each try in this function gets its own try index. | 36 // Each try in this function gets its own try index. |
| 37 intptr_t AllocateTryIndex() { return ++last_used_try_index_; } | 37 intptr_t AllocateTryIndex() { return ++last_used_try_index_; } |
| 38 | 38 |
| 39 // Manage the currently active try index. | 39 // Manage the currently active try index. |
| 40 void set_try_index(intptr_t value) { try_index_ = value; } | 40 void set_try_index(intptr_t value) { try_index_ = value; } |
| 41 intptr_t try_index() const { return try_index_; } | 41 intptr_t try_index() const { return try_index_; } |
| 42 | 42 |
| 43 void AddCatchEntry(intptr_t try_index, Instruction* entry); | 43 void AddCatchEntry(TargetEntryInstr* entry); |
| 44 | 44 |
| 45 private: | 45 private: |
| 46 void ComputeDominators(GrowableArray<BlockEntryInstr*>* preorder, | 46 void ComputeDominators(GrowableArray<BlockEntryInstr*>* preorder, |
| 47 GrowableArray<intptr_t>* parent); | 47 GrowableArray<intptr_t>* parent); |
| 48 void CompressPath(intptr_t start_index, | 48 void CompressPath(intptr_t start_index, |
| 49 intptr_t current_index, | 49 intptr_t current_index, |
| 50 GrowableArray<intptr_t>* parent, | 50 GrowableArray<intptr_t>* parent, |
| 51 GrowableArray<intptr_t>* label); | 51 GrowableArray<intptr_t>* label); |
| 52 | 52 |
| 53 const ParsedFunction& parsed_function_; | 53 const ParsedFunction& parsed_function_; |
| 54 GrowableArray<BlockEntryInstr*> preorder_block_entries_; | 54 GrowableArray<BlockEntryInstr*> preorder_block_entries_; |
| 55 GrowableArray<BlockEntryInstr*> postorder_block_entries_; | 55 GrowableArray<BlockEntryInstr*> postorder_block_entries_; |
| 56 intptr_t context_level_; | 56 intptr_t context_level_; |
| 57 intptr_t last_used_try_index_; | 57 intptr_t last_used_try_index_; |
| 58 intptr_t try_index_; | 58 intptr_t try_index_; |
| 59 GrowableArray<Instruction*> catch_entries_; | 59 GraphEntryInstr* graph_entry_; |
| 60 | 60 |
| 61 DISALLOW_IMPLICIT_CONSTRUCTORS(FlowGraphBuilder); | 61 DISALLOW_IMPLICIT_CONSTRUCTORS(FlowGraphBuilder); |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 | 64 |
| 65 class TestGraphVisitor; | 65 class TestGraphVisitor; |
| 66 | 66 |
| 67 // Translate an AstNode to a control-flow graph fragment for its effects | 67 // Translate an AstNode to a control-flow graph fragment for its effects |
| 68 // (e.g., a statement or an expression in an effect context). Implements a | 68 // (e.g., a statement or an expression in an effect context). Implements a |
| 69 // function from an AstNode and next temporary index to a graph fragment | 69 // function from an AstNode and next temporary index to a graph fragment |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 // Output parameters. | 285 // Output parameters. |
| 286 TargetEntryInstr** true_successor_address_; | 286 TargetEntryInstr** true_successor_address_; |
| 287 TargetEntryInstr** false_successor_address_; | 287 TargetEntryInstr** false_successor_address_; |
| 288 | 288 |
| 289 intptr_t condition_token_index_; | 289 intptr_t condition_token_index_; |
| 290 }; | 290 }; |
| 291 | 291 |
| 292 } // namespace dart | 292 } // namespace dart |
| 293 | 293 |
| 294 #endif // VM_FLOW_GRAPH_BUILDER_H_ | 294 #endif // VM_FLOW_GRAPH_BUILDER_H_ |
| OLD | NEW |