Index: src/ic/ic.cc |
diff --git a/src/ic/ic.cc b/src/ic/ic.cc |
index 1153bf9b343410607ab0dd7e3ff53198644cc26b..1e3a48c48c94b9c42526f42f3e85b8f4e459c94c 100644 |
--- a/src/ic/ic.cc |
+++ b/src/ic/ic.cc |
@@ -501,13 +501,21 @@ static bool MigrateDeprecated(Handle<Object> object) { |
return true; |
} |
- |
-void IC::ConfigureVectorState(IC::State new_state) { |
+void IC::ConfigureVectorState(IC::State new_state, Handle<Object> key) { |
DCHECK(UseVector()); |
if (new_state == PREMONOMORPHIC) { |
nexus()->ConfigurePremonomorphic(); |
} else if (new_state == MEGAMORPHIC) { |
- nexus()->ConfigureMegamorphic(); |
+ if (kind() == Code::LOAD_IC || kind() == Code::STORE_IC) { |
+ nexus()->ConfigureMegamorphic(); |
+ } else if (kind() == Code::KEYED_LOAD_IC) { |
+ KeyedLoadICNexus* nexus = casted_nexus<KeyedLoadICNexus>(); |
+ nexus->ConfigureMegamorphicKeyed(key->IsName() ? PROPERTY : ELEMENT); |
+ } else { |
+ DCHECK(kind() == Code::KEYED_STORE_IC); |
+ KeyedStoreICNexus* nexus = casted_nexus<KeyedStoreICNexus>(); |
+ nexus->ConfigureMegamorphicKeyed(key->IsName() ? PROPERTY : ELEMENT); |
+ } |
} else { |
UNREACHABLE(); |
} |
@@ -590,7 +598,7 @@ MaybeHandle<Object> LoadIC::Load(Handle<Object> object, Handle<Name> name) { |
// Rewrite to the generic keyed load stub. |
if (FLAG_use_ic) { |
DCHECK(UseVector()); |
- ConfigureVectorState(MEGAMORPHIC); |
+ ConfigureVectorState(MEGAMORPHIC, name); |
TRACE_GENERIC_IC(isolate(), "LoadIC", "name as array index"); |
TRACE_IC("LoadIC", name); |
} |
@@ -777,7 +785,7 @@ void IC::PatchCache(Handle<Name> name, Handle<Code> code) { |
CopyICToMegamorphicCache(name); |
} |
DCHECK(UseVector()); |
- ConfigureVectorState(MEGAMORPHIC); |
+ ConfigureVectorState(MEGAMORPHIC, name); |
// Fall through. |
case MEGAMORPHIC: |
UpdateMegamorphicCache(*receiver_map(), *name, *code); |
@@ -875,7 +883,7 @@ void LoadIC::UpdateCaches(LookupIterator* lookup) { |
if (state() == UNINITIALIZED) { |
// This is the first time we execute this inline cache. Set the target to |
// the pre monomorphic stub to delay setting the monomorphic state. |
- ConfigureVectorState(PREMONOMORPHIC); |
+ ConfigureVectorState(PREMONOMORPHIC, Handle<Object>()); |
TRACE_IC("LoadIC", lookup->name()); |
return; |
} |
@@ -1250,7 +1258,7 @@ MaybeHandle<Object> KeyedLoadIC::Load(Handle<Object> object, |
} |
if (!is_vector_set()) { |
- ConfigureVectorState(MEGAMORPHIC); |
+ ConfigureVectorState(MEGAMORPHIC, key); |
TRACE_GENERIC_IC(isolate(), "KeyedLoadIC", "set generic"); |
} |
TRACE_IC("LoadIC", key); |
@@ -1342,7 +1350,7 @@ MaybeHandle<Object> StoreIC::Store(Handle<Object> object, Handle<Name> name, |
// Rewrite to the generic keyed store stub. |
if (FLAG_use_ic) { |
DCHECK(UseVector()); |
- ConfigureVectorState(MEGAMORPHIC); |
+ ConfigureVectorState(MEGAMORPHIC, name); |
TRACE_IC("StoreIC", name); |
TRACE_GENERIC_IC(isolate(), "StoreIC", "name as array index"); |
} |
@@ -1458,7 +1466,7 @@ void StoreIC::UpdateCaches(LookupIterator* lookup, Handle<Object> value, |
if (state() == UNINITIALIZED) { |
// This is the first time we execute this inline cache. Set the target to |
// the pre monomorphic stub to delay setting the monomorphic state. |
- ConfigureVectorState(PREMONOMORPHIC); |
+ ConfigureVectorState(PREMONOMORPHIC, Handle<Object>()); |
TRACE_IC("StoreIC", lookup->name()); |
return; |
} |
@@ -1878,7 +1886,7 @@ MaybeHandle<Object> KeyedStoreIC::Store(Handle<Object> object, |
JSReceiver::MAY_BE_STORE_FROM_KEYED), |
Object); |
if (!is_vector_set()) { |
- ConfigureVectorState(MEGAMORPHIC); |
+ ConfigureVectorState(MEGAMORPHIC, key); |
TRACE_GENERIC_IC(isolate(), "KeyedStoreIC", |
"unhandled internalized string key"); |
TRACE_IC("StoreIC", key); |
@@ -1951,7 +1959,7 @@ MaybeHandle<Object> KeyedStoreIC::Store(Handle<Object> object, |
} |
if (!is_vector_set()) { |
- ConfigureVectorState(MEGAMORPHIC); |
+ ConfigureVectorState(MEGAMORPHIC, key); |
TRACE_GENERIC_IC(isolate(), "KeyedStoreIC", "set generic"); |
} |
TRACE_IC("StoreIC", key); |