Commit 761a2e71 authored by Andreas Haas's avatar Andreas Haas Committed by Commit Bot

[arm64] Remove unnecessary calls to CPURegList::IsValid

In the mjsunit/wasm/asm-wasm-f32 test, {IsValid} caused 10% of the
overall runtime. In absolute numbers, {IsValid} wasm called more
than 6.000.000.000 times. I moved the calls to {IsValid} from
before-use to after-modification. I removed the calls in {Combine}
and {Remove}, because these operations cannot create an invalid
CPURegList.
These changes reduce the number of calls to {IsValid} to about
100.000.000 in the test mentioned above, and saves for that test
about 10 seconds out of before 2 minutes absolute runtime.

R=v8-arm-port@googlegroups.com

Bug: v8:9396
Change-Id: If3059f471e423405ec6f34ddef89e314dee1cbaf
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1801851
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Reviewed-by: 's avatarMartyn Capewell <martyn.capewell@arm.com>
Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63864}
parent 8da3ed08
......@@ -54,14 +54,12 @@ inline bool CPURegister::IsSP() const {
}
inline void CPURegList::Combine(const CPURegList& other) {
DCHECK(IsValid());
DCHECK(other.type() == type_);
DCHECK(other.RegisterSizeInBits() == size_);
list_ |= other.list();
}
inline void CPURegList::Remove(const CPURegList& other) {
DCHECK(IsValid());
if (other.type() == type_) {
list_ &= ~other.list();
}
......@@ -84,13 +82,12 @@ inline void CPURegList::Remove(const CPURegister& other1,
}
inline void CPURegList::Combine(int code) {
DCHECK(IsValid());
DCHECK(CPURegister::Create(code, size_, type_).IsValid());
list_ |= (1ULL << code);
DCHECK(IsValid());
}
inline void CPURegList::Remove(int code) {
DCHECK(IsValid());
DCHECK(CPURegister::Create(code, size_, type_).IsValid());
list_ &= ~(1ULL << code);
}
......
......@@ -63,7 +63,6 @@ void CpuFeatures::PrintFeatures() {}
// CPURegList utilities.
CPURegister CPURegList::PopLowestIndex() {
DCHECK(IsValid());
if (IsEmpty()) {
return NoCPUReg;
}
......@@ -74,7 +73,6 @@ CPURegister CPURegList::PopLowestIndex() {
}
CPURegister CPURegList::PopHighestIndex() {
DCHECK(IsValid());
if (IsEmpty()) {
return NoCPUReg;
}
......
......@@ -595,18 +595,16 @@ class V8_EXPORT_PRIVATE CPURegList {
}
CPURegister::RegisterType type() const {
DCHECK(IsValid());
return type_;
}
RegList list() const {
DCHECK(IsValid());
return list_;
}
inline void set_list(RegList new_list) {
DCHECK(IsValid());
list_ = new_list;
DCHECK(IsValid());
}
// Combine another CPURegList into this one. Registers that already exist in
......@@ -654,7 +652,6 @@ class V8_EXPORT_PRIVATE CPURegList {
static CPURegList GetSafepointSavedRegisters();
bool IsEmpty() const {
DCHECK(IsValid());
return list_ == 0;
}
......@@ -662,7 +659,6 @@ class V8_EXPORT_PRIVATE CPURegList {
const CPURegister& other2 = NoCPUReg,
const CPURegister& other3 = NoCPUReg,
const CPURegister& other4 = NoCPUReg) const {
DCHECK(IsValid());
RegList list = 0;
if (!other1.IsNone() && (other1.type() == type_)) list |= other1.bit();
if (!other2.IsNone() && (other2.type() == type_)) list |= other2.bit();
......@@ -672,12 +668,10 @@ class V8_EXPORT_PRIVATE CPURegList {
}
int Count() const {
DCHECK(IsValid());
return CountSetBits(list_, kRegListSizeInBits);
}
int RegisterSizeInBits() const {
DCHECK(IsValid());
return size_;
}
......@@ -688,7 +682,6 @@ class V8_EXPORT_PRIVATE CPURegList {
}
int TotalSizeInBytes() const {
DCHECK(IsValid());
return RegisterSizeInBytes() * Count();
}
......
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