OLD | NEW |
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 1310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1321 ? block | 1321 ? block |
1322 : scheduler_->GetCommonDominator( | 1322 : scheduler_->GetCommonDominator( |
1323 block, use_block); | 1323 block, use_block); |
1324 } | 1324 } |
1325 return block; | 1325 return block; |
1326 } | 1326 } |
1327 | 1327 |
1328 BasicBlock* GetBlockForUse(Edge edge) { | 1328 BasicBlock* GetBlockForUse(Edge edge) { |
1329 Node* use = edge.from(); | 1329 Node* use = edge.from(); |
1330 IrOpcode::Value opcode = use->opcode(); | 1330 IrOpcode::Value opcode = use->opcode(); |
1331 if (opcode == IrOpcode::kPhi || opcode == IrOpcode::kEffectPhi) { | 1331 if (IrOpcode::IsPhiOpcode(opcode)) { |
1332 // If the use is from a coupled (i.e. floating) phi, compute the common | 1332 // If the use is from a coupled (i.e. floating) phi, compute the common |
1333 // dominator of its uses. This will not recurse more than one level. | 1333 // dominator of its uses. This will not recurse more than one level. |
1334 if (scheduler_->GetPlacement(use) == Scheduler::kCoupled) { | 1334 if (scheduler_->GetPlacement(use) == Scheduler::kCoupled) { |
1335 Trace(" inspecting uses of coupled #%d:%s\n", use->id(), | 1335 Trace(" inspecting uses of coupled #%d:%s\n", use->id(), |
1336 use->op()->mnemonic()); | 1336 use->op()->mnemonic()); |
1337 DCHECK_EQ(edge.to(), NodeProperties::GetControlInput(use)); | 1337 DCHECK_EQ(edge.to(), NodeProperties::GetControlInput(use)); |
1338 return GetCommonDominatorOfUses(use); | 1338 return GetCommonDominatorOfUses(use); |
1339 } | 1339 } |
1340 // If the use is from a fixed (i.e. non-floating) phi, use the block | 1340 // If the use is from a fixed (i.e. non-floating) phi, use the block |
1341 // of the corresponding control input to the merge. | 1341 // of the corresponding control input to the merge. |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1431 } | 1431 } |
1432 PropagateImmediateDominators(block->rpo_next()); | 1432 PropagateImmediateDominators(block->rpo_next()); |
1433 | 1433 |
1434 // Iterate on phase 4: Schedule nodes early. | 1434 // Iterate on phase 4: Schedule nodes early. |
1435 // TODO(mstarzinger): The following loop gathering the propagation roots is a | 1435 // TODO(mstarzinger): The following loop gathering the propagation roots is a |
1436 // temporary solution and should be merged into the rest of the scheduler as | 1436 // temporary solution and should be merged into the rest of the scheduler as |
1437 // soon as the approach settled for all floating loops. | 1437 // soon as the approach settled for all floating loops. |
1438 NodeVector propagation_roots(control_flow_builder_->control_); | 1438 NodeVector propagation_roots(control_flow_builder_->control_); |
1439 for (Node* node : control_flow_builder_->control_) { | 1439 for (Node* node : control_flow_builder_->control_) { |
1440 for (Node* use : node->uses()) { | 1440 for (Node* use : node->uses()) { |
1441 if (use->opcode() == IrOpcode::kPhi || | 1441 if (IrOpcode::IsPhiOpcode(use->opcode())) |
1442 use->opcode() == IrOpcode::kEffectPhi) { | |
1443 propagation_roots.push_back(use); | 1442 propagation_roots.push_back(use); |
1444 } | |
1445 } | 1443 } |
1446 } | 1444 } |
1447 if (FLAG_trace_turbo_scheduler) { | 1445 if (FLAG_trace_turbo_scheduler) { |
1448 Trace("propagation roots: "); | 1446 Trace("propagation roots: "); |
1449 for (Node* node : propagation_roots) { | 1447 for (Node* node : propagation_roots) { |
1450 Trace("#%d:%s ", node->id(), node->op()->mnemonic()); | 1448 Trace("#%d:%s ", node->id(), node->op()->mnemonic()); |
1451 } | 1449 } |
1452 Trace("\n"); | 1450 Trace("\n"); |
1453 } | 1451 } |
1454 ScheduleEarlyNodeVisitor schedule_early_visitor(zone_, this); | 1452 ScheduleEarlyNodeVisitor schedule_early_visitor(zone_, this); |
(...skipping 18 matching lines...) Expand all Loading... |
1473 for (Node* const node : *nodes) { | 1471 for (Node* const node : *nodes) { |
1474 schedule_->SetBlockForNode(to, node); | 1472 schedule_->SetBlockForNode(to, node); |
1475 scheduled_nodes_[to->id().ToSize()].push_back(node); | 1473 scheduled_nodes_[to->id().ToSize()].push_back(node); |
1476 } | 1474 } |
1477 nodes->clear(); | 1475 nodes->clear(); |
1478 } | 1476 } |
1479 | 1477 |
1480 } // namespace compiler | 1478 } // namespace compiler |
1481 } // namespace internal | 1479 } // namespace internal |
1482 } // namespace v8 | 1480 } // namespace v8 |
OLD | NEW |