[map] Cleanup: Smi validity "cells" are always valid

We can check map validity cells for Sminess without checking their
value, since their value as a Smi (and not a Cell) should always be
"valid"

Change-Id: Ie73079107144e352c358c0ec42abd0c10bdcf73a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3663090
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Auto-Submit: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80721}
This commit is contained in:
Leszek Swirski 2022-05-24 14:16:34 +02:00 committed by V8 LUCI CQ
parent b636d185bc
commit 1f413298e4

View File

@ -788,9 +788,13 @@ ACCESSORS_CHECKED(Map, wasm_type_info, WasmTypeInfo,
bool Map::IsPrototypeValidityCellValid() const {
Object validity_cell = prototype_validity_cell();
Object value = validity_cell.IsSmi() ? Smi::cast(validity_cell)
: Cell::cast(validity_cell).value();
return value == Smi::FromInt(Map::kPrototypeChainValid);
if (validity_cell.IsSmi()) {
// Smi validity cells should always be considered valid.
DCHECK_EQ(Smi::cast(validity_cell).value(), Map::kPrototypeChainValid);
return true;
}
Smi cell_value = Smi::cast(Cell::cast(validity_cell).value());
return cell_value == Smi::FromInt(Map::kPrototypeChainValid);
}
DEF_GETTER(Map, GetConstructor, Object) {