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

Unified Diff: runtime/vm/flow_graph_compiler.cc

Issue 2716593002: Propagate this-specialization to regular (megamorphic) calls (Closed)
Patch Set: Cleanups Created 3 years, 10 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
Index: runtime/vm/flow_graph_compiler.cc
diff --git a/runtime/vm/flow_graph_compiler.cc b/runtime/vm/flow_graph_compiler.cc
index 4388c181ef6a3b4685589d49f81fcbeda3aa81ff..0ffb77153807951d171d517a2e679a35f234324b 100644
--- a/runtime/vm/flow_graph_compiler.cc
+++ b/runtime/vm/flow_graph_compiler.cc
@@ -1749,6 +1749,35 @@ void FlowGraphCompiler::EndCodeSourceRange(TokenPosition token_pos) {
}
+const ICData& FlowGraphCompiler::TrySpecializeICData(const ICData& ic_data,
Vyacheslav Egorov (Google) 2017/02/23 15:32:37 If we are placing this function on the FlowGraphCo
+ intptr_t cid) {
+ Zone* zone = Thread::Current()->zone();
+ if (ic_data.NumArgsTested() != 1) return ic_data;
+
+ if ((ic_data.NumberOfUsedChecks() == 1) && ic_data.HasReceiverClassId(cid)) {
+ return ic_data; // Nothing to do
+ }
+
+ intptr_t count = 1;
+ const Function& function =
+ Function::Handle(zone, ic_data.GetTargetForReceiverClassId(cid, &count));
+ // TODO(fschneider): Try looking up the function on the class if it is
+ // not found in the ICData.
+ if (!function.IsNull()) {
+ const ICData& new_ic_data = ICData::ZoneHandle(
+ zone, ICData::New(Function::Handle(zone, ic_data.Owner()),
+ String::Handle(zone, ic_data.target_name()),
+ Object::empty_array(), // Dummy argument descriptor.
+ ic_data.deopt_id(), ic_data.NumArgsTested(), false));
+ new_ic_data.SetDeoptReasons(ic_data.DeoptReasons());
+ new_ic_data.AddReceiverCheck(cid, function, count);
+ return new_ic_data;
+ }
+
+ return ic_data;
+}
+
+
#if !defined(TARGET_ARCH_DBC)
// DBC emits calls very differently from other architectures due to its
// interpreted nature.

Powered by Google App Engine
This is Rietveld 408576698