Chromium Code Reviews| 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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 202 (false_successor_address_ == NULL)); | 202 (false_successor_address_ == NULL)); |
| 203 return true_successor_address_ != NULL; | 203 return true_successor_address_ != NULL; |
| 204 } | 204 } |
| 205 bool can_be_false() const { | 205 bool can_be_false() const { |
| 206 // Either both successors are set or neither is set. | 206 // Either both successors are set or neither is set. |
| 207 ASSERT((true_successor_address_ == NULL) == | 207 ASSERT((true_successor_address_ == NULL) == |
| 208 (false_successor_address_ == NULL)); | 208 (false_successor_address_ == NULL)); |
| 209 return false_successor_address_ != NULL; | 209 return false_successor_address_ != NULL; |
| 210 } | 210 } |
| 211 | 211 |
| 212 TargetEntryInstr** true_successor_address() const { | 212 BlockEntryInstr** true_successor_address() const { |
|
Kevin Millikin (Google)
2012/03/07 09:15:44
The reason this was TargetEntry is to statically e
| |
| 213 ASSERT(can_be_true()); | 213 ASSERT(can_be_true()); |
| 214 return true_successor_address_; | 214 return true_successor_address_; |
| 215 } | 215 } |
| 216 TargetEntryInstr** false_successor_address() const { | 216 BlockEntryInstr** false_successor_address() const { |
| 217 ASSERT(can_be_false()); | 217 ASSERT(can_be_false()); |
| 218 return false_successor_address_; | 218 return false_successor_address_; |
| 219 } | 219 } |
| 220 | 220 |
| 221 private: | 221 private: |
| 222 // Construct and concatenate a Branch instruction to this graph fragment. | 222 // Construct and concatenate a Branch instruction to this graph fragment. |
| 223 // Closes the fragment and sets the output parameters. | 223 // Closes the fragment and sets the output parameters. |
| 224 void ReturnValue(Value* value); | 224 void ReturnValue(Value* value); |
| 225 | 225 |
| 226 // Specify a computation as the final result. Adds a Bind instruction to | 226 // Specify a computation as the final result. Adds a Bind instruction to |
| 227 // the graph and branches on its value. | 227 // the graph and branches on its value. |
| 228 virtual void ReturnComputation(Computation* computation) { | 228 virtual void ReturnComputation(Computation* computation) { |
| 229 AddInstruction(new BindInstr(temp_index(), computation)); | 229 AddInstruction(new BindInstr(temp_index(), computation)); |
| 230 ReturnValue(new TempVal(temp_index())); | 230 ReturnValue(new TempVal(temp_index())); |
| 231 } | 231 } |
| 232 | 232 |
| 233 // Output parameters. | 233 // Output parameters. |
| 234 TargetEntryInstr** true_successor_address_; | 234 BlockEntryInstr** true_successor_address_; |
| 235 TargetEntryInstr** false_successor_address_; | 235 BlockEntryInstr** false_successor_address_; |
| 236 }; | 236 }; |
| 237 | 237 |
| 238 } // namespace dart | 238 } // namespace dart |
| 239 | 239 |
| 240 #endif // VM_FLOW_GRAPH_BUILDER_H_ | 240 #endif // VM_FLOW_GRAPH_BUILDER_H_ |
| OLD | NEW |