Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Side by Side Diff: runtime/vm/flow_graph_allocator.cc

Issue 10956013: Reapply "A simpler scheme for garbage collection of ureachable phi inputs." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #include "vm/flow_graph_allocator.h" 5 #include "vm/flow_graph_allocator.h"
6 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 #include "vm/il_printer.h" 9 #include "vm/il_printer.h"
10 #include "vm/flow_graph.h" 10 #include "vm/flow_graph.h"
(...skipping 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after
1121 move->AddMove(Location::NoLocation(), Location::NoLocation()); 1121 move->AddMove(Location::NoLocation(), Location::NoLocation());
1122 } 1122 }
1123 } 1123 }
1124 } 1124 }
1125 } 1125 }
1126 } 1126 }
1127 1127
1128 1128
1129 // Discover structural (reducible) loops nesting structure. 1129 // Discover structural (reducible) loops nesting structure.
1130 void FlowGraphAllocator::DiscoverLoops() { 1130 void FlowGraphAllocator::DiscoverLoops() {
1131 // This algorithm relies on the assumption that we emit blocks in reverse
Kevin Millikin (Google) 2012/09/20 13:48:17 Look here.
1132 // postorder, so postorder number can be used to identify loop nesting.
1133 //
1131 // TODO(vegorov): consider using a generic algorithm to correctly discover 1134 // TODO(vegorov): consider using a generic algorithm to correctly discover
1132 // both headers of reducible and irreducible loops. 1135 // both headers of reducible and irreducible loops.
1133 BlockInfo* current_loop = NULL; 1136 BlockInfo* current_loop = NULL;
1134 1137
1135 const intptr_t block_count = postorder_.length(); 1138 const intptr_t block_count = postorder_.length();
1136 for (intptr_t i = 0; i < block_count; i++) { 1139 for (intptr_t i = 0; i < block_count; i++) {
1137 BlockEntryInstr* block = postorder_[i]; 1140 BlockEntryInstr* block = postorder_[i];
1138 GotoInstr* goto_instr = block->last_instruction()->AsGoto(); 1141 GotoInstr* goto_instr = block->last_instruction()->AsGoto();
1139 if (goto_instr != NULL) { 1142 if (goto_instr != NULL) {
1140 JoinEntryInstr* successor = goto_instr->successor(); 1143 JoinEntryInstr* successor = goto_instr->successor();
1141 if (successor->postorder_number() > i) { 1144 if (successor->postorder_number() > i) {
1142 // This is back-edge. 1145 // This is back-edge.
1143 BlockInfo* successor_info = BlockInfoAt(successor->lifetime_position()); 1146 BlockInfo* successor_info = BlockInfoAt(successor->lifetime_position());
1144 ASSERT(successor_info->entry() == successor); 1147 ASSERT(successor_info->entry() == successor);
1145 if (!successor_info->is_loop_header() && 1148 if (!successor_info->is_loop_header() &&
1146 ((current_loop == NULL) || 1149 ((current_loop == NULL) ||
1147 (current_loop->entry()->block_id() < 1150 (current_loop->entry()->postorder_number() >
1148 successor_info->entry()->block_id()))) { 1151 successor_info->entry()->postorder_number()))) {
1149 ASSERT(successor_info != current_loop); 1152 ASSERT(successor_info != current_loop);
1150 1153
1151 successor_info->mark_loop_header(); 1154 successor_info->mark_loop_header();
1152 // For loop header loop information points to the outer loop. 1155 // For loop header loop information points to the outer loop.
1153 successor_info->set_loop(current_loop); 1156 successor_info->set_loop(current_loop);
1154 current_loop = successor_info; 1157 current_loop = successor_info;
1155 } 1158 }
1156 } 1159 }
1157 } 1160 }
1158 1161
(...skipping 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after
2194 OS::Print("-- [after ssa allocator] ir [%s] -------------\n", 2197 OS::Print("-- [after ssa allocator] ir [%s] -------------\n",
2195 function.ToFullyQualifiedCString()); 2198 function.ToFullyQualifiedCString());
2196 FlowGraphPrinter printer(flow_graph_, true); 2199 FlowGraphPrinter printer(flow_graph_, true);
2197 printer.PrintBlocks(); 2200 printer.PrintBlocks();
2198 OS::Print("----------------------------------------------\n"); 2201 OS::Print("----------------------------------------------\n");
2199 } 2202 }
2200 } 2203 }
2201 2204
2202 2205
2203 } // namespace dart 2206 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698