Commit cb081920 authored by Leszek Swirski's avatar Leszek Swirski Committed by Commit Bot

[ic] Iterate polymorphic feedback backwards

Reduce register pressure (and therefore spills) across the loop
iterating over the LoadIC polymorphic feedback array by starting at
length - 1 and iterating down to 0.

Might give a tiny recency boost too.

Change-Id: I1295a8136212c339b9d3974e2d49b3ecfe1ce543
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1687545Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62528}
parent 1f872cbc
...@@ -107,12 +107,12 @@ void AccessorAssembler::HandlePolymorphicCase( ...@@ -107,12 +107,12 @@ void AccessorAssembler::HandlePolymorphicCase(
// Load the {feedback} array length. // Load the {feedback} array length.
TNode<IntPtrT> length = LoadAndUntagWeakFixedArrayLength(feedback); TNode<IntPtrT> length = LoadAndUntagWeakFixedArrayLength(feedback);
CSA_ASSERT(this, IntPtrLessThanOrEqual(IntPtrConstant(1), length)); CSA_ASSERT(this, IntPtrLessThanOrEqual(IntPtrConstant(kEntrySize), length));
// This is a hand-crafted loop that only compares against the {length} // This is a hand-crafted loop that iterates backwards and only compares
// in the end, since we already know that we will have at least a single // against zero at the end, since we already know that we will have at least a
// entry in the {feedback} array anyways. // single entry in the {feedback} array anyways.
TVARIABLE(IntPtrT, var_index, IntPtrConstant(0)); TVARIABLE(IntPtrT, var_index, IntPtrSub(length, IntPtrConstant(kEntrySize)));
Label loop(this, &var_index), loop_next(this); Label loop(this, &var_index), loop_next(this);
Goto(&loop); Goto(&loop);
BIND(&loop); BIND(&loop);
...@@ -131,8 +131,9 @@ void AccessorAssembler::HandlePolymorphicCase( ...@@ -131,8 +131,9 @@ void AccessorAssembler::HandlePolymorphicCase(
BIND(&loop_next); BIND(&loop_next);
var_index = var_index =
Signed(IntPtrAdd(var_index.value(), IntPtrConstant(kEntrySize))); Signed(IntPtrSub(var_index.value(), IntPtrConstant(kEntrySize)));
Branch(IntPtrLessThan(var_index.value(), length), &loop, if_miss); Branch(IntPtrGreaterThanOrEqual(var_index.value(), IntPtrConstant(0)),
&loop, if_miss);
} }
} }
......
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