| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 Instruction* exit() const { return exit_; } | 101 Instruction* exit() const { return exit_; } |
| 102 | 102 |
| 103 bool is_empty() const { return entry_ == NULL; } | 103 bool is_empty() const { return entry_ == NULL; } |
| 104 bool is_open() const { return is_empty() || exit_ != NULL; } | 104 bool is_open() const { return is_empty() || exit_ != NULL; } |
| 105 | 105 |
| 106 void Bailout(const char* reason); | 106 void Bailout(const char* reason); |
| 107 | 107 |
| 108 // Append a graph fragment to this graph. Assumes this graph is open. | 108 // Append a graph fragment to this graph. Assumes this graph is open. |
| 109 void Append(const EffectGraphVisitor& other_fragment); | 109 void Append(const EffectGraphVisitor& other_fragment); |
| 110 // Append a computation with one use. Assumes this graph is open. | 110 // Append a computation with one use. Assumes this graph is open. |
| 111 UseVal* Bind(Computation* computation); | 111 Value* Bind(Computation* computation); |
| 112 // Append a computation with no uses. Assumes this graph is open. | 112 // Append a computation with no uses. Assumes this graph is open. |
| 113 void Do(Computation* computation); | 113 void Do(Computation* computation); |
| 114 // Append a single (non-Definition, non-Entry) instruction. Assumes this | 114 // Append a single (non-Definition, non-Entry) instruction. Assumes this |
| 115 // graph is open. | 115 // graph is open. |
| 116 void AddInstruction(Instruction* instruction); | 116 void AddInstruction(Instruction* instruction); |
| 117 // Append a Goto (unconditional control flow) instruction and close | 117 // Append a Goto (unconditional control flow) instruction and close |
| 118 // the graph fragment. Assumes this graph fragment is open. | 118 // the graph fragment. Assumes this graph fragment is open. |
| 119 void Goto(JoinEntryInstr* join); | 119 void Goto(JoinEntryInstr* join); |
| 120 | 120 |
| 121 // Append a 'diamond' branch and join to this graph, depending on which | 121 // Append a 'diamond' branch and join to this graph, depending on which |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 virtual void VisitStaticSetterNode(StaticSetterNode* node); | 273 virtual void VisitStaticSetterNode(StaticSetterNode* node); |
| 274 | 274 |
| 275 Value* value() const { return value_; } | 275 Value* value() const { return value_; } |
| 276 | 276 |
| 277 protected: | 277 protected: |
| 278 // Output parameters. | 278 // Output parameters. |
| 279 Value* value_; | 279 Value* value_; |
| 280 | 280 |
| 281 private: | 281 private: |
| 282 // Helper to set the output state to return a Value. | 282 // Helper to set the output state to return a Value. |
| 283 virtual void ReturnValue(Value* value) { | 283 virtual void ReturnValue(Value* value) { value_ = value; } |
| 284 ASSERT(value->IsUse()); | |
| 285 value_ = value; | |
| 286 } | |
| 287 | 284 |
| 288 // Specify a computation as the final result. Adds a Bind instruction to | 285 // Specify a computation as the final result. Adds a Bind instruction to |
| 289 // the graph and returns its temporary value (i.e., set the output | 286 // the graph and returns its temporary value (i.e., set the output |
| 290 // parameters). | 287 // parameters). |
| 291 virtual void ReturnComputation(Computation* computation) { | 288 virtual void ReturnComputation(Computation* computation) { |
| 292 ReturnValue(Bind(computation)); | 289 ReturnValue(Bind(computation)); |
| 293 } | 290 } |
| 294 | 291 |
| 295 virtual void BuildTypeTest(ComparisonNode* node); | 292 virtual void BuildTypeTest(ComparisonNode* node); |
| 296 virtual void BuildTypeCast(ComparisonNode* node); | 293 virtual void BuildTypeCast(ComparisonNode* node); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 // Output parameters. | 347 // Output parameters. |
| 351 TargetEntryInstr** true_successor_address_; | 348 TargetEntryInstr** true_successor_address_; |
| 352 TargetEntryInstr** false_successor_address_; | 349 TargetEntryInstr** false_successor_address_; |
| 353 | 350 |
| 354 intptr_t condition_token_pos_; | 351 intptr_t condition_token_pos_; |
| 355 }; | 352 }; |
| 356 | 353 |
| 357 } // namespace dart | 354 } // namespace dart |
| 358 | 355 |
| 359 #endif // VM_FLOW_GRAPH_BUILDER_H_ | 356 #endif // VM_FLOW_GRAPH_BUILDER_H_ |
| OLD | NEW |