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) { ...@@ -1784,7 +1784,7 @@ inline bool IsGrowStoreMode(KeyedAccessStoreMode store_mode) {
return store_mode == STORE_AND_GROW_HANDLE_COW; 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 // 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: // code is located and how the call sequence is expected to look like:
......
...@@ -590,7 +590,7 @@ ProcessedFeedback const& JSHeapBroker::ReadFeedbackForPropertyAccess( ...@@ -590,7 +590,7 @@ ProcessedFeedback const& JSHeapBroker::ReadFeedbackForPropertyAccess(
// We rely on this invariant in JSGenericLowering. // We rely on this invariant in JSGenericLowering.
DCHECK_IMPLIES(maps.empty(), nexus.ic_state() == MEGAMORPHIC); DCHECK_IMPLIES(maps.empty(), nexus.ic_state() == MEGAMORPHIC);
return *zone()->New<NamedAccessFeedback>(*name, maps, kind); return *zone()->New<NamedAccessFeedback>(*name, maps, kind);
} else if (nexus.GetKeyType() == ELEMENT && !maps.empty()) { } else if (nexus.GetKeyType() == IcCheckType::kElement && !maps.empty()) {
return ProcessFeedbackMapsForElementAccess( return ProcessFeedbackMapsForElementAccess(
maps, KeyedAccessMode::FromNexus(nexus), kind); maps, KeyedAccessMode::FromNexus(nexus), kind);
} else { } else {
......
...@@ -36,8 +36,8 @@ bool IC::IsHandler(MaybeObject object) { ...@@ -36,8 +36,8 @@ bool IC::IsHandler(MaybeObject object) {
bool IC::vector_needs_update() { bool IC::vector_needs_update() {
if (state() == NO_FEEDBACK) return false; if (state() == NO_FEEDBACK) return false;
return (!vector_set_ && return (!vector_set_ && (state() != MEGAMORPHIC ||
(state() != MEGAMORPHIC || nexus()->GetKeyType() != ELEMENT)); nexus()->GetKeyType() != IcCheckType::kElement));
} }
} // namespace internal } // namespace internal
......
...@@ -353,8 +353,8 @@ bool IC::ConfigureVectorState(IC::State new_state, Handle<Object> key) { ...@@ -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 // Even though we don't change the feedback data, we still want to reset the
// profiler ticks. Real-world observations suggest that optimizing these // profiler ticks. Real-world observations suggest that optimizing these
// functions doesn't improve performance. // functions doesn't improve performance.
bool changed = bool changed = nexus()->ConfigureMegamorphic(
nexus()->ConfigureMegamorphic(key->IsName() ? PROPERTY : ELEMENT); key->IsName() ? IcCheckType::kProperty : IcCheckType::kElement);
OnFeedbackChanged("Megamorphic"); OnFeedbackChanged("Megamorphic");
return changed; return changed;
} }
......
...@@ -1170,7 +1170,7 @@ Name FeedbackNexus::GetName() const { ...@@ -1170,7 +1170,7 @@ Name FeedbackNexus::GetName() const {
KeyedAccessLoadMode FeedbackNexus::GetKeyedAccessLoadMode() const { KeyedAccessLoadMode FeedbackNexus::GetKeyedAccessLoadMode() const {
DCHECK(IsKeyedLoadICKind(kind()) || IsKeyedHasICKind(kind())); DCHECK(IsKeyedLoadICKind(kind()) || IsKeyedHasICKind(kind()));
if (GetKeyType() == PROPERTY) return STANDARD_LOAD; if (GetKeyType() == IcCheckType::kProperty) return STANDARD_LOAD;
std::vector<MapAndHandler> maps_and_handlers; std::vector<MapAndHandler> maps_and_handlers;
ExtractMapsAndHandlers(&maps_and_handlers); ExtractMapsAndHandlers(&maps_and_handlers);
...@@ -1238,7 +1238,7 @@ KeyedAccessStoreMode FeedbackNexus::GetKeyedAccessStoreMode() const { ...@@ -1238,7 +1238,7 @@ KeyedAccessStoreMode FeedbackNexus::GetKeyedAccessStoreMode() const {
IsStoreDataPropertyInLiteralKind(kind()) || IsDefineOwnICKind(kind())); IsStoreDataPropertyInLiteralKind(kind()) || IsDefineOwnICKind(kind()));
KeyedAccessStoreMode mode = STANDARD_STORE; KeyedAccessStoreMode mode = STANDARD_STORE;
if (GetKeyType() == PROPERTY) return mode; if (GetKeyType() == IcCheckType::kProperty) return mode;
std::vector<MapAndHandler> maps_and_handlers; std::vector<MapAndHandler> maps_and_handlers;
ExtractMapsAndHandlers(&maps_and_handlers); ExtractMapsAndHandlers(&maps_and_handlers);
...@@ -1310,7 +1310,8 @@ IcCheckType FeedbackNexus::GetKeyType() const { ...@@ -1310,7 +1310,8 @@ IcCheckType FeedbackNexus::GetKeyType() const {
IsStoreDataPropertyInLiteralKind(kind()) || IsDefineOwnICKind(kind()) IsStoreDataPropertyInLiteralKind(kind()) || IsDefineOwnICKind(kind())
? pair.second ? pair.second
: feedback; : feedback;
return IsPropertyNameFeedback(maybe_name) ? PROPERTY : ELEMENT; return IsPropertyNameFeedback(maybe_name) ? IcCheckType::kProperty
: IcCheckType::kElement;
} }
BinaryOperationHint FeedbackNexus::GetBinaryOperationFeedback() const { BinaryOperationHint FeedbackNexus::GetBinaryOperationFeedback() const {
......
...@@ -1100,11 +1100,11 @@ RUNTIME_FUNCTION(Runtime_DefineDataPropertyInLiteral) { ...@@ -1100,11 +1100,11 @@ RUNTIME_FUNCTION(Runtime_DefineDataPropertyInLiteral) {
nexus.ConfigureMonomorphic(name, handle(object->map(), isolate), nexus.ConfigureMonomorphic(name, handle(object->map(), isolate),
MaybeObjectHandle()); MaybeObjectHandle());
} else { } else {
nexus.ConfigureMegamorphic(PROPERTY); nexus.ConfigureMegamorphic(IcCheckType::kProperty);
} }
} else if (nexus.ic_state() == MONOMORPHIC) { } else if (nexus.ic_state() == MONOMORPHIC) {
if (nexus.GetFirstMap() != object->map() || nexus.GetName() != *name) { 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