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

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

Issue 816053002: [turbofan] First version of loop peeling. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 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
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/bit-vector.h" 10 #include "src/bit-vector.h"
(...skipping 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after
1323 ? block 1323 ? block
1324 : scheduler_->GetCommonDominator( 1324 : scheduler_->GetCommonDominator(
1325 block, use_block); 1325 block, use_block);
1326 } 1326 }
1327 return block; 1327 return block;
1328 } 1328 }
1329 1329
1330 BasicBlock* GetBlockForUse(Edge edge) { 1330 BasicBlock* GetBlockForUse(Edge edge) {
1331 Node* use = edge.from(); 1331 Node* use = edge.from();
1332 IrOpcode::Value opcode = use->opcode(); 1332 IrOpcode::Value opcode = use->opcode();
1333 if (opcode == IrOpcode::kPhi || opcode == IrOpcode::kEffectPhi) { 1333 if (IrOpcode::IsPhiOpcode(opcode)) {
1334 // If the use is from a coupled (i.e. floating) phi, compute the common 1334 // If the use is from a coupled (i.e. floating) phi, compute the common
1335 // dominator of its uses. This will not recurse more than one level. 1335 // dominator of its uses. This will not recurse more than one level.
1336 if (scheduler_->GetPlacement(use) == Scheduler::kCoupled) { 1336 if (scheduler_->GetPlacement(use) == Scheduler::kCoupled) {
1337 Trace(" inspecting uses of coupled #%d:%s\n", use->id(), 1337 Trace(" inspecting uses of coupled #%d:%s\n", use->id(),
1338 use->op()->mnemonic()); 1338 use->op()->mnemonic());
1339 DCHECK_EQ(edge.to(), NodeProperties::GetControlInput(use)); 1339 DCHECK_EQ(edge.to(), NodeProperties::GetControlInput(use));
1340 return GetCommonDominatorOfUses(use); 1340 return GetCommonDominatorOfUses(use);
1341 } 1341 }
1342 // If the use is from a fixed (i.e. non-floating) phi, use the block 1342 // If the use is from a fixed (i.e. non-floating) phi, use the block
1343 // of the corresponding control input to the merge. 1343 // of the corresponding control input to the merge.
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
1433 } 1433 }
1434 PropagateImmediateDominators(block->rpo_next()); 1434 PropagateImmediateDominators(block->rpo_next());
1435 1435
1436 // Iterate on phase 4: Schedule nodes early. 1436 // Iterate on phase 4: Schedule nodes early.
1437 // TODO(mstarzinger): The following loop gathering the propagation roots is a 1437 // TODO(mstarzinger): The following loop gathering the propagation roots is a
1438 // temporary solution and should be merged into the rest of the scheduler as 1438 // temporary solution and should be merged into the rest of the scheduler as
1439 // soon as the approach settled for all floating loops. 1439 // soon as the approach settled for all floating loops.
1440 NodeVector propagation_roots(control_flow_builder_->control_); 1440 NodeVector propagation_roots(control_flow_builder_->control_);
1441 for (Node* node : control_flow_builder_->control_) { 1441 for (Node* node : control_flow_builder_->control_) {
1442 for (Node* use : node->uses()) { 1442 for (Node* use : node->uses()) {
1443 if (use->opcode() == IrOpcode::kPhi || 1443 if (IrOpcode::IsPhiOpcode(use->opcode()))
1444 use->opcode() == IrOpcode::kEffectPhi) {
1445 propagation_roots.push_back(use); 1444 propagation_roots.push_back(use);
1446 }
1447 } 1445 }
1448 } 1446 }
1449 if (FLAG_trace_turbo_scheduler) { 1447 if (FLAG_trace_turbo_scheduler) {
1450 Trace("propagation roots: "); 1448 Trace("propagation roots: ");
1451 for (Node* node : propagation_roots) { 1449 for (Node* node : propagation_roots) {
1452 Trace("#%d:%s ", node->id(), node->op()->mnemonic()); 1450 Trace("#%d:%s ", node->id(), node->op()->mnemonic());
1453 } 1451 }
1454 Trace("\n"); 1452 Trace("\n");
1455 } 1453 }
1456 ScheduleEarlyNodeVisitor schedule_early_visitor(zone_, this); 1454 ScheduleEarlyNodeVisitor schedule_early_visitor(zone_, this);
(...skipping 18 matching lines...) Expand all
1475 for (NodeVectorIter i = nodes->begin(); i != nodes->end(); ++i) { 1473 for (NodeVectorIter i = nodes->begin(); i != nodes->end(); ++i) {
1476 schedule_->SetBlockForNode(to, *i); 1474 schedule_->SetBlockForNode(to, *i);
1477 scheduled_nodes_[to->id().ToSize()].push_back(*i); 1475 scheduled_nodes_[to->id().ToSize()].push_back(*i);
1478 } 1476 }
1479 nodes->clear(); 1477 nodes->clear();
1480 } 1478 }
1481 1479
1482 } // namespace compiler 1480 } // namespace compiler
1483 } // namespace internal 1481 } // namespace internal
1484 } // namespace v8 1482 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698