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

Unified Diff: runtime/vm/intermediate_language.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/intermediate_language.cc
diff --git a/runtime/vm/intermediate_language.cc b/runtime/vm/intermediate_language.cc
index 9ca50407861f25d80bfa09e82cf196ef1b1d42c6..a48dcf517a179ea9b9046b830c0b22d570106e13 100644
--- a/runtime/vm/intermediate_language.cc
+++ b/runtime/vm/intermediate_language.cc
@@ -3192,6 +3192,29 @@ RawType* PolymorphicInstanceCallInstr::ComputeRuntimeType(
}
+Definition* InstanceCallInstr::Canonicalize(FlowGraph* flow_graph) {
+ const intptr_t receiver_cid = PushArgumentAt(0)->value()->Type()->ToCid();
+
+ if (!HasICData()) return this;
+
+ const ICData& new_ic_data =
+ FlowGraphCompiler::TrySpecializeICData(*ic_data(), receiver_cid);
+ if (new_ic_data.raw() == ic_data()->raw()) {
+ // No specialization.
+ return this;
+ }
+
+ const bool with_checks = false;
+ const bool complete = false;
+ PolymorphicInstanceCallInstr* specialized = new PolymorphicInstanceCallInstr(
+ this, new_ic_data, with_checks, complete);
+
Vyacheslav Egorov (Google) 2017/02/23 15:32:38 Remove empty line before and after InsertBefore.
+ flow_graph->InsertBefore(this, specialized, env(), FlowGraph::kValue);
+
+ return specialized;
+}
+
+
Definition* PolymorphicInstanceCallInstr::Canonicalize(FlowGraph* flow_graph) {
if (!HasSingleRecognizedTarget() || with_checks()) {
return this;

Powered by Google App Engine
This is Rietveld 408576698