@@ -501,13 +501,21 @@ static bool MigrateDeprecated(Handle<Object> object) {
501501 return true ;
502502}
503503
504-
505- void IC::ConfigureVectorState (IC::State new_state) {
504+ void IC::ConfigureVectorState (IC::State new_state, Handle<Object> key) {
506505 DCHECK (UseVector ());
507506 if (new_state == PREMONOMORPHIC) {
508507 nexus ()->ConfigurePremonomorphic ();
509508 } else if (new_state == MEGAMORPHIC) {
510- nexus ()->ConfigureMegamorphic ();
509+ if (kind () == Code::LOAD_IC || kind () == Code::STORE_IC) {
510+ nexus ()->ConfigureMegamorphic ();
511+ } else if (kind () == Code::KEYED_LOAD_IC) {
512+ KeyedLoadICNexus* nexus = casted_nexus<KeyedLoadICNexus>();
513+ nexus->ConfigureMegamorphicKeyed (key->IsName () ? PROPERTY : ELEMENT);
514+ } else {
515+ DCHECK (kind () == Code::KEYED_STORE_IC);
516+ KeyedStoreICNexus* nexus = casted_nexus<KeyedStoreICNexus>();
517+ nexus->ConfigureMegamorphicKeyed (key->IsName () ? PROPERTY : ELEMENT);
518+ }
511519 } else {
512520 UNREACHABLE ();
513521 }
@@ -590,7 +598,7 @@ MaybeHandle<Object> LoadIC::Load(Handle<Object> object, Handle<Name> name) {
590598 // Rewrite to the generic keyed load stub.
591599 if (FLAG_use_ic) {
592600 DCHECK (UseVector ());
593- ConfigureVectorState (MEGAMORPHIC);
601+ ConfigureVectorState (MEGAMORPHIC, name );
594602 TRACE_GENERIC_IC (isolate (), " LoadIC" , " name as array index" );
595603 TRACE_IC (" LoadIC" , name);
596604 }
@@ -777,7 +785,7 @@ void IC::PatchCache(Handle<Name> name, Handle<Code> code) {
777785 CopyICToMegamorphicCache (name);
778786 }
779787 DCHECK (UseVector ());
780- ConfigureVectorState (MEGAMORPHIC);
788+ ConfigureVectorState (MEGAMORPHIC, name );
781789 // Fall through.
782790 case MEGAMORPHIC:
783791 UpdateMegamorphicCache (*receiver_map (), *name, *code);
@@ -875,7 +883,7 @@ void LoadIC::UpdateCaches(LookupIterator* lookup) {
875883 if (state () == UNINITIALIZED) {
876884 // This is the first time we execute this inline cache. Set the target to
877885 // the pre monomorphic stub to delay setting the monomorphic state.
878- ConfigureVectorState (PREMONOMORPHIC);
886+ ConfigureVectorState (PREMONOMORPHIC, Handle<Object>() );
879887 TRACE_IC (" LoadIC" , lookup->name ());
880888 return ;
881889 }
@@ -1250,7 +1258,7 @@ MaybeHandle<Object> KeyedLoadIC::Load(Handle<Object> object,
12501258 }
12511259
12521260 if (!is_vector_set ()) {
1253- ConfigureVectorState (MEGAMORPHIC);
1261+ ConfigureVectorState (MEGAMORPHIC, key );
12541262 TRACE_GENERIC_IC (isolate (), " KeyedLoadIC" , " set generic" );
12551263 }
12561264 TRACE_IC (" LoadIC" , key);
@@ -1342,7 +1350,7 @@ MaybeHandle<Object> StoreIC::Store(Handle<Object> object, Handle<Name> name,
13421350 // Rewrite to the generic keyed store stub.
13431351 if (FLAG_use_ic) {
13441352 DCHECK (UseVector ());
1345- ConfigureVectorState (MEGAMORPHIC);
1353+ ConfigureVectorState (MEGAMORPHIC, name );
13461354 TRACE_IC (" StoreIC" , name);
13471355 TRACE_GENERIC_IC (isolate (), " StoreIC" , " name as array index" );
13481356 }
@@ -1458,7 +1466,7 @@ void StoreIC::UpdateCaches(LookupIterator* lookup, Handle<Object> value,
14581466 if (state () == UNINITIALIZED) {
14591467 // This is the first time we execute this inline cache. Set the target to
14601468 // the pre monomorphic stub to delay setting the monomorphic state.
1461- ConfigureVectorState (PREMONOMORPHIC);
1469+ ConfigureVectorState (PREMONOMORPHIC, Handle<Object>() );
14621470 TRACE_IC (" StoreIC" , lookup->name ());
14631471 return ;
14641472 }
@@ -1878,7 +1886,7 @@ MaybeHandle<Object> KeyedStoreIC::Store(Handle<Object> object,
18781886 JSReceiver::MAY_BE_STORE_FROM_KEYED),
18791887 Object);
18801888 if (!is_vector_set ()) {
1881- ConfigureVectorState (MEGAMORPHIC);
1889+ ConfigureVectorState (MEGAMORPHIC, key );
18821890 TRACE_GENERIC_IC (isolate (), " KeyedStoreIC" ,
18831891 " unhandled internalized string key" );
18841892 TRACE_IC (" StoreIC" , key);
@@ -1951,7 +1959,7 @@ MaybeHandle<Object> KeyedStoreIC::Store(Handle<Object> object,
19511959 }
19521960
19531961 if (!is_vector_set ()) {
1954- ConfigureVectorState (MEGAMORPHIC);
1962+ ConfigureVectorState (MEGAMORPHIC, key );
19551963 TRACE_GENERIC_IC (isolate (), " KeyedStoreIC" , " set generic" );
19561964 }
19571965 TRACE_IC (" StoreIC" , key);
0 commit comments