Revision: 25188
Author:   [email protected]
Date:     Thu Nov  6 12:30:47 2014 UTC
Log:      Remove workaround for successors on end block from scheduler.

[email protected]
TEST=cctest/test-scheduler/RPOLoop

Review URL: https://codereview.chromium.org/708763002
https://code.google.com/p/v8/source/detail?r=25188

Modified:
 /branches/bleeding_edge/src/compiler/scheduler.cc
 /branches/bleeding_edge/test/cctest/compiler/test-scheduler.cc

=======================================
--- /branches/bleeding_edge/src/compiler/scheduler.cc Thu Nov 6 11:40:33 2014 UTC +++ /branches/bleeding_edge/src/compiler/scheduler.cc Thu Nov 6 12:30:47 2014 UTC
@@ -527,7 +527,6 @@
         schedule_(schedule),
         order_(NULL),
         loops_(zone),
-        beyond_end_(NULL),
         backedges_(1, zone),
         stack_(zone),
         previous_block_count_(0) {}
@@ -535,9 +534,9 @@
// Computes the special reverse-post-order for the main control flow graph, // that is for the graph spanned between the schedule's start and end blocks.
   void ComputeSpecialRPO() {
+    DCHECK(schedule_->end()->SuccessorCount() == 0);
     DCHECK_EQ(NULL, order_);  // Main order does not exist yet.
-    // TODO(mstarzinger): Should use Schedule::end() after tests are fixed.
-    ComputeAndInsertSpecialRPO(schedule_->start(), NULL);
+    ComputeAndInsertSpecialRPO(schedule_->start(), schedule_->end());
   }

// Computes the special reverse-post-order for a partial control flow graph,
@@ -570,7 +569,9 @@
       l->block->set_rpo_number(number++);
       schedule_->rpo_order()->push_back(l->block);
     }
-    BeyondEndSentinel()->set_rpo_number(number);
+    if (schedule_->end()->rpo_number() < 0) {
+      schedule_->end()->set_rpo_number(number);
+    }
   }

   // Print and verify the special reverse-post-order.
@@ -654,17 +655,6 @@
   static bool HasLoopNumber(BasicBlock* block) {
     return block->ao_number() >= 0;
   }
-
- // TODO(mstarzinger): We only need this special sentinel because some tests - // use the schedule's end block in actual control flow (e.g. with end having - // successors). Once this has been cleaned up we can use the end block here.
-  BasicBlock* BeyondEndSentinel() {
-    if (beyond_end_ == NULL) {
-      BasicBlock::Id id = BasicBlock::Id::FromInt(-1);
- beyond_end_ = new (schedule_->zone()) BasicBlock(schedule_->zone(), id);
-    }
-    return beyond_end_;
-  }

// Compute special RPO for the control flow graph between {entry} and {end},
   // mutating any existing order so that the result is still valid.
@@ -848,7 +838,7 @@
         ++loop_depth;
         current_loop = &loops_[GetLoopNumber(current)];
         BlockList* end = current_loop->end;
- current->set_loop_end(end == NULL ? BeyondEndSentinel() : end->block);
+        current->set_loop_end(end == NULL ? schedule_->end() : end->block);
         current_header = current_loop->header;
         Trace("B%d is a loop header, increment loop depth to %d\n",
               current->id().ToInt(), loop_depth);
@@ -1018,7 +1008,6 @@
   Schedule* schedule_;
   BlockList* order_;
   ZoneVector<LoopInfo> loops_;
-  BasicBlock* beyond_end_;
   ZoneList<Backedge> backedges_;
   ZoneVector<SpecialRPOStackFrame> stack_;
   size_t previous_block_count_;
=======================================
--- /branches/bleeding_edge/test/cctest/compiler/test-scheduler.cc Thu Nov 6 09:15:10 2014 UTC +++ /branches/bleeding_edge/test/cctest/compiler/test-scheduler.cc Thu Nov 6 12:30:47 2014 UTC
@@ -200,12 +200,13 @@
 TEST(RPOEntryLoop) {
   HandleAndZoneScope scope;
   Schedule schedule(scope.main_zone());
-  schedule.AddSuccessorForTesting(schedule.start(), schedule.end());
-  schedule.AddSuccessorForTesting(schedule.end(), schedule.start());
+  BasicBlock* body = schedule.NewBasicBlock();
+  schedule.AddSuccessorForTesting(schedule.start(), body);
+  schedule.AddSuccessorForTesting(body, schedule.start());
   ZonePool zone_pool(scope.main_isolate());
BasicBlockVector* order = Scheduler::ComputeSpecialRPO(&zone_pool, &schedule);
   CheckRPONumbers(order, 2, true);
-  BasicBlock* loop[] = {schedule.start(), schedule.end()};
+  BasicBlock* loop[] = {schedule.start(), body};
   CheckLoop(order, loop, 2);
 }

@@ -653,7 +654,7 @@
   BasicBlock* A = schedule.start();
   BasicBlock* B = schedule.NewBasicBlock();
   BasicBlock* C = schedule.NewBasicBlock();
-  BasicBlock* D = schedule.end();
+  BasicBlock* D = schedule.NewBasicBlock();
   BasicBlock* E = schedule.NewBasicBlock();

   schedule.AddSuccessorForTesting(A, B);

--
--
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