| 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 // Moves parent context into the context register. | 186 // Moves parent context into the context register. |
| 187 void UnchainContext(); | 187 void UnchainContext(); |
| 188 | 188 |
| 189 void CloseFragment() { exit_ = NULL; } | 189 void CloseFragment() { exit_ = NULL; } |
| 190 intptr_t AllocateTempIndex() { return temp_index_++; } | 190 intptr_t AllocateTempIndex() { return temp_index_++; } |
| 191 void DeallocateTempIndex(intptr_t n) { | 191 void DeallocateTempIndex(intptr_t n) { |
| 192 ASSERT(temp_index_ >= n); | 192 ASSERT(temp_index_ >= n); |
| 193 temp_index_ -= n; | 193 temp_index_ -= n; |
| 194 } | 194 } |
| 195 | 195 |
| 196 virtual void CompiletimeStringInterpolation(const Function& interpol_func, | |
| 197 const Array& literals); | |
| 198 | |
| 199 BindInstr* BuildObjectAllocation(ConstructorCallNode* node); | 196 BindInstr* BuildObjectAllocation(ConstructorCallNode* node); |
| 200 void BuildConstructorCall(ConstructorCallNode* node, Value* alloc_value); | 197 void BuildConstructorCall(ConstructorCallNode* node, Value* alloc_value); |
| 201 | 198 |
| 202 void BuildStoreContext(const LocalVariable& variable); | 199 void BuildStoreContext(const LocalVariable& variable); |
| 203 void BuildLoadContext(const LocalVariable& variable); | 200 void BuildLoadContext(const LocalVariable& variable); |
| 204 | 201 |
| 205 void BuildThrowNode(ThrowNode* node); | 202 void BuildThrowNode(ThrowNode* node); |
| 206 | 203 |
| 207 ClosureCallComp* BuildClosureCall(ClosureCallNode* node); | 204 ClosureCallComp* BuildClosureCall(ClosureCallNode* node); |
| 208 | 205 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 | 262 |
| 266 // Specify a computation as the final result. Adds a Bind instruction to | 263 // Specify a computation as the final result. Adds a Bind instruction to |
| 267 // the graph and returns its temporary value (i.e., set the output | 264 // the graph and returns its temporary value (i.e., set the output |
| 268 // parameters). | 265 // parameters). |
| 269 virtual void ReturnComputation(Computation* computation) { | 266 virtual void ReturnComputation(Computation* computation) { |
| 270 BindInstr* defn = new BindInstr(computation); | 267 BindInstr* defn = new BindInstr(computation); |
| 271 AddInstruction(defn); | 268 AddInstruction(defn); |
| 272 ReturnValue(new UseVal(defn)); | 269 ReturnValue(new UseVal(defn)); |
| 273 } | 270 } |
| 274 | 271 |
| 275 virtual void CompiletimeStringInterpolation(const Function& interpol_func, | |
| 276 const Array& literals); | |
| 277 | |
| 278 virtual void BuildTypeTest(ComparisonNode* node); | 272 virtual void BuildTypeTest(ComparisonNode* node); |
| 279 virtual void BuildTypeCast(ComparisonNode* node); | 273 virtual void BuildTypeCast(ComparisonNode* node); |
| 280 }; | 274 }; |
| 281 | 275 |
| 282 | 276 |
| 283 // Translate an AstNode to a control-flow graph fragment for both its | 277 // Translate an AstNode to a control-flow graph fragment for both its |
| 284 // effects and true/false control flow (e.g., for an expression in a test | 278 // effects and true/false control flow (e.g., for an expression in a test |
| 285 // context). The resulting graph is always closed (even if it is empty) | 279 // context). The resulting graph is always closed (even if it is empty) |
| 286 // Successor control flow is explicitly set by a pair of pointers to | 280 // Successor control flow is explicitly set by a pair of pointers to |
| 287 // TargetEntryInstr*. | 281 // TargetEntryInstr*. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 // Output parameters. | 321 // Output parameters. |
| 328 TargetEntryInstr** true_successor_address_; | 322 TargetEntryInstr** true_successor_address_; |
| 329 TargetEntryInstr** false_successor_address_; | 323 TargetEntryInstr** false_successor_address_; |
| 330 | 324 |
| 331 intptr_t condition_token_pos_; | 325 intptr_t condition_token_pos_; |
| 332 }; | 326 }; |
| 333 | 327 |
| 334 } // namespace dart | 328 } // namespace dart |
| 335 | 329 |
| 336 #endif // VM_FLOW_GRAPH_BUILDER_H_ | 330 #endif // VM_FLOW_GRAPH_BUILDER_H_ |
| OLD | NEW |