Commit b2dee351 authored by Ng Zhi An's avatar Ng Zhi An Committed by V8 LUCI CQ

[cleanup] Make IcCheckType an enum class

Fixes -Wshadow warnings for ELEMENT.

Bug: v8:12244,v8:12245
Change-Id: Ic3dfa96b44fc18f0db10752639a54aeca324667c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3276928Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Reviewed-by: 's avatarNico Hartmann <nicohartmann@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#77954}
parent 4b239782
......@@ -1784,7 +1784,7 @@ inline bool IsGrowStoreMode(KeyedAccessStoreMode store_mode) {
return store_mode == STORE_AND_GROW_HANDLE_COW;
}
enum IcCheckType { ELEMENT, PROPERTY };
enum class IcCheckType { kElement, kProperty };
// Helper stubs can be called in different ways depending on where the target
// code is located and how the call sequence is expected to look like:
......
......@@ -590,7 +590,7 @@ ProcessedFeedback const& JSHeapBroker::ReadFeedbackForPropertyAccess(
// We rely on this invariant in JSGenericLowering.
DCHECK_IMPLIES(maps.empty(), nexus.ic_state() == MEGAMORPHIC);
return *zone()->New<NamedAccessFeedback>(*name, maps, kind);
} else if (nexus.GetKeyType() == ELEMENT && !maps.empty()) {
} else if (nexus.GetKeyType() == IcCheckType::kElement && !maps.empty()) {
return ProcessFeedbackMapsForElementAccess(
maps, KeyedAccessMode::FromNexus(nexus), kind);
} else {
......
......@@ -36,8 +36,8 @@ bool IC::IsHandler(MaybeObject object) {
bool IC::vector_needs_update() {
if (state() == NO_FEEDBACK) return false;
return (!vector_set_ &&
(state() != MEGAMORPHIC || nexus()->GetKeyType() != ELEMENT));
return (!vector_set_ && (state() != MEGAMORPHIC ||
nexus()->GetKeyType() != IcCheckType::kElement));
}
} // namespace internal
......
......@@ -353,8 +353,8 @@ bool IC::ConfigureVectorState(IC::State new_state, Handle<Object> key) {
// Even though we don't change the feedback data, we still want to reset the
// profiler ticks. Real-world observations suggest that optimizing these
// functions doesn't improve performance.
bool changed =
nexus()->ConfigureMegamorphic(key->IsName() ? PROPERTY : ELEMENT);
bool changed = nexus()->ConfigureMegamorphic(
key->IsName() ? IcCheckType::kProperty : IcCheckType::kElement);
OnFeedbackChanged("Megamorphic");
return changed;
}
......
......@@ -1170,7 +1170,7 @@ Name FeedbackNexus::GetName() const {
KeyedAccessLoadMode FeedbackNexus::GetKeyedAccessLoadMode() const {
DCHECK(IsKeyedLoadICKind(kind()) || IsKeyedHasICKind(kind()));
if (GetKeyType() == PROPERTY) return STANDARD_LOAD;
if (GetKeyType() == IcCheckType::kProperty) return STANDARD_LOAD;
std::vector<MapAndHandler> maps_and_handlers;
ExtractMapsAndHandlers(&maps_and_handlers);
......@@ -1238,7 +1238,7 @@ KeyedAccessStoreMode FeedbackNexus::GetKeyedAccessStoreMode() const {
IsStoreDataPropertyInLiteralKind(kind()) || IsDefineOwnICKind(kind()));
KeyedAccessStoreMode mode = STANDARD_STORE;
if (GetKeyType() == PROPERTY) return mode;
if (GetKeyType() == IcCheckType::kProperty) return mode;
std::vector<MapAndHandler> maps_and_handlers;
ExtractMapsAndHandlers(&maps_and_handlers);
......@@ -1310,7 +1310,8 @@ IcCheckType FeedbackNexus::GetKeyType() const {
IsStoreDataPropertyInLiteralKind(kind()) || IsDefineOwnICKind(kind())
? pair.second
: feedback;
return IsPropertyNameFeedback(maybe_name) ? PROPERTY : ELEMENT;
return IsPropertyNameFeedback(maybe_name) ? IcCheckType::kProperty
: IcCheckType::kElement;
}
BinaryOperationHint FeedbackNexus::GetBinaryOperationFeedback() const {
......
......@@ -1100,11 +1100,11 @@ RUNTIME_FUNCTION(Runtime_DefineDataPropertyInLiteral) {
nexus.ConfigureMonomorphic(name, handle(object->map(), isolate),
MaybeObjectHandle());
} else {
nexus.ConfigureMegamorphic(PROPERTY);
nexus.ConfigureMegamorphic(IcCheckType::kProperty);
}
} else if (nexus.ic_state() == MONOMORPHIC) {
if (nexus.GetFirstMap() != object->map() || nexus.GetName() != *name) {
nexus.ConfigureMegamorphic(PROPERTY);
nexus.ConfigureMegamorphic(IcCheckType::kProperty);
}
}
}
......
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