Commit 96671ab2 authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[Liftoff] Change the way we store stack transfers

Stack transfers consist of a number of register moves plus a number of
register loads. We currently store both in separate vectors. This CL
changes that to be stored in arrays indexed by the destination register
(such that it behaves like a map). This avoids any dynamically growing
structures.

Measured locally, this speeds up stack transfer processing by ~10%,
which translates to ~0.5% of overall Liftoff compilation time.

R=ahaas@chromium.org

Bug: v8:6600, v8:8423
Change-Id: Id532960dcc12f228507ed75e392ad4c57710593f
Reviewed-on: https://chromium-review.googlesource.com/c/1396278
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58587}
parent 81becb8c
This diff is collapsed.
......@@ -195,6 +195,8 @@ inline std::ostream& operator<<(std::ostream& os, LiftoffRegister reg) {
class LiftoffRegList {
public:
class Iterator;
static constexpr bool use_u16 = kAfterMaxLiftoffRegCode <= 16;
static constexpr bool use_u32 = !use_u16 && kAfterMaxLiftoffRegCode <= 32;
using storage_t = std::conditional<
......@@ -282,6 +284,12 @@ class LiftoffRegList {
return FromBits(regs_ & ~mask.regs_);
}
RegList GetGpList() { return regs_ & kGpMask; }
RegList GetFpList() { return (regs_ & kFpMask) >> kAfterMaxLiftoffGpRegCode; }
inline Iterator begin() const;
inline Iterator end() const;
static LiftoffRegList FromBits(storage_t bits) {
DCHECK_EQ(bits, bits & (kGpMask | kFpMask));
return LiftoffRegList(bits);
......@@ -300,9 +308,6 @@ class LiftoffRegList {
return list;
}
RegList GetGpList() { return regs_ & kGpMask; }
RegList GetFpList() { return (regs_ & kFpMask) >> kAfterMaxLiftoffGpRegCode; }
private:
storage_t regs_ = 0;
......@@ -316,6 +321,30 @@ static constexpr LiftoffRegList kGpCacheRegList =
static constexpr LiftoffRegList kFpCacheRegList =
LiftoffRegList::FromBits<LiftoffRegList::kFpMask>();
class LiftoffRegList::Iterator {
public:
LiftoffRegister operator*() { return remaining_.GetFirstRegSet(); }
Iterator& operator++() {
remaining_.clear(remaining_.GetFirstRegSet());
return *this;
}
bool operator==(Iterator other) { return remaining_ == other.remaining_; }
bool operator!=(Iterator other) { return remaining_ != other.remaining_; }
private:
explicit Iterator(LiftoffRegList remaining) : remaining_(remaining) {}
friend class LiftoffRegList;
LiftoffRegList remaining_;
};
LiftoffRegList::Iterator LiftoffRegList::begin() const {
return Iterator{*this};
}
LiftoffRegList::Iterator LiftoffRegList::end() const {
return Iterator{LiftoffRegList{}};
}
static constexpr LiftoffRegList GetCacheRegList(RegClass rc) {
return rc == kFpReg ? kFpCacheRegList : kGpCacheRegList;
}
......
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