| 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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 Value* value() const { return value_; } | 136 Value* value() const { return value_; } |
| 137 | 137 |
| 138 private: | 138 private: |
| 139 // Helper to set the output state to return a Value. | 139 // Helper to set the output state to return a Value. |
| 140 void ReturnValue(Value* value) { value_ = value; } | 140 void ReturnValue(Value* value) { value_ = value; } |
| 141 | 141 |
| 142 // Helper to append a Bind instruction to the graph and return its | 142 // Helper to append a Bind instruction to the graph and return its |
| 143 // temporary value (i.e., set the output parameters). | 143 // temporary value (i.e., set the output parameters). |
| 144 void ReturnValueOf(Computation* computation) { | 144 void ReturnValueOf(Computation* computation) { |
| 145 AddInstruction(new BindInstr(temp_index(), computation)); | 145 AddInstruction(new BindInstr(temp_index(), computation)); |
| 146 value_ = new TempValue(AllocateTempIndex()); | 146 value_ = new TempVal(AllocateTempIndex()); |
| 147 } | 147 } |
| 148 | 148 |
| 149 // Output parameters. | 149 // Output parameters. |
| 150 Value* value_; | 150 Value* value_; |
| 151 }; | 151 }; |
| 152 | 152 |
| 153 | 153 |
| 154 // Translate an AstNode to a control-flow graph fragment for both its | 154 // Translate an AstNode to a control-flow graph fragment for both its |
| 155 // effects and true/false control flow (e.g., for an expression in a test | 155 // effects and true/false control flow (e.g., for an expression in a test |
| 156 // context). The resulting graph is always closed (even if it is empty) | 156 // context). The resulting graph is always closed (even if it is empty) |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 } | 198 } |
| 199 | 199 |
| 200 private: | 200 private: |
| 201 // Construct and concatenate a Branch instruction to this graph fragment. | 201 // Construct and concatenate a Branch instruction to this graph fragment. |
| 202 // Closes the fragment and sets the output parameters. | 202 // Closes the fragment and sets the output parameters. |
| 203 void BranchOnValue(Value* value); | 203 void BranchOnValue(Value* value); |
| 204 | 204 |
| 205 // Helper to bind a computation and branch on its value. | 205 // Helper to bind a computation and branch on its value. |
| 206 void BranchOnValueOf(Computation* computation) { | 206 void BranchOnValueOf(Computation* computation) { |
| 207 AddInstruction(new BindInstr(temp_index(), computation)); | 207 AddInstruction(new BindInstr(temp_index(), computation)); |
| 208 BranchOnValue(new TempValue(temp_index())); | 208 BranchOnValue(new TempVal(temp_index())); |
| 209 } | 209 } |
| 210 | 210 |
| 211 // Output parameters. | 211 // Output parameters. |
| 212 TargetEntryInstr** true_successor_address_; | 212 TargetEntryInstr** true_successor_address_; |
| 213 TargetEntryInstr** false_successor_address_; | 213 TargetEntryInstr** false_successor_address_; |
| 214 }; | 214 }; |
| 215 | 215 |
| 216 #undef DEFINE_VISIT | 216 #undef DEFINE_VISIT |
| 217 | 217 |
| 218 | 218 |
| 219 } // namespace dart | 219 } // namespace dart |
| 220 | 220 |
| 221 #endif // VM_FLOW_GRAPH_BUILDER_H_ | 221 #endif // VM_FLOW_GRAPH_BUILDER_H_ |
| OLD | NEW |