| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 void Join(const TestGraphVisitor& test_fragment, | 135 void Join(const TestGraphVisitor& test_fragment, |
| 136 const EffectGraphVisitor& true_fragment, | 136 const EffectGraphVisitor& true_fragment, |
| 137 const EffectGraphVisitor& false_fragment); | 137 const EffectGraphVisitor& false_fragment); |
| 138 | 138 |
| 139 // Append a 'while loop' test and back edge to this graph, depending on | 139 // Append a 'while loop' test and back edge to this graph, depending on |
| 140 // which parts are reachable. Afterward, the graph exit is the false | 140 // which parts are reachable. Afterward, the graph exit is the false |
| 141 // successor of the loop condition. | 141 // successor of the loop condition. |
| 142 void TieLoop(const TestGraphVisitor& test_fragment, | 142 void TieLoop(const TestGraphVisitor& test_fragment, |
| 143 const EffectGraphVisitor& body_fragment); | 143 const EffectGraphVisitor& body_fragment); |
| 144 | 144 |
| 145 // Wraps a value in a push-argument instruction and adds the result to the |
| 146 // graph. |
| 147 PushArgumentInstr* PushArgument(Value* value); |
| 148 |
| 145 protected: | 149 protected: |
| 146 Computation* BuildStoreLocal(const LocalVariable& local, Value* value); | 150 Computation* BuildStoreLocal(const LocalVariable& local, Value* value); |
| 147 Computation* BuildLoadLocal(const LocalVariable& local); | 151 Computation* BuildLoadLocal(const LocalVariable& local); |
| 148 | 152 |
| 149 // Helpers for translating parts of the AST. | 153 // Helpers for translating parts of the AST. |
| 150 void TranslateArgumentList(const ArgumentListNode& node, | 154 void TranslateArgumentList(const ArgumentListNode& node, |
| 151 ZoneGrowableArray<Value*>* values); | 155 ZoneGrowableArray<Value*>* values); |
| 152 void BuildPushArguments(const ArgumentListNode& node, | 156 void BuildPushArguments(const ArgumentListNode& node, |
| 153 ZoneGrowableArray<PushArgumentInstr*>* values); | 157 ZoneGrowableArray<PushArgumentInstr*>* values); |
| 154 | 158 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 void UnchainContext(); | 206 void UnchainContext(); |
| 203 | 207 |
| 204 void CloseFragment() { exit_ = NULL; } | 208 void CloseFragment() { exit_ = NULL; } |
| 205 intptr_t AllocateTempIndex() { return temp_index_++; } | 209 intptr_t AllocateTempIndex() { return temp_index_++; } |
| 206 void DeallocateTempIndex(intptr_t n) { | 210 void DeallocateTempIndex(intptr_t n) { |
| 207 ASSERT(temp_index_ >= n); | 211 ASSERT(temp_index_ >= n); |
| 208 temp_index_ -= n; | 212 temp_index_ -= n; |
| 209 } | 213 } |
| 210 | 214 |
| 211 Value* BuildObjectAllocation(ConstructorCallNode* node); | 215 Value* BuildObjectAllocation(ConstructorCallNode* node); |
| 212 void BuildConstructorCall(ConstructorCallNode* node, Value* alloc_value); | 216 void BuildConstructorCall(ConstructorCallNode* node, |
| 217 PushArgumentInstr* alloc_value); |
| 213 | 218 |
| 214 void BuildStoreContext(const LocalVariable& variable); | 219 void BuildStoreContext(const LocalVariable& variable); |
| 215 void BuildLoadContext(const LocalVariable& variable); | 220 void BuildLoadContext(const LocalVariable& variable); |
| 216 | 221 |
| 217 void BuildThrowNode(ThrowNode* node); | 222 void BuildThrowNode(ThrowNode* node); |
| 218 | 223 |
| 219 ClosureCallComp* BuildClosureCall(ClosureCallNode* node); | 224 ClosureCallComp* BuildClosureCall(ClosureCallNode* node); |
| 220 | 225 |
| 221 Value* BuildNullValue(); | 226 Value* BuildNullValue(); |
| 222 | 227 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 // Output parameters. | 351 // Output parameters. |
| 347 TargetEntryInstr** true_successor_address_; | 352 TargetEntryInstr** true_successor_address_; |
| 348 TargetEntryInstr** false_successor_address_; | 353 TargetEntryInstr** false_successor_address_; |
| 349 | 354 |
| 350 intptr_t condition_token_pos_; | 355 intptr_t condition_token_pos_; |
| 351 }; | 356 }; |
| 352 | 357 |
| 353 } // namespace dart | 358 } // namespace dart |
| 354 | 359 |
| 355 #endif // VM_FLOW_GRAPH_BUILDER_H_ | 360 #endif // VM_FLOW_GRAPH_BUILDER_H_ |
| OLD | NEW |