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

Unified Diff: src/compiler/scheduler.cc

Issue 687133003: Cleanup unscheduled use count for controls of coupled nodes. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/scheduler.h ('k') | no next file » | 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 d9e67ee20a875e24f75d8f6972bc646a863e4ca7..ba4f6d0c40f792b4c81c4500f05458c24b317334 100644
--- a/src/compiler/scheduler.cc
+++ b/src/compiler/scheduler.cc
@@ -122,10 +122,6 @@ void Scheduler::UpdatePlacement(Node* node, Placement placement) {
Node* control = NodeProperties::GetControlInput(node);
BasicBlock* block = schedule_->block(control);
schedule_->AddNode(block, node);
- // TODO(mstarzinger): Cheap hack to make sure unscheduled use count of
- // control does not drop below zero. This might cause the control to be
- // queued for scheduling more than once, which makes this ugly!
- ++(GetData(control)->unscheduled_count_);
break;
}
#define DEFINE_FLOATING_CONTROL_CASE(V) case IrOpcode::k##V:
@@ -153,18 +149,27 @@ void Scheduler::UpdatePlacement(Node* node, Placement placement) {
for (InputIter i = node->inputs().begin(); i != node->inputs().end(); ++i) {
// TODO(mstarzinger): Another cheap hack for use counts.
if (GetData(*i)->placement_ == kFixed) continue;
- DecrementUnscheduledUseCount(*i, i.edge().from());
+ DecrementUnscheduledUseCount(*i, i.index(), i.edge().from());
}
}
data->placement_ = placement;
}
-void Scheduler::IncrementUnscheduledUseCount(Node* node, Node* from) {
+static bool IsControlInputIndex(Node* node, int idx) {
+ return NodeProperties::FirstControlIndex(node) == idx;
+}
+
+
+void Scheduler::IncrementUnscheduledUseCount(Node* node, int idx, Node* from) {
titzer 2014/10/29 16:53:39 index
Michael Starzinger 2014/10/29 17:10:03 Done. Nooooo, 81 characters, the worst torture. :)
+ if (GetPlacement(from) == kCoupled && IsControlInputIndex(from, idx)) {
titzer 2014/10/29 16:55:07 What about a different predicate, IsControlInputTo
Michael Starzinger 2014/10/29 17:10:03 Done. Called it IsCoupledControlEdge() as before.
+ // Make sure that control edges from coupled nodes are not counted.
+ return;
+ }
if (GetPlacement(node) == kCoupled) {
// Use count for coupled nodes is summed up on their control.
Node* control = NodeProperties::GetControlInput(node);
- return IncrementUnscheduledUseCount(control, from);
+ return IncrementUnscheduledUseCount(control, idx, from);
}
++(GetData(node)->unscheduled_count_);
if (FLAG_trace_turbo_scheduler) {
@@ -175,11 +180,15 @@ void Scheduler::IncrementUnscheduledUseCount(Node* node, Node* from) {
}
-void Scheduler::DecrementUnscheduledUseCount(Node* node, Node* from) {
+void Scheduler::DecrementUnscheduledUseCount(Node* node, int idx, Node* from) {
+ if (GetPlacement(from) == kCoupled && IsControlInputIndex(from, idx)) {
+ // Make sure that control edges from coupled nodes are not counted.
+ return;
+ }
if (GetPlacement(node) == kCoupled) {
// Use count for coupled nodes is summed up on their control.
Node* control = NodeProperties::GetControlInput(node);
- return DecrementUnscheduledUseCount(control, from);
+ return DecrementUnscheduledUseCount(control, idx, from);
}
DCHECK(GetData(node)->unscheduled_count_ > 0);
--(GetData(node)->unscheduled_count_);
@@ -1010,20 +1019,14 @@ class PrepareUsesVisitor : public NullNodeVisitor {
void PostEdge(Node* from, int index, Node* to) {
// If the edge is from an unscheduled node, then tally it in the use count
- // for all of its inputs. Also make sure that control edges from coupled
- // nodes are not counted. The same criterion will be used in ScheduleLate
+ // for all of its inputs. The same criterion will be used in ScheduleLate
// for decrementing use counts.
- if (!schedule_->IsScheduled(from) && !IsCoupledControlEdge(from, index)) {
+ if (!schedule_->IsScheduled(from)) {
DCHECK_NE(Scheduler::kFixed, scheduler_->GetPlacement(from));
- scheduler_->IncrementUnscheduledUseCount(to, from);
+ scheduler_->IncrementUnscheduledUseCount(to, index, from);
}
}
- bool IsCoupledControlEdge(Node* node, int index) {
- return scheduler_->GetPlacement(node) == Scheduler::kCoupled &&
- NodeProperties::FirstControlIndex(node) == index;
- }
-
private:
Scheduler* scheduler_;
Schedule* schedule_;
« no previous file with comments | « src/compiler/scheduler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698