Commit 52e7020a authored by Georg Neis's avatar Georg Neis Committed by Commit Bot

[turbofan] Eliminate a non-const reference argument in scheduler

Bug: v8:9429
Change-Id: I48ae73fbd32b0ea4694bea738c42e34bd921c3c6
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1700074
Auto-Submit: Georg Neis <neis@chromium.org>
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62700}
parent 91154b37
...@@ -728,12 +728,10 @@ class SpecialRPONumberer : public ZoneObject { ...@@ -728,12 +728,10 @@ class SpecialRPONumberer : public ZoneObject {
} }
}; };
int Push( int Push(int depth, BasicBlock* child, int unvisited) {
ZoneVector<SpecialRPOStackFrame>& stack, // NOLINT(runtime/references)
int depth, BasicBlock* child, int unvisited) {
if (child->rpo_number() == unvisited) { if (child->rpo_number() == unvisited) {
stack[depth].block = child; stack_[depth].block = child;
stack[depth].index = 0; stack_[depth].index = 0;
child->set_rpo_number(kBlockOnStack); child->set_rpo_number(kBlockOnStack);
return depth + 1; return depth + 1;
} }
...@@ -781,7 +779,7 @@ class SpecialRPONumberer : public ZoneObject { ...@@ -781,7 +779,7 @@ class SpecialRPONumberer : public ZoneObject {
DCHECK_LT(previous_block_count_, schedule_->BasicBlockCount()); DCHECK_LT(previous_block_count_, schedule_->BasicBlockCount());
stack_.resize(schedule_->BasicBlockCount() - previous_block_count_); stack_.resize(schedule_->BasicBlockCount() - previous_block_count_);
previous_block_count_ = schedule_->BasicBlockCount(); previous_block_count_ = schedule_->BasicBlockCount();
int stack_depth = Push(stack_, 0, entry, kBlockUnvisited1); int stack_depth = Push(0, entry, kBlockUnvisited1);
int num_loops = static_cast<int>(loops_.size()); int num_loops = static_cast<int>(loops_.size());
while (stack_depth > 0) { while (stack_depth > 0) {
...@@ -803,7 +801,7 @@ class SpecialRPONumberer : public ZoneObject { ...@@ -803,7 +801,7 @@ class SpecialRPONumberer : public ZoneObject {
} else { } else {
// Push the successor onto the stack. // Push the successor onto the stack.
DCHECK_EQ(kBlockUnvisited1, succ->rpo_number()); DCHECK_EQ(kBlockUnvisited1, succ->rpo_number());
stack_depth = Push(stack_, stack_depth, succ, kBlockUnvisited1); stack_depth = Push(stack_depth, succ, kBlockUnvisited1);
} }
} else { } else {
// Finished with all successors; pop the stack and add the block. // Finished with all successors; pop the stack and add the block.
...@@ -828,7 +826,7 @@ class SpecialRPONumberer : public ZoneObject { ...@@ -828,7 +826,7 @@ class SpecialRPONumberer : public ZoneObject {
// edges that lead out of loops. Visits each block once, but linking loop // edges that lead out of loops. Visits each block once, but linking loop
// sections together is linear in the loop size, so overall is // sections together is linear in the loop size, so overall is
// O(|B| + max(loop_depth) * max(|loop|)) // O(|B| + max(loop_depth) * max(|loop|))
stack_depth = Push(stack_, 0, entry, kBlockUnvisited2); stack_depth = Push(0, entry, kBlockUnvisited2);
while (stack_depth > 0) { while (stack_depth > 0) {
SpecialRPOStackFrame* frame = &stack_[stack_depth - 1]; SpecialRPOStackFrame* frame = &stack_[stack_depth - 1];
BasicBlock* block = frame->block; BasicBlock* block = frame->block;
...@@ -875,7 +873,7 @@ class SpecialRPONumberer : public ZoneObject { ...@@ -875,7 +873,7 @@ class SpecialRPONumberer : public ZoneObject {
loop->AddOutgoing(zone_, succ); loop->AddOutgoing(zone_, succ);
} else { } else {
// Push the successor onto the stack. // Push the successor onto the stack.
stack_depth = Push(stack_, stack_depth, succ, kBlockUnvisited2); stack_depth = Push(stack_depth, succ, kBlockUnvisited2);
if (HasLoopNumber(succ)) { if (HasLoopNumber(succ)) {
// Push the inner loop onto the loop stack. // Push the inner loop onto the loop stack.
DCHECK(GetLoopNumber(succ) < num_loops); DCHECK(GetLoopNumber(succ) < num_loops);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment