Index: src/compiler/scheduler.cc |
diff --git a/src/compiler/scheduler.cc b/src/compiler/scheduler.cc |
index 42ee0c4fb44ea8eb4f240877533197136e09b9ca..eb18b3939a55b4ec9fb8454867339d4630adc134 100644 |
--- a/src/compiler/scheduler.cc |
+++ b/src/compiler/scheduler.cc |
@@ -278,6 +278,20 @@ class CFGBuilder { |
TraceConnect(branch, branch_block, successor_blocks[0]); |
TraceConnect(branch, branch_block, successor_blocks[1]); |
+ // 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; |
+ case BranchHint::kTrue: |
+ successor_blocks[1]->set_deferred(true); |
+ break; |
+ case BranchHint::kFalse: |
+ successor_blocks[0]->set_deferred(true); |
+ break; |
+ } |
+ |
schedule_->AddBranch(branch_block, branch, successor_blocks[0], |
successor_blocks[1]); |
} |
@@ -1195,6 +1209,18 @@ BasicBlockVector* Scheduler::ComputeSpecialRPO(ZonePool* zone_pool, |
} |
} |
+ // Compute the assembly order (non-deferred code first, deferred code |
+ // afterwards). |
+ int32_t number = 0; |
+ for (auto block : *final_order) { |
+ if (block->deferred()) continue; |
+ block->set_ao_number(number++); |
+ } |
+ for (auto block : *final_order) { |
+ if (!block->deferred()) continue; |
+ block->set_ao_number(number++); |
+ } |
+ |
#if DEBUG |
if (FLAG_trace_turbo_scheduler) PrintRPO(num_loops, loops, final_order); |
VerifySpecialRPO(num_loops, loops, final_order); |