Commit 9b913366 authored by Clemens Backes's avatar Clemens Backes Committed by V8 LUCI CQ

[liftoff] Mark tagged safepoint slots in reversed order

Setting the highest bit first saves cost for repeatedly growing the
underlying bitvector.

R=jkummerow@chromium.org

Bug: v8:13063
Change-Id: Ic324caa20c91dd6f55760944c3dafe7f1dc018b4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3776340
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81849}
parent 3c984ee9
......@@ -100,6 +100,12 @@ class SmallVector {
T* end() { return end_; }
const T* end() const { return end_; }
auto rbegin() { return std::reverse_iterator{end_}; }
auto rbegin() const { return std::reverse_iterator{end_}; }
auto rend() { return std::reverse_iterator{begin_}; }
auto rend() const { return std::reverse_iterator{begin_}; }
size_t size() const { return end_ - begin_; }
bool empty() const { return end_ == begin_; }
size_t capacity() const { return end_of_storage_ - begin_; }
......
......@@ -569,7 +569,9 @@ void LiftoffAssembler::CacheState::GetTaggedSlotsForOOLCode(
void LiftoffAssembler::CacheState::DefineSafepoint(
SafepointTableBuilder::Safepoint& safepoint) {
for (const auto& slot : stack_state) {
// Go in reversed order to set the higher bits first; this avoids cost for
// growing the underlying bitvector.
for (const auto& slot : base::Reversed(stack_state)) {
if (is_reference(slot.kind())) {
DCHECK(slot.is_stack());
safepoint.DefineTaggedStackSlot(GetSafepointIndexForStackSlot(slot));
......
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