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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 }; | 43 }; |
44 | 44 |
45 static void PrepareGraphs(FlowGraph* caller_graph, | 45 static void PrepareGraphs(FlowGraph* caller_graph, |
46 Definition* call, | 46 Definition* call, |
47 FlowGraph* callee_graph); | 47 FlowGraph* callee_graph); |
48 | 48 |
49 BlockEntryInstr* ExitBlockAt(intptr_t i) const { | 49 BlockEntryInstr* ExitBlockAt(intptr_t i) const { |
50 ASSERT(exits_[i].exit_block != NULL); | 50 ASSERT(exits_[i].exit_block != NULL); |
51 return exits_[i].exit_block; | 51 return exits_[i].exit_block; |
52 } | 52 } |
| 53 |
53 Instruction* LastInstructionAt(intptr_t i) const { | 54 Instruction* LastInstructionAt(intptr_t i) const { |
54 return exits_[i].exit_return->previous(); | 55 return ReturnAt(i)->previous(); |
55 } | 56 } |
| 57 |
56 Value* ValueAt(intptr_t i) const { | 58 Value* ValueAt(intptr_t i) const { |
57 return exits_[i].exit_return->value(); | 59 return ReturnAt(i)->value(); |
| 60 } |
| 61 |
| 62 ReturnInstr* ReturnAt(intptr_t i) const { |
| 63 return exits_[i].exit_return; |
58 } | 64 } |
59 | 65 |
60 static int LowestBlockIdFirst(const Data* a, const Data* b); | 66 static int LowestBlockIdFirst(const Data* a, const Data* b); |
61 void SortExits(); | 67 void SortExits(); |
62 | 68 |
63 GrowableArray<Data> exits_; | 69 GrowableArray<Data> exits_; |
64 }; | 70 }; |
65 | 71 |
66 | 72 |
67 // Build a flow graph from a parsed function's AST. | 73 // Build a flow graph from a parsed function's AST. |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 // Output parameters. | 453 // Output parameters. |
448 GrowableArray<TargetEntryInstr**> true_successor_addresses_; | 454 GrowableArray<TargetEntryInstr**> true_successor_addresses_; |
449 GrowableArray<TargetEntryInstr**> false_successor_addresses_; | 455 GrowableArray<TargetEntryInstr**> false_successor_addresses_; |
450 | 456 |
451 intptr_t condition_token_pos_; | 457 intptr_t condition_token_pos_; |
452 }; | 458 }; |
453 | 459 |
454 } // namespace dart | 460 } // namespace dart |
455 | 461 |
456 #endif // VM_FLOW_GRAPH_BUILDER_H_ | 462 #endif // VM_FLOW_GRAPH_BUILDER_H_ |
OLD | NEW |