OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 #include "vm/flow_graph_inliner.h" | 5 #include "vm/flow_graph_inliner.h" |
6 | 6 |
7 #include "vm/block_scheduler.h" | 7 #include "vm/block_scheduler.h" |
8 #include "vm/compiler.h" | 8 #include "vm/compiler.h" |
9 #include "vm/flags.h" | 9 #include "vm/flags.h" |
10 #include "vm/flow_graph.h" | 10 #include "vm/flow_graph.h" |
(...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1006 // The call target is shared with a previous inlined variant. Share | 1006 // The call target is shared with a previous inlined variant. Share |
1007 // the graph. This requires a join block at the entry, and edge-split | 1007 // the graph. This requires a join block at the entry, and edge-split |
1008 // form requires a target for each branch. | 1008 // form requires a target for each branch. |
1009 // | 1009 // |
1010 // Represent the sharing by recording a fresh target for the first | 1010 // Represent the sharing by recording a fresh target for the first |
1011 // variant and the shared join for all later variants. | 1011 // variant and the shared join for all later variants. |
1012 if (inlined_entries_[i]->IsGraphEntry()) { | 1012 if (inlined_entries_[i]->IsGraphEntry()) { |
1013 // Convert the old target entry to a new join entry. | 1013 // Convert the old target entry to a new join entry. |
1014 TargetEntryInstr* old_target = | 1014 TargetEntryInstr* old_target = |
1015 inlined_entries_[i]->AsGraphEntry()->normal_entry(); | 1015 inlined_entries_[i]->AsGraphEntry()->normal_entry(); |
| 1016 // Unuse all inputs in the the old graph entry since it is not part of |
| 1017 // the graph anymore. A new target be created instead. |
| 1018 inlined_entries_[i]->AsGraphEntry()->UnuseAllInputs(); |
| 1019 |
1016 JoinEntryInstr* new_join = BranchSimplifier::ToJoinEntry(old_target); | 1020 JoinEntryInstr* new_join = BranchSimplifier::ToJoinEntry(old_target); |
1017 old_target->ReplaceAsPredecessorWith(new_join); | 1021 old_target->ReplaceAsPredecessorWith(new_join); |
1018 for (intptr_t j = 0; j < old_target->dominated_blocks().length(); ++j) { | 1022 for (intptr_t j = 0; j < old_target->dominated_blocks().length(); ++j) { |
1019 BlockEntryInstr* block = old_target->dominated_blocks()[j]; | 1023 BlockEntryInstr* block = old_target->dominated_blocks()[j]; |
1020 new_join->AddDominatedBlock(block); | 1024 new_join->AddDominatedBlock(block); |
1021 } | 1025 } |
1022 // Create a new target with the join as unconditional successor. | 1026 // Create a new target with the join as unconditional successor. |
1023 TargetEntryInstr* new_target = | 1027 TargetEntryInstr* new_target = |
1024 new TargetEntryInstr(owner_->caller_graph()->allocate_block_id(), | 1028 new TargetEntryInstr(owner_->caller_graph()->allocate_block_id(), |
1025 old_target->try_index()); | 1029 old_target->try_index()); |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1479 OS::Print("After Inlining of %s\n", flow_graph_-> | 1483 OS::Print("After Inlining of %s\n", flow_graph_-> |
1480 parsed_function().function().ToFullyQualifiedCString()); | 1484 parsed_function().function().ToFullyQualifiedCString()); |
1481 FlowGraphPrinter printer(*flow_graph_); | 1485 FlowGraphPrinter printer(*flow_graph_); |
1482 printer.PrintBlocks(); | 1486 printer.PrintBlocks(); |
1483 } | 1487 } |
1484 } | 1488 } |
1485 } | 1489 } |
1486 } | 1490 } |
1487 | 1491 |
1488 } // namespace dart | 1492 } // namespace dart |
OLD | NEW |