From 0c1a545a9359d343627e1ef67715966ecba4c52c Mon Sep 17 00:00:00 2001 From: "bmeurer@chromium.org" Date: Wed, 5 Nov 2014 10:43:42 +0000 Subject: [PATCH] [turbofan] Propagate "deferredness" to dominated basic blocks. TEST=cctest/test-scheduler R=mstarzinger@chromium.org Review URL: https://codereview.chromium.org/686273005 Cr-Commit-Position: refs/heads/master@{#25141} git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@25141 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/compiler/scheduler.cc | 4 ++-- test/cctest/compiler/test-scheduler.cc | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/compiler/scheduler.cc b/src/compiler/scheduler.cc index c43ed812f9..9d0d7300c1 100644 --- a/src/compiler/scheduler.cc +++ b/src/compiler/scheduler.cc @@ -415,8 +415,6 @@ class CFGBuilder { IrOpcode::kIfFalse); // Consider branch hints. - // TODO(turbofan): Propagate the deferred flag to all blocks dominated by - // this IfTrue/IfFalse later. switch (BranchHintOf(branch->op())) { case BranchHint::kNone: break; @@ -1061,6 +1059,8 @@ void Scheduler::GenerateImmediateDominatorTree() { } current->set_dominator(dominator); current->set_dominator_depth(dominator->dominator_depth() + 1); + // Propagate "deferredness" of the dominator. + if (dominator->deferred()) current->set_deferred(true); Trace("Block B%d's idom is B%d, depth = %d\n", current->id().ToInt(), dominator->id().ToInt(), current->dominator_depth()); } diff --git a/test/cctest/compiler/test-scheduler.cc b/test/cctest/compiler/test-scheduler.cc index 3a0103d8ac..5f5c9d190a 100644 --- a/test/cctest/compiler/test-scheduler.cc +++ b/test/cctest/compiler/test-scheduler.cc @@ -34,6 +34,17 @@ static void CheckRPONumbers(BasicBlockVector* order, size_t expected, CHECK_EQ(NULL, order->at(i)->loop_header()); } } + int number = 0; + for (auto const block : *order) { + if (block->deferred()) continue; + CHECK_EQ(number, block->ao_number()); + ++number; + } + for (auto const block : *order) { + if (!block->deferred()) continue; + CHECK_EQ(number, block->ao_number()); + ++number; + } } @@ -155,6 +166,7 @@ TEST(RPOLine) { BasicBlock* last = schedule.start(); for (int j = 0; j < i; j++) { BasicBlock* block = schedule.NewBasicBlock(); + block->set_deferred(i & 1); schedule.AddGoto(last, block); last = block; }