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

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

Issue 1399423002: [turbofan] Introduce node regions for protection from scheduling. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Move RelaxControls Created 5 years, 2 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
« no previous file with comments | « src/compiler/opcodes.h ('k') | src/compiler/typer.cc » ('j') | 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 "src/compiler/scheduler.h" 5 #include "src/compiler/scheduler.h"
6 6
7 #include <iomanip> 7 #include <iomanip>
8 8
9 #include "src/base/adapters.h" 9 #include "src/base/adapters.h"
10 #include "src/bit-vector.h" 10 #include "src/bit-vector.h"
(...skipping 1376 matching lines...) Expand 10 before | Expand all | Expand 10 after
1387 } while (hoist_block && 1387 } while (hoist_block &&
1388 hoist_block->dominator_depth() >= min_block->dominator_depth()); 1388 hoist_block->dominator_depth() >= min_block->dominator_depth());
1389 } else if (scheduler_->flags_ & Scheduler::kSplitNodes) { 1389 } else if (scheduler_->flags_ & Scheduler::kSplitNodes) {
1390 // Split the {node} if beneficial and return the new {block} for it. 1390 // Split the {node} if beneficial and return the new {block} for it.
1391 block = SplitNode(block, node); 1391 block = SplitNode(block, node);
1392 } 1392 }
1393 1393
1394 // Schedule the node or a floating control structure. 1394 // Schedule the node or a floating control structure.
1395 if (IrOpcode::IsMergeOpcode(node->opcode())) { 1395 if (IrOpcode::IsMergeOpcode(node->opcode())) {
1396 ScheduleFloatingControl(block, node); 1396 ScheduleFloatingControl(block, node);
1397 } else if (node->opcode() == IrOpcode::kFinishRegion) {
1398 ScheduleRegion(block, node);
1397 } else { 1399 } else {
1398 ScheduleNode(block, node); 1400 ScheduleNode(block, node);
1399 } 1401 }
1400 } 1402 }
1401 1403
1402 // Mark {block} and push its non-marked predecessor on the marking queue. 1404 // Mark {block} and push its non-marked predecessor on the marking queue.
1403 void MarkBlock(BasicBlock* block) { 1405 void MarkBlock(BasicBlock* block) {
1404 DCHECK_LT(block->id().ToSize(), marked_.size()); 1406 DCHECK_LT(block->id().ToSize(), marked_.size());
1405 marked_[block->id().ToSize()] = true; 1407 marked_[block->id().ToSize()] = true;
1406 for (BasicBlock* pred_block : block->predecessors()) { 1408 for (BasicBlock* pred_block : block->predecessors()) {
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1565 if (result == NULL) return NULL; 1567 if (result == NULL) return NULL;
1566 TRACE(" must dominate use #%d:%s in id:%d\n", use->id(), 1568 TRACE(" must dominate use #%d:%s in id:%d\n", use->id(),
1567 use->op()->mnemonic(), result->id().ToInt()); 1569 use->op()->mnemonic(), result->id().ToInt());
1568 return result; 1570 return result;
1569 } 1571 }
1570 1572
1571 void ScheduleFloatingControl(BasicBlock* block, Node* node) { 1573 void ScheduleFloatingControl(BasicBlock* block, Node* node) {
1572 scheduler_->FuseFloatingControl(block, node); 1574 scheduler_->FuseFloatingControl(block, node);
1573 } 1575 }
1574 1576
1577 void ScheduleRegion(BasicBlock* block, Node* region_end) {
1578 // We only allow regions of instructions connected into a linear
1579 // effect chain. The only value allowed to be produced by a node
1580 // in the chain must be the value consumed by the FinishRegion node.
1581
1582 // We schedule back to front; we first schedule FinishRegion.
1583 CHECK_EQ(IrOpcode::kFinishRegion, region_end->opcode());
1584 ScheduleNode(block, region_end);
1585
1586 // Schedule the chain.
1587 Node* node = NodeProperties::GetEffectInput(region_end);
1588 while (node->opcode() != IrOpcode::kBeginRegion) {
1589 DCHECK_EQ(0, scheduler_->GetData(node)->unscheduled_count_);
1590 DCHECK_EQ(1, node->op()->EffectInputCount());
1591 DCHECK_EQ(1, node->op()->EffectOutputCount());
1592 DCHECK_EQ(0, node->op()->ControlOutputCount());
1593 // The value output (if there is any) must be consumed
1594 // by the EndRegion node.
1595 DCHECK(node->op()->ValueOutputCount() == 0 ||
1596 node == region_end->InputAt(0));
1597 ScheduleNode(block, node);
1598 node = NodeProperties::GetEffectInput(node);
1599 }
1600 // Schedule the BeginRegion node.
1601 DCHECK_EQ(0, scheduler_->GetData(node)->unscheduled_count_);
1602 ScheduleNode(block, node);
1603 }
1604
1575 void ScheduleNode(BasicBlock* block, Node* node) { 1605 void ScheduleNode(BasicBlock* block, Node* node) {
1576 schedule_->PlanNode(block, node); 1606 schedule_->PlanNode(block, node);
1577 scheduler_->scheduled_nodes_[block->id().ToSize()].push_back(node); 1607 scheduler_->scheduled_nodes_[block->id().ToSize()].push_back(node);
1578 scheduler_->UpdatePlacement(node, Scheduler::kScheduled); 1608 scheduler_->UpdatePlacement(node, Scheduler::kScheduled);
1579 } 1609 }
1580 1610
1581 Node* CloneNode(Node* node) { 1611 Node* CloneNode(Node* node) {
1582 int const input_count = node->InputCount(); 1612 int const input_count = node->InputCount();
1583 for (int index = 0; index < input_count; ++index) { 1613 for (int index = 0; index < input_count; ++index) {
1584 Node* const input = node->InputAt(index); 1614 Node* const input = node->InputAt(index);
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1700 for (Node* const node : *nodes) { 1730 for (Node* const node : *nodes) {
1701 schedule_->SetBlockForNode(to, node); 1731 schedule_->SetBlockForNode(to, node);
1702 scheduled_nodes_[to->id().ToSize()].push_back(node); 1732 scheduled_nodes_[to->id().ToSize()].push_back(node);
1703 } 1733 }
1704 nodes->clear(); 1734 nodes->clear();
1705 } 1735 }
1706 1736
1707 } // namespace compiler 1737 } // namespace compiler
1708 } // namespace internal 1738 } // namespace internal
1709 } // namespace v8 1739 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/opcodes.h ('k') | src/compiler/typer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698