[compiler] Turn CHECKs into DCHECKs

This turns some CHECKs in the mid-tier register allocator into DCHECKs.
The ones inside {CheckConsistency} should be DCHECKs anyway, even if
they are inside an "#ifdef DEBUG" block. This will make ClusterFuzz
correctly detect them as "checks that only happen in debug mode".
Others were just unnecessarily always included, instead of only in debug
builds.

R=thibaudm@chromium.org

Bug: chromium:1271369
Change-Id: I51acde3c951c7a2af9dee36e25b196364ddf8f5c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3406760
Reviewed-by: Thibaud Michaud <thibaudm@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#78741}
This commit is contained in:
Clemens Backes 2022-01-21 18:59:06 +01:00 committed by V8 LUCI CQ
parent 3224cd8aac
commit c8cda40b6e

View File

@ -1001,7 +1001,7 @@ void RegisterState::Register::CommitAtMerge() {
--num_commits_required_;
// We should still have commits required that will be resolved in the merge
// block.
CHECK_GT(num_commits_required_, 0);
DCHECK_GT(num_commits_required_, 0);
}
void RegisterState::Register::Commit(AllocatedOperand allocated_op,
@ -1068,7 +1068,7 @@ void RegisterState::Register::Spill(AllocatedOperand allocated_op,
bool is_shared = is_shared_;
Reset();
is_shared_ = is_shared;
CHECK_IMPLIES(is_shared_, was_spilled_while_shared());
DCHECK_IMPLIES(is_shared_, was_spilled_while_shared());
}
void RegisterState::Register::SpillPhiGapMove(
@ -1953,27 +1953,27 @@ void SinglePassRegisterAllocator::CheckConsistency() {
for (RegisterIndex reg : virtual_register_to_reg_) {
++virtual_register;
if (!reg.is_valid()) continue;
CHECK_NOT_NULL(register_state_);
DCHECK_NOT_NULL(register_state_);
// The register must be set to allocated.
CHECK(register_state_->IsAllocated(reg));
DCHECK(register_state_->IsAllocated(reg));
// reg <-> vreg linking is consistent.
CHECK_EQ(virtual_register, VirtualRegisterForRegister(reg));
DCHECK_EQ(virtual_register, VirtualRegisterForRegister(reg));
}
CHECK_EQ(data_->code()->VirtualRegisterCount() - 1, virtual_register);
DCHECK_EQ(data_->code()->VirtualRegisterCount() - 1, virtual_register);
RegisterBitVector used_registers;
for (RegisterIndex reg : *register_state_) {
if (!register_state_->IsAllocated(reg)) continue;
int virtual_register = VirtualRegisterForRegister(reg);
// reg <-> vreg linking is consistent.
CHECK_EQ(reg, RegisterForVirtualRegister(virtual_register));
DCHECK_EQ(reg, RegisterForVirtualRegister(virtual_register));
MachineRepresentation rep = VirtualRegisterDataFor(virtual_register).rep();
// Allocated registers do not overlap.
CHECK(!used_registers.Contains(reg, rep));
DCHECK(!used_registers.Contains(reg, rep));
used_registers.Add(reg, rep);
}
// The {allocated_registers_bits_} bitvector is accurate.
CHECK_EQ(used_registers, allocated_registers_bits_);
DCHECK_EQ(used_registers, allocated_registers_bits_);
#endif
}