| 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 "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "platform/globals.h" | 9 #include "platform/globals.h" |
| 10 #include "vm/allocation.h" | 10 #include "vm/allocation.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 InlineExitCollector(FlowGraph* caller_graph, Definition* call) | 35 InlineExitCollector(FlowGraph* caller_graph, Definition* call) |
| 36 : caller_graph_(caller_graph), call_(call), exits_(4) { } | 36 : caller_graph_(caller_graph), call_(call), exits_(4) { } |
| 37 | 37 |
| 38 void AddExit(ReturnInstr* exit); | 38 void AddExit(ReturnInstr* exit); |
| 39 | 39 |
| 40 void Union(const InlineExitCollector* other); | 40 void Union(const InlineExitCollector* other); |
| 41 | 41 |
| 42 // Before replacing a call with a graph, the outer environment needs to be | 42 // Before replacing a call with a graph, the outer environment needs to be |
| 43 // attached to each instruction in the callee graph and the caller graph | 43 // attached to each instruction in the callee graph and the caller graph |
| 44 // needs to have its block and instruction ID state updated. | 44 // needs to have its block and instruction ID state updated. |
| 45 // Additionally we need to remove all unreachable exits from the list of |
| 46 // collected exits. |
| 45 void PrepareGraphs(FlowGraph* callee_graph); | 47 void PrepareGraphs(FlowGraph* callee_graph); |
| 46 | 48 |
| 47 // Inline a graph at a call site. | 49 // Inline a graph at a call site. |
| 48 // | 50 // |
| 49 // Assumes the callee is in SSA with a correct dominator tree and use | 51 // Assumes the callee is in SSA with a correct dominator tree and use |
| 50 // lists. | 52 // lists. |
| 51 // | 53 // |
| 52 // After inlining the caller graph will have correctly adjusted the use | 54 // After inlining the caller graph will have correctly adjusted the use |
| 53 // lists. The block orders will need to be recomputed. | 55 // lists. The block orders will need to be recomputed. |
| 54 void ReplaceCall(TargetEntryInstr* callee_entry); | 56 void ReplaceCall(TargetEntryInstr* callee_entry); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 71 Value* ValueAt(intptr_t i) const { | 73 Value* ValueAt(intptr_t i) const { |
| 72 return ReturnAt(i)->value(); | 74 return ReturnAt(i)->value(); |
| 73 } | 75 } |
| 74 | 76 |
| 75 ReturnInstr* ReturnAt(intptr_t i) const { | 77 ReturnInstr* ReturnAt(intptr_t i) const { |
| 76 return exits_[i].exit_return; | 78 return exits_[i].exit_return; |
| 77 } | 79 } |
| 78 | 80 |
| 79 static int LowestBlockIdFirst(const Data* a, const Data* b); | 81 static int LowestBlockIdFirst(const Data* a, const Data* b); |
| 80 void SortExits(); | 82 void SortExits(); |
| 83 void RemoveUnreachableExits(FlowGraph* callee_graph); |
| 81 | 84 |
| 82 Definition* JoinReturns(BlockEntryInstr** exit_block, | 85 Definition* JoinReturns(BlockEntryInstr** exit_block, |
| 83 Instruction** last_instruction, | 86 Instruction** last_instruction, |
| 84 intptr_t try_index); | 87 intptr_t try_index); |
| 85 | 88 |
| 86 Isolate* isolate() const { return caller_graph_->isolate(); } | 89 Isolate* isolate() const { return caller_graph_->isolate(); } |
| 87 Zone* zone() const { return caller_graph_->zone(); } | 90 Zone* zone() const { return caller_graph_->zone(); } |
| 88 | 91 |
| 89 FlowGraph* caller_graph_; | 92 FlowGraph* caller_graph_; |
| 90 Definition* call_; | 93 Definition* call_; |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 // Output parameters. | 579 // Output parameters. |
| 577 GrowableArray<TargetEntryInstr**> true_successor_addresses_; | 580 GrowableArray<TargetEntryInstr**> true_successor_addresses_; |
| 578 GrowableArray<TargetEntryInstr**> false_successor_addresses_; | 581 GrowableArray<TargetEntryInstr**> false_successor_addresses_; |
| 579 | 582 |
| 580 intptr_t condition_token_pos_; | 583 intptr_t condition_token_pos_; |
| 581 }; | 584 }; |
| 582 | 585 |
| 583 } // namespace dart | 586 } // namespace dart |
| 584 | 587 |
| 585 #endif // VM_FLOW_GRAPH_BUILDER_H_ | 588 #endif // VM_FLOW_GRAPH_BUILDER_H_ |
| OLD | NEW |