[ic] Fix TraceIC to also work without feedback vector

TraceIC always expects a valid feedback vector to check for state
transitions. With lazy feedback allocations, it is possible that we don't
have feedback vectors. This cl fixes TraceIC to also work when there is no
feedback vector.

Bug: v8:8394
Change-Id: If7e40a9f16de7415e04a812440ccc0cfcf1cbc07
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1584322
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Commit-Queue: Mythri Alle <mythria@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61126}
This commit is contained in:
Mythri A 2019-04-25 17:49:44 +01:00 committed by Commit Bot
parent 7c42628676
commit f0cf0b2862

View File

@ -45,7 +45,7 @@ namespace internal {
char IC::TransitionMarkFromState(IC::State state) {
switch (state) {
case NO_FEEDBACK:
UNREACHABLE();
return 'X';
case UNINITIALIZED:
return '0';
case PREMONOMORPHIC:
@ -91,7 +91,8 @@ const char* GetModifier(KeyedAccessStoreMode mode) {
void IC::TraceIC(const char* type, Handle<Object> name) {
if (V8_LIKELY(!TracingFlags::is_ic_stats_enabled())) return;
if (AddressIsDeoptimizedCode()) return;
State new_state = nexus()->ic_state();
State new_state =
(state() == NO_FEEDBACK) ? NO_FEEDBACK : nexus()->ic_state();
TraceIC(type, name, state(), new_state);
}
@ -105,7 +106,9 @@ void IC::TraceIC(const char* type, Handle<Object> name, State old_state,
}
const char* modifier = "";
if (IsKeyedLoadIC()) {
if (state() == NO_FEEDBACK) {
modifier = "";
} else if (IsKeyedLoadIC()) {
KeyedAccessLoadMode mode = nexus()->GetKeyedAccessLoadMode();
modifier = GetModifier(mode);
} else if (IsKeyedStoreIC() || IsStoreInArrayLiteralICKind(kind())) {
@ -706,7 +709,8 @@ void IC::PatchCache(Handle<Name> name, const MaybeObjectHandle& handler) {
}
void LoadIC::UpdateCaches(LookupIterator* lookup) {
if (state() == UNINITIALIZED && !IsLoadGlobalIC()) {
if (!FLAG_lazy_feedback_allocation && state() == UNINITIALIZED &&
!IsLoadGlobalIC()) {
// This is the first time we execute this inline cache. Set the target to
// the pre monomorphic stub to delay setting the monomorphic state.
TRACE_HANDLER_STATS(isolate(), LoadIC_Premonomorphic);