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

Side by Side Diff: src/compiler/scheduler.cc

Issue 681263004: Run ControlReducer early after graph building, then again later. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 1 month 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
« src/compiler/ast-graph-builder.cc ('K') | « src/compiler/pipeline.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <deque> 5 #include <deque>
6 #include <queue> 6 #include <queue>
7 7
8 #include "src/compiler/scheduler.h" 8 #include "src/compiler/scheduler.h"
9 9
10 #include "src/compiler/graph.h" 10 #include "src/compiler/graph.h"
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 control_.push_back(node); 232 control_.push_back(node);
233 data->is_connected_control_ = true; 233 data->is_connected_control_ = true;
234 } 234 }
235 } 235 }
236 236
237 237
238 void BuildBlocks(Node* node) { 238 void BuildBlocks(Node* node) {
239 switch (node->opcode()) { 239 switch (node->opcode()) {
240 case IrOpcode::kLoop: 240 case IrOpcode::kLoop:
241 case IrOpcode::kMerge: 241 case IrOpcode::kMerge:
242 case IrOpcode::kTerminate:
243 BuildBlockForNode(node); 242 BuildBlockForNode(node);
244 break; 243 break;
244 case IrOpcode::kTerminate: {
245 // Put Terminate in the loop to which it refers.
246 Node* loop = NodeProperties::GetControlInput(node);
247 BuildBlockForNode(loop);
248 BasicBlock* block = schedule_->block(loop);
Michael Starzinger 2014/10/29 12:14:02 nit: This probably should use the return value of
titzer 2014/10/29 15:17:09 Done. While doing this I noticed a bug and had to
249 FixNode(block, node);
250 break;
251 }
245 case IrOpcode::kBranch: 252 case IrOpcode::kBranch:
246 BuildBlocksForSuccessors(node, IrOpcode::kIfTrue, IrOpcode::kIfFalse); 253 BuildBlocksForSuccessors(node, IrOpcode::kIfTrue, IrOpcode::kIfFalse);
247 break; 254 break;
248 default: 255 default:
249 break; 256 break;
250 } 257 }
251 } 258 }
252 259
253 void ConnectBlocks(Node* node) { 260 void ConnectBlocks(Node* node) {
254 switch (node->opcode()) { 261 switch (node->opcode()) {
255 case IrOpcode::kLoop: 262 case IrOpcode::kLoop:
256 case IrOpcode::kMerge: 263 case IrOpcode::kMerge:
257 ConnectMerge(node); 264 ConnectMerge(node);
258 break; 265 break;
259 case IrOpcode::kBranch: 266 case IrOpcode::kBranch:
260 scheduler_->schedule_root_nodes_.push_back(node); 267 scheduler_->schedule_root_nodes_.push_back(node);
261 ConnectBranch(node); 268 ConnectBranch(node);
262 break; 269 break;
263 case IrOpcode::kReturn: 270 case IrOpcode::kReturn:
264 scheduler_->schedule_root_nodes_.push_back(node); 271 scheduler_->schedule_root_nodes_.push_back(node);
265 ConnectReturn(node); 272 ConnectReturn(node);
266 break; 273 break;
267 default: 274 default:
268 break; 275 break;
269 } 276 }
270 } 277 }
271 278
272 void BuildBlockForNode(Node* node) { 279 BasicBlock* BuildBlockForNode(Node* node) {
273 if (schedule_->block(node) == NULL) { 280 BasicBlock* block = schedule_->block(node);
274 BasicBlock* block = schedule_->NewBasicBlock(); 281 if (block == NULL) {
282 block = schedule_->NewBasicBlock();
275 Trace("Create block B%d for #%d:%s\n", block->id().ToInt(), node->id(), 283 Trace("Create block B%d for #%d:%s\n", block->id().ToInt(), node->id(),
276 node->op()->mnemonic()); 284 node->op()->mnemonic());
277 FixNode(block, node); 285 FixNode(block, node);
278 } 286 }
287 return block;
279 } 288 }
280 289
281 void BuildBlocksForSuccessors(Node* node, IrOpcode::Value a, 290 void BuildBlocksForSuccessors(Node* node, IrOpcode::Value a,
282 IrOpcode::Value b) { 291 IrOpcode::Value b) {
283 Node* successors[2]; 292 Node* successors[2];
284 CollectSuccessorProjections(node, successors, a, b); 293 CollectSuccessorProjections(node, successors, a, b);
285 BuildBlockForNode(successors[0]); 294 BuildBlockForNode(successors[0]);
286 BuildBlockForNode(successors[1]); 295 BuildBlockForNode(successors[1]);
287 } 296 }
288 297
(...skipping 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after
1303 start->ReplaceInput(NodeProperties::FirstControlIndex(start), block_start); 1312 start->ReplaceInput(NodeProperties::FirstControlIndex(start), block_start);
1304 1313
1305 Trace(" Connecting floating control start %d:%s to %d:%s\n", start->id(), 1314 Trace(" Connecting floating control start %d:%s to %d:%s\n", start->id(),
1306 start->op()->mnemonic(), block_start->id(), 1315 start->op()->mnemonic(), block_start->id(),
1307 block_start->op()->mnemonic()); 1316 block_start->op()->mnemonic());
1308 } 1317 }
1309 1318
1310 } // namespace compiler 1319 } // namespace compiler
1311 } // namespace internal 1320 } // namespace internal
1312 } // namespace v8 1321 } // namespace v8
OLDNEW
« src/compiler/ast-graph-builder.cc ('K') | « src/compiler/pipeline.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698