[liftoff] Add some more assumptions

In particular, {CountTrailingZeros} can skip a dynamic check if it knows
that the input is not zero.

R=ahaas@chromium.org

Bug: v8:13565, v8:13673
Change-Id: I46d4fea2952d22f57b0695f5db690d6fefd7c1ad
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4212401
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/main@{#85597}
This commit is contained in:
Clemens Backes 2023-02-01 15:31:53 +01:00 committed by V8 LUCI CQ
parent d29a0c4e9b
commit 8082a8f51a
2 changed files with 3 additions and 3 deletions

View File

@ -34,7 +34,7 @@ class RegisterBase {
static constexpr SubType no_reg() { return SubType{kCode_no_reg}; }
static constexpr SubType from_code(int8_t code) {
DCHECK(base::IsInRange(static_cast<int>(code), 0, kNumRegisters - 1));
V8_ASSUME(code >= 0 && code < kNumRegisters);
return SubType{code};
}

View File

@ -446,13 +446,13 @@ class LiftoffRegList {
}
LiftoffRegister GetFirstRegSet() const {
DCHECK(!is_empty());
V8_ASSUME(regs_ != 0);
int first_code = base::bits::CountTrailingZeros(regs_);
return LiftoffRegister::from_liftoff_code(first_code);
}
LiftoffRegister GetLastRegSet() const {
DCHECK(!is_empty());
V8_ASSUME(regs_ != 0);
int last_code =
8 * sizeof(regs_) - 1 - base::bits::CountLeadingZeros(regs_);
return LiftoffRegister::from_liftoff_code(last_code);