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

Unified Diff: src/ic/ic-compiler.cc

Issue 1875033003: Revert of Turn StoreIC::Megamorphic into a builtin, get rid of the non-monomorphic-cache (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ic/ic-compiler.h ('k') | src/snapshot/code-serializer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ic/ic-compiler.cc
diff --git a/src/ic/ic-compiler.cc b/src/ic/ic-compiler.cc
index 3c2619d0e6dd45fc0a3c6d7ef25b1a7d8d8f4873..dbdb59589c134d2b380d00bcb257c95b33071101 100644
--- a/src/ic/ic-compiler.cc
+++ b/src/ic/ic-compiler.cc
@@ -43,32 +43,87 @@
return stub;
}
+
Handle<Code> PropertyICCompiler::ComputeKeyedStoreMonomorphicHandler(
- Handle<Map> receiver_map, KeyedAccessStoreMode store_mode) {
+ Handle<Map> receiver_map, LanguageMode language_mode,
+ KeyedAccessStoreMode store_mode) {
Isolate* isolate = receiver_map->GetIsolate();
+ ExtraICState extra_state =
+ KeyedStoreIC::ComputeExtraICState(language_mode, store_mode);
DCHECK(store_mode == STANDARD_STORE ||
store_mode == STORE_AND_GROW_NO_TRANSITION ||
store_mode == STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS ||
store_mode == STORE_NO_TRANSITION_HANDLE_COW);
- PropertyICCompiler compiler(isolate);
+ PropertyICCompiler compiler(isolate, Code::KEYED_STORE_IC, extra_state);
Handle<Code> code =
compiler.CompileKeyedStoreMonomorphicHandler(receiver_map, store_mode);
return code;
}
+
+static void FillCache(Isolate* isolate, Handle<Code> code) {
+ Handle<UnseededNumberDictionary> dictionary = UnseededNumberDictionary::Set(
+ isolate->factory()->non_monomorphic_cache(), code->flags(), code);
+ isolate->heap()->SetRootNonMonomorphicCache(*dictionary);
+}
+
+
+Handle<Code> PropertyICCompiler::ComputeStore(Isolate* isolate,
+ InlineCacheState ic_state,
+ ExtraICState extra_state) {
+ DCHECK_EQ(MEGAMORPHIC, ic_state);
+ Code::Flags flags = Code::ComputeFlags(Code::STORE_IC, ic_state, extra_state);
+ Handle<UnseededNumberDictionary> cache =
+ isolate->factory()->non_monomorphic_cache();
+ int entry = cache->FindEntry(isolate, flags);
+ if (entry != -1) return Handle<Code>(Code::cast(cache->ValueAt(entry)));
+
+ PropertyICCompiler compiler(isolate, Code::STORE_IC);
+ Handle<Code> code = compiler.CompileStoreMegamorphic(flags);
+
+ FillCache(isolate, code);
+ return code;
+}
+
+
void PropertyICCompiler::ComputeKeyedStorePolymorphicHandlers(
MapHandleList* receiver_maps, MapHandleList* transitioned_maps,
- CodeHandleList* handlers, KeyedAccessStoreMode store_mode) {
+ CodeHandleList* handlers, KeyedAccessStoreMode store_mode,
+ LanguageMode language_mode) {
Isolate* isolate = receiver_maps->at(0)->GetIsolate();
DCHECK(store_mode == STANDARD_STORE ||
store_mode == STORE_AND_GROW_NO_TRANSITION ||
store_mode == STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS ||
store_mode == STORE_NO_TRANSITION_HANDLE_COW);
- PropertyICCompiler compiler(isolate);
+ ExtraICState extra_state =
+ KeyedStoreIC::ComputeExtraICState(language_mode, store_mode);
+ PropertyICCompiler compiler(isolate, Code::KEYED_STORE_IC, extra_state);
compiler.CompileKeyedStorePolymorphicHandlers(
receiver_maps, transitioned_maps, handlers, store_mode);
+}
+
+
+Handle<Code> PropertyICCompiler::CompileStoreMegamorphic(Code::Flags flags) {
+ StoreIC::GenerateMegamorphic(masm());
+ Handle<Code> code = GetCodeWithFlags(flags, "CompileStoreMegamorphic");
+ PROFILE(isolate(), CodeCreateEvent(Logger::STORE_MEGAMORPHIC_TAG,
+ AbstractCode::cast(*code), 0));
+ return code;
+}
+
+Handle<Code> PropertyICCompiler::GetCode(Code::Kind kind, Handle<Name> name,
+ InlineCacheState state) {
+ Code::Flags flags =
+ Code::ComputeFlags(kind, state, extra_ic_state_, cache_holder());
+ Handle<Code> code = GetCodeWithFlags(flags, name);
+ PROFILE(isolate(),
+ CodeCreateEvent(log_kind(code), AbstractCode::cast(*code), *name));
+#ifdef DEBUG
+ code->VerifyEmbeddedObjects();
+#endif
+ return code;
}
« no previous file with comments | « src/ic/ic-compiler.h ('k') | src/snapshot/code-serializer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698