Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1245)

Side by Side Diff: src/ic/ic.cc

Issue 2123983004: [ic] Split megamorphic stub cache in two caches (for loads and for stores). (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@flags-fix
Patch Set: Rebasing Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/ic/ic.h" 5 #include "src/ic/ic.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api-arguments-inl.h" 8 #include "src/api-arguments-inl.h"
9 #include "src/api.h" 9 #include "src/api.h"
10 #include "src/arguments.h" 10 #include "src/arguments.h"
(...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after
956 } 956 }
957 } 957 }
958 } 958 }
959 if (code.is_null()) code = ComputeHandler(lookup); 959 if (code.is_null()) code = ComputeHandler(lookup);
960 } 960 }
961 961
962 PatchCache(lookup->name(), code); 962 PatchCache(lookup->name(), code);
963 TRACE_IC("LoadIC", lookup->name()); 963 TRACE_IC("LoadIC", lookup->name());
964 } 964 }
965 965
966 StubCache* IC::stub_cache() {
967 switch (kind()) {
968 case Code::LOAD_IC:
969 case Code::KEYED_LOAD_IC:
970 return isolate()->load_stub_cache();
971
972 case Code::STORE_IC:
973 case Code::KEYED_STORE_IC:
974 return isolate()->store_stub_cache();
975
976 default:
977 break;
978 }
979 UNREACHABLE();
980 return nullptr;
981 }
966 982
967 void IC::UpdateMegamorphicCache(Map* map, Name* name, Code* code) { 983 void IC::UpdateMegamorphicCache(Map* map, Name* name, Code* code) {
968 isolate()->stub_cache()->Set(name, map, code); 984 stub_cache()->Set(name, map, code);
969 } 985 }
970 986
971 987
972 Handle<Code> IC::ComputeHandler(LookupIterator* lookup, Handle<Object> value) { 988 Handle<Code> IC::ComputeHandler(LookupIterator* lookup, Handle<Object> value) {
973 // Try to find a globally shared handler stub. 989 // Try to find a globally shared handler stub.
974 Handle<Code> code = GetMapIndependentHandler(lookup); 990 Handle<Code> code = GetMapIndependentHandler(lookup);
975 if (!code.is_null()) return code; 991 if (!code.is_null()) return code;
976 992
977 // Otherwise check the map's handler cache for a map-specific handler, and 993 // Otherwise check the map's handler cache for a map-specific handler, and
978 // compile one if the cache comes up empty. 994 // compile one if the cache comes up empty.
(...skipping 23 matching lines...) Expand all
1002 TRACE_HANDLER_STATS(isolate(), IC_HandlerCacheHit); 1018 TRACE_HANDLER_STATS(isolate(), IC_HandlerCacheHit);
1003 return code; 1019 return code;
1004 } 1020 }
1005 } else { 1021 } else {
1006 // maybe_handler_ is only populated for MONOMORPHIC and POLYMORPHIC ICs. 1022 // maybe_handler_ is only populated for MONOMORPHIC and POLYMORPHIC ICs.
1007 // In MEGAMORPHIC case, check if the handler in the megamorphic stub 1023 // In MEGAMORPHIC case, check if the handler in the megamorphic stub
1008 // cache (which just missed) is different from the cached handler. 1024 // cache (which just missed) is different from the cached handler.
1009 if (state() == MEGAMORPHIC && lookup->GetReceiver()->IsHeapObject()) { 1025 if (state() == MEGAMORPHIC && lookup->GetReceiver()->IsHeapObject()) {
1010 Map* map = Handle<HeapObject>::cast(lookup->GetReceiver())->map(); 1026 Map* map = Handle<HeapObject>::cast(lookup->GetReceiver())->map();
1011 Code* megamorphic_cached_code = 1027 Code* megamorphic_cached_code =
1012 isolate()->stub_cache()->Get(*lookup->name(), map, code->flags()); 1028 stub_cache()->Get(*lookup->name(), map, code->flags());
1013 if (megamorphic_cached_code != *code) { 1029 if (megamorphic_cached_code != *code) {
1014 TRACE_HANDLER_STATS(isolate(), IC_HandlerCacheHit); 1030 TRACE_HANDLER_STATS(isolate(), IC_HandlerCacheHit);
1015 return code; 1031 return code;
1016 } 1032 }
1017 } else { 1033 } else {
1018 TRACE_HANDLER_STATS(isolate(), IC_HandlerCacheHit); 1034 TRACE_HANDLER_STATS(isolate(), IC_HandlerCacheHit);
1019 return code; 1035 return code;
1020 } 1036 }
1021 } 1037 }
1022 } 1038 }
(...skipping 1969 matching lines...) Expand 10 before | Expand all | Expand 10 after
2992 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_LOAD_IC, 3008 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_LOAD_IC,
2993 vector->GetKind(vector_slot)); 3009 vector->GetKind(vector_slot));
2994 KeyedLoadICNexus nexus(vector, vector_slot); 3010 KeyedLoadICNexus nexus(vector, vector_slot);
2995 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); 3011 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus);
2996 ic.UpdateState(receiver, key); 3012 ic.UpdateState(receiver, key);
2997 RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key)); 3013 RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key));
2998 } 3014 }
2999 } 3015 }
3000 } // namespace internal 3016 } // namespace internal
3001 } // namespace v8 3017 } // namespace v8
OLDNEW
« no previous file with comments | « src/ic/ic.h ('k') | src/ic/mips/ic-mips.cc » ('j') | src/ic/x64/stub-cache-x64.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698