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

Unified Diff: src/compiler/scheduler.cc

Issue 602083003: Fix scheduler to correctly schedule nested diamonds. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: titzer's comments Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/scheduler.h ('k') | src/compiler/verifier.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/scheduler.cc
diff --git a/src/compiler/scheduler.cc b/src/compiler/scheduler.cc
index 58878a0776bfeb483cb68811df0066db32bbf586..559453109c3b42b66c0394d5cb2401cec0980a60 100644
--- a/src/compiler/scheduler.cc
+++ b/src/compiler/scheduler.cc
@@ -86,6 +86,7 @@ class CFGBuilder {
}
}
+
void BuildBlocks(Node* node) {
switch (node->opcode()) {
case IrOpcode::kLoop:
@@ -218,8 +219,8 @@ class CFGBuilder {
};
-Scheduler::SchedulerData Scheduler::DefaultSchedulerData() {
- SchedulerData def = {0, 0, false, false, kUnknown};
+Scheduler::SchedulerData Scheduler::DefaultSchedulerData(Zone* zone) {
+ SchedulerData def = {0, 0, false, false, kUnknown, NodeVector(zone)};
return def;
}
@@ -230,7 +231,7 @@ Scheduler::Scheduler(Zone* zone, Graph* graph, Schedule* schedule)
schedule_(schedule),
scheduled_nodes_(zone),
schedule_root_nodes_(zone),
- node_data_(graph_->NodeCount(), DefaultSchedulerData(), zone),
+ node_data_(graph_->NodeCount(), DefaultSchedulerData(zone), zone),
has_floating_control_(false) {}
@@ -458,6 +459,26 @@ class PrepareUsesVisitor : public NullNodeVisitor {
Trace(" Use count of #%d:%s (used by #%d:%s)++ = %d\n", to->id(),
to->op()->mnemonic(), from->id(), from->op()->mnemonic(),
scheduler_->GetData(to)->unscheduled_count_);
+ if (OperatorProperties::IsBasicBlockBegin(to->op()) &&
titzer 2014/10/07 07:48:26 I think this should only be EffectPhi and Phi, and
sigurds 2014/10/13 13:08:18 I'm doing the IsBasicBlockBegin check to make sure
+ (from->opcode() == IrOpcode::kEffectPhi ||
+ from->opcode() == IrOpcode::kPhi) &&
+ scheduler_->GetData(to)->is_floating_control_ &&
+ !scheduler_->GetData(to)->is_connected_control_) {
+ for (InputIter i = from->inputs().begin(); i != from->inputs().end();
+ ++i) {
+ if (!NodeProperties::IsControlEdge(i.edge())) {
+ Scheduler::SchedulerData* data = scheduler_->GetData(to);
+ data->additional_dependencies.push_back(*i);
+ ++(scheduler_->GetData(*i)->unscheduled_count_);
+ Trace(
+ " Use count of #%d:%s (additional dependency of #%d:%s)++ = "
+ "%d\n",
+ (*i)->id(), (*i)->op()->mnemonic(), to->id(),
+ to->op()->mnemonic(),
+ scheduler_->GetData(*i)->unscheduled_count_);
+ }
+ }
+ }
}
}
@@ -486,6 +507,7 @@ class ScheduleLateNodeVisitor : public NullNodeVisitor {
if (schedule_->IsScheduled(node)) {
return GenericGraphVisit::CONTINUE;
}
+
Scheduler::SchedulerData* data = scheduler_->GetData(node);
DCHECK_EQ(Scheduler::kSchedulable, data->placement_);
@@ -587,6 +609,24 @@ class ScheduleLateNodeVisitor : public NullNodeVisitor {
}
}
}
+
+ Scheduler::SchedulerData* data = scheduler_->GetData(node);
+ for (NodeVectorIter i = data->additional_dependencies.begin();
+ i != data->additional_dependencies.end(); ++i) {
+ Scheduler::SchedulerData* data = scheduler_->GetData(*i);
+ DCHECK(data->unscheduled_count_ > 0);
+ --data->unscheduled_count_;
+ if (FLAG_trace_turbo_scheduler) {
+ Trace(
+ " Use count for #%d:%s (additional dependency of #%d:%s)-- = %d\n",
+ (*i)->id(), (*i)->op()->mnemonic(), node->id(),
+ node->op()->mnemonic(), data->unscheduled_count_);
+ if (data->unscheduled_count_ == 0) {
+ Trace(" newly eligible #%d:%s\n", (*i)->id(),
+ (*i)->op()->mnemonic());
+ }
+ }
+ }
}
Scheduler* scheduler_;
@@ -642,16 +682,14 @@ bool Scheduler::ConnectFloatingControl() {
// TODO(titzer): we place at most one floating control structure per
// basic block because scheduling currently can interleave phis from
// one subgraph with the merges from another subgraph.
- bool one_placed = false;
for (int j = static_cast<int>(block->nodes_.size()) - 1; j >= 0; j--) {
Node* node = block->nodes_[j];
SchedulerData* data = GetData(node);
- if (data->is_floating_control_ && !data->is_connected_control_ &&
- !one_placed) {
+ if (data->is_floating_control_ && !data->is_connected_control_) {
Trace(" Floating control #%d:%s was scheduled in B%d\n", node->id(),
node->op()->mnemonic(), block->id());
ConnectFloatingControlSubgraph(block, node);
- one_placed = true;
+ return true;
}
}
}
« no previous file with comments | « src/compiler/scheduler.h ('k') | src/compiler/verifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698