| 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 Definition* call_; | 95 Definition* call_; |
| 96 GrowableArray<Data> exits_; | 96 GrowableArray<Data> exits_; |
| 97 }; | 97 }; |
| 98 | 98 |
| 99 | 99 |
| 100 // Build a flow graph from a parsed function's AST. | 100 // Build a flow graph from a parsed function's AST. |
| 101 class FlowGraphBuilder: public ValueObject { | 101 class FlowGraphBuilder: public ValueObject { |
| 102 public: | 102 public: |
| 103 // The inlining context is NULL if not inlining. | 103 // The inlining context is NULL if not inlining. |
| 104 FlowGraphBuilder(const ParsedFunction& parsed_function, | 104 FlowGraphBuilder(const ParsedFunction& parsed_function, |
| 105 const Array& ic_data_array, |
| 105 InlineExitCollector* exit_collector); | 106 InlineExitCollector* exit_collector); |
| 106 | 107 |
| 107 FlowGraph* BuildGraph(); | 108 FlowGraph* BuildGraph(); |
| 108 | 109 |
| 109 const ParsedFunction& parsed_function() const { return parsed_function_; } | 110 const ParsedFunction& parsed_function() const { return parsed_function_; } |
| 111 const Array& ic_data_array() const { return ic_data_array_; } |
| 110 | 112 |
| 111 void Bailout(const char* reason); | 113 void Bailout(const char* reason); |
| 112 | 114 |
| 113 intptr_t AllocateBlockId() { return ++last_used_block_id_; } | 115 intptr_t AllocateBlockId() { return ++last_used_block_id_; } |
| 114 void SetInitialBlockId(intptr_t id) { last_used_block_id_ = id; } | 116 void SetInitialBlockId(intptr_t id) { last_used_block_id_ = id; } |
| 115 | 117 |
| 116 void set_context_level(intptr_t value) { context_level_ = value; } | 118 void set_context_level(intptr_t value) { context_level_ = value; } |
| 117 intptr_t context_level() const { return context_level_; } | 119 intptr_t context_level() const { return context_level_; } |
| 118 | 120 |
| 119 // Each try in this function gets its own try index. | 121 // Each try in this function gets its own try index. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 140 | 142 |
| 141 private: | 143 private: |
| 142 intptr_t parameter_count() const { | 144 intptr_t parameter_count() const { |
| 143 return num_copied_params_ + num_non_copied_params_; | 145 return num_copied_params_ + num_non_copied_params_; |
| 144 } | 146 } |
| 145 intptr_t variable_count() const { | 147 intptr_t variable_count() const { |
| 146 return parameter_count() + num_stack_locals_; | 148 return parameter_count() + num_stack_locals_; |
| 147 } | 149 } |
| 148 | 150 |
| 149 const ParsedFunction& parsed_function_; | 151 const ParsedFunction& parsed_function_; |
| 152 const Array& ic_data_array_; |
| 150 | 153 |
| 151 const intptr_t num_copied_params_; | 154 const intptr_t num_copied_params_; |
| 152 const intptr_t num_non_copied_params_; | 155 const intptr_t num_non_copied_params_; |
| 153 const intptr_t num_stack_locals_; // Does not include any parameters. | 156 const intptr_t num_stack_locals_; // Does not include any parameters. |
| 154 InlineExitCollector* const exit_collector_; | 157 InlineExitCollector* const exit_collector_; |
| 155 | 158 |
| 156 intptr_t last_used_block_id_; | 159 intptr_t last_used_block_id_; |
| 157 intptr_t context_level_; | 160 intptr_t context_level_; |
| 158 intptr_t last_used_try_index_; | 161 intptr_t last_used_try_index_; |
| 159 intptr_t try_index_; | 162 intptr_t try_index_; |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 // Output parameters. | 484 // Output parameters. |
| 482 GrowableArray<TargetEntryInstr**> true_successor_addresses_; | 485 GrowableArray<TargetEntryInstr**> true_successor_addresses_; |
| 483 GrowableArray<TargetEntryInstr**> false_successor_addresses_; | 486 GrowableArray<TargetEntryInstr**> false_successor_addresses_; |
| 484 | 487 |
| 485 intptr_t condition_token_pos_; | 488 intptr_t condition_token_pos_; |
| 486 }; | 489 }; |
| 487 | 490 |
| 488 } // namespace dart | 491 } // namespace dart |
| 489 | 492 |
| 490 #endif // VM_FLOW_GRAPH_BUILDER_H_ | 493 #endif // VM_FLOW_GRAPH_BUILDER_H_ |
| OLD | NEW |