Revision: 23160
Author:   [email protected]
Date:     Mon Aug 18 13:09:06 2014 UTC
Log: Move some methods from OperatorProperties into Scheduler that are only related to scheduling. Now these methods take a Node* parameter, as decisions relating floating control need distinguish not just operators but nodes.

[email protected]
BUG=

Review URL: https://codereview.chromium.org/474983003
http://code.google.com/p/v8/source/detail?r=23160

Modified:
 /branches/bleeding_edge/src/compiler/operator-properties-inl.h
 /branches/bleeding_edge/src/compiler/operator-properties.h
 /branches/bleeding_edge/src/compiler/scheduler.cc
 /branches/bleeding_edge/src/compiler/scheduler.h

=======================================
--- /branches/bleeding_edge/src/compiler/operator-properties-inl.h Mon Aug 18 11:36:06 2014 UTC +++ /branches/bleeding_edge/src/compiler/operator-properties-inl.h Mon Aug 18 13:09:06 2014 UTC
@@ -122,21 +122,6 @@
          opcode == IrOpcode::kMerge || opcode == IrOpcode::kIfTrue ||
          opcode == IrOpcode::kIfFalse;
 }
-
-inline bool OperatorProperties::CanBeScheduled(Operator* op) { return true; }
-
-inline bool OperatorProperties::HasFixedSchedulePosition(Operator* op) {
-  IrOpcode::Value opcode = static_cast<IrOpcode::Value>(op->opcode());
-  return (IrOpcode::IsControlOpcode(opcode)) ||
- opcode == IrOpcode::kParameter || opcode == IrOpcode::kEffectPhi | |
-         opcode == IrOpcode::kPhi;
-}
-
-inline bool OperatorProperties::IsScheduleRoot(Operator* op) {
-  uint8_t opcode = op->opcode();
-  return opcode == IrOpcode::kEnd || opcode == IrOpcode::kEffectPhi ||
-         opcode == IrOpcode::kPhi;
-}

 inline bool OperatorProperties::CanLazilyDeoptimize(Operator* op) {
   // TODO(jarin) This function allows turning on lazy deoptimization
=======================================
--- /branches/bleeding_edge/src/compiler/operator-properties.h Thu Aug 7 09:14:37 2014 UTC +++ /branches/bleeding_edge/src/compiler/operator-properties.h Mon Aug 18 13:09:06 2014 UTC
@@ -35,11 +35,6 @@
   static inline int GetControlOutputCount(Operator* op);

   static inline bool IsBasicBlockBegin(Operator* op);
-
-  static inline bool CanBeScheduled(Operator* op);
-  static inline bool HasFixedSchedulePosition(Operator* op);
-  static inline bool IsScheduleRoot(Operator* op);
-
   static inline bool CanLazilyDeoptimize(Operator* op);
 };
 }
=======================================
--- /branches/bleeding_edge/src/compiler/scheduler.cc Mon Aug 18 08:59:55 2014 UTC +++ /branches/bleeding_edge/src/compiler/scheduler.cc Mon Aug 18 13:09:06 2014 UTC
@@ -51,6 +51,29 @@

   return schedule;
 }
+
+
+bool Scheduler::IsBasicBlockBegin(Node* node) {
+  return OperatorProperties::IsBasicBlockBegin(node->op());
+}
+
+
+bool Scheduler::CanBeScheduled(Node* node) { return true; }
+
+
+bool Scheduler::HasFixedSchedulePosition(Node* node) {
+  IrOpcode::Value opcode = node->opcode();
+  return (IrOpcode::IsControlOpcode(opcode)) ||
+ opcode == IrOpcode::kParameter || opcode == IrOpcode::kEffectPhi | |
+         opcode == IrOpcode::kPhi;
+}
+
+
+bool Scheduler::IsScheduleRoot(Node* node) {
+  IrOpcode::Value opcode = node->opcode();
+  return opcode == IrOpcode::kEnd || opcode == IrOpcode::kEffectPhi ||
+         opcode == IrOpcode::kPhi;
+}


 class CreateBlockVisitor : public NullNodeVisitor {
@@ -150,7 +173,7 @@
     // For all of the merge's control inputs, add a goto at the end to the
     // merge's basic block.
for (InputIter j = (*i)->inputs().begin(); j != (*i)->inputs().end(); ++j) {
-      if (OperatorProperties::IsBasicBlockBegin((*i)->op())) {
+      if (IsBasicBlockBegin((*i))) {
         BasicBlock* predecessor_block = schedule_->block(*j);
         if ((*j)->opcode() != IrOpcode::kReturn &&
             (*j)->opcode() != IrOpcode::kDeoptimize) {
@@ -368,7 +391,7 @@
     int max_rpo = 0;
// Otherwise, the minimum rpo for the node is the max of all of the inputs.
     if (!IsFixedNode(node)) {
-      DCHECK(!OperatorProperties::IsBasicBlockBegin(node->op()));
+      DCHECK(!scheduler_->IsBasicBlockBegin(node));
       for (InputIter i = node->inputs().begin(); i != node->inputs().end();
            ++i) {
int control_rpo = scheduler_->schedule_early_rpo_index_[(*i)->id()];
@@ -387,9 +410,9 @@
     return GenericGraphVisit::CONTINUE;
   }

-  static bool IsFixedNode(Node* node) {
-    return OperatorProperties::HasFixedSchedulePosition(node->op()) ||
-           !OperatorProperties::CanBeScheduled(node->op());
+  bool IsFixedNode(Node* node) {
+    return scheduler_->HasFixedSchedulePosition(node) ||
+           !scheduler_->CanBeScheduled(node);
   }

// TODO(mstarzinger): Dirty hack to unblock others, schedule early should be
@@ -431,7 +454,7 @@
// right place; it's a convenient place during the preparation of use counts
     // to schedule them.
     if (!schedule_->IsScheduled(node) &&
-        OperatorProperties::HasFixedSchedulePosition(node->op())) {
+        scheduler_->HasFixedSchedulePosition(node)) {
       if (FLAG_trace_turbo_scheduler) {
         PrintF("Fixed position node %d is unscheduled, scheduling now\n",
                node->id());
@@ -445,7 +468,7 @@
       schedule_->AddNode(block, node);
     }

-    if (OperatorProperties::IsScheduleRoot(node->op())) {
+    if (scheduler_->IsScheduleRoot(node)) {
       scheduler_->schedule_root_nodes_.push_back(node);
     }

@@ -456,9 +479,8 @@
// If the edge is from an unscheduled node, then tally it in the use count // for all of its inputs. The same criterion will be used in ScheduleLate
     // for decrementing use counts.
-    if (!schedule_->IsScheduled(from) &&
-        OperatorProperties::CanBeScheduled(from->op())) {
-      DCHECK(!OperatorProperties::HasFixedSchedulePosition(from->op()));
+ if (!schedule_->IsScheduled(from) && scheduler_->CanBeScheduled(from)) {
+      DCHECK(!scheduler_->HasFixedSchedulePosition(from));
       ++scheduler_->unscheduled_uses_[to->id()];
       if (FLAG_trace_turbo_scheduler) {
         PrintF("Incrementing uses of node %d from %d to %d\n", to->id(),
@@ -491,11 +513,10 @@

   GenericGraphVisit::Control Pre(Node* node) {
// Don't schedule nodes that cannot be scheduled or are already scheduled.
-    if (!OperatorProperties::CanBeScheduled(node->op()) ||
-        schedule_->IsScheduled(node)) {
+ if (!scheduler_->CanBeScheduled(node) || schedule_->IsScheduled(node)) {
       return GenericGraphVisit::CONTINUE;
     }
-    DCHECK(!OperatorProperties::HasFixedSchedulePosition(node->op()));
+    DCHECK(!scheduler_->HasFixedSchedulePosition(node));

// If all the uses of a node have been scheduled, then the node itself can
     // be scheduled.
@@ -562,7 +583,7 @@
   BasicBlock* GetBlockForUse(Node::Edge edge) {
     Node* use = edge.from();
     IrOpcode::Value opcode = use->opcode();
-    // If the use is a phi, forward through the the phi to the basic block
+    // If the use is a phi, forward through the phi to the basic block
     // corresponding to the phi's input.
     if (opcode == IrOpcode::kPhi || opcode == IrOpcode::kEffectPhi) {
       int index = edge.index();
@@ -581,11 +602,6 @@
     }
     return result;
   }
-
-  bool IsNodeEligible(Node* node) {
-    bool eligible = scheduler_->unscheduled_uses_[node->id()] == 0;
-    return eligible;
-  }

   void ScheduleNode(BasicBlock* block, Node* node) {
     schedule_->PlanNode(block, node);
=======================================
--- /branches/bleeding_edge/src/compiler/scheduler.h Mon Aug 18 08:59:55 2014 UTC +++ /branches/bleeding_edge/src/compiler/scheduler.h Mon Aug 18 13:09:06 2014 UTC
@@ -44,6 +44,11 @@

   Scheduler(Zone* zone, Graph* graph, Schedule* schedule);

+  bool IsBasicBlockBegin(Node* node);
+  bool CanBeScheduled(Node* node);
+  bool HasFixedSchedulePosition(Node* node);
+  bool IsScheduleRoot(Node* node);
+
   int GetRPONumber(BasicBlock* block) {
     DCHECK(block->rpo_number_ >= 0 &&
block->rpo_number_ < static_cast<int>(schedule_->rpo_order_.size()));

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to