| 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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 Value* value_; | 244 Value* value_; |
| 245 | 245 |
| 246 private: | 246 private: |
| 247 // Helper to set the output state to return a Value. | 247 // Helper to set the output state to return a Value. |
| 248 virtual void ReturnValue(Value* value) { value_ = value; } | 248 virtual void ReturnValue(Value* value) { value_ = value; } |
| 249 | 249 |
| 250 // Specify a computation as the final result. Adds a Bind instruction to | 250 // Specify a computation as the final result. Adds a Bind instruction to |
| 251 // the graph and returns its temporary value (i.e., set the output | 251 // the graph and returns its temporary value (i.e., set the output |
| 252 // parameters). | 252 // parameters). |
| 253 virtual void ReturnComputation(Computation* computation) { | 253 virtual void ReturnComputation(Computation* computation) { |
| 254 AddInstruction(new BindInstr(temp_index(), computation)); | 254 BindInstr* defn = new BindInstr(temp_index(), computation); |
| 255 value_ = new TempVal(AllocateTempIndex()); | 255 AddInstruction(defn); |
| 256 AllocateTempIndex(); |
| 257 value_ = new UseVal(defn); |
| 256 } | 258 } |
| 257 | 259 |
| 258 virtual void CompiletimeStringInterpolation(const Function& interpol_func, | 260 virtual void CompiletimeStringInterpolation(const Function& interpol_func, |
| 259 const Array& literals); | 261 const Array& literals); |
| 260 | 262 |
| 261 virtual void BuildInstanceOf(ComparisonNode* node); | 263 virtual void BuildInstanceOf(ComparisonNode* node); |
| 262 }; | 264 }; |
| 263 | 265 |
| 264 | 266 |
| 265 // Translate an AstNode to a control-flow graph fragment for both its effects | 267 // Translate an AstNode to a control-flow graph fragment for both its effects |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 intptr_t condition_token_index() const { return condition_token_index_; } | 327 intptr_t condition_token_index() const { return condition_token_index_; } |
| 326 | 328 |
| 327 private: | 329 private: |
| 328 // Construct and concatenate a Branch instruction to this graph fragment. | 330 // Construct and concatenate a Branch instruction to this graph fragment. |
| 329 // Closes the fragment and sets the output parameters. | 331 // Closes the fragment and sets the output parameters. |
| 330 virtual void ReturnValue(Value* value); | 332 virtual void ReturnValue(Value* value); |
| 331 | 333 |
| 332 // Specify a computation as the final result. Adds a Bind instruction to | 334 // Specify a computation as the final result. Adds a Bind instruction to |
| 333 // the graph and branches on its value. | 335 // the graph and branches on its value. |
| 334 virtual void ReturnComputation(Computation* computation) { | 336 virtual void ReturnComputation(Computation* computation) { |
| 335 AddInstruction(new BindInstr(temp_index(), computation)); | 337 BindInstr* defn = new BindInstr(temp_index(), computation); |
| 336 ReturnValue(new TempVal(temp_index())); | 338 AddInstruction(defn); |
| 339 ReturnValue(new UseVal(defn)); |
| 337 } | 340 } |
| 338 | 341 |
| 339 // Output parameters. | 342 // Output parameters. |
| 340 TargetEntryInstr** true_successor_address_; | 343 TargetEntryInstr** true_successor_address_; |
| 341 TargetEntryInstr** false_successor_address_; | 344 TargetEntryInstr** false_successor_address_; |
| 342 | 345 |
| 343 intptr_t condition_node_id_; | 346 intptr_t condition_node_id_; |
| 344 intptr_t condition_token_index_; | 347 intptr_t condition_token_index_; |
| 345 }; | 348 }; |
| 346 | 349 |
| 347 } // namespace dart | 350 } // namespace dart |
| 348 | 351 |
| 349 #endif // VM_FLOW_GRAPH_BUILDER_H_ | 352 #endif // VM_FLOW_GRAPH_BUILDER_H_ |
| OLD | NEW |