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

Unified Diff: runtime/vm/flow_graph.cc

Issue 2716593002: Propagate this-specialization to regular (megamorphic) calls (Closed)
Patch Set: 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.cc
diff --git a/runtime/vm/flow_graph.cc b/runtime/vm/flow_graph.cc
index 16ed1ebacf2ba492cc0366c771511fe4e3790cf0..642ec9be5d2cd31c8679abc9264b218a82c2bdbb 100644
--- a/runtime/vm/flow_graph.cc
+++ b/runtime/vm/flow_graph.cc
@@ -1996,11 +1996,17 @@ bool FlowGraph::Canonicalize() {
Instruction* replacement = current->Canonicalize(this);
if (replacement != current) {
- // For non-definitions Canonicalize should return either NULL or
- // this.
- ASSERT((replacement == NULL) || current->IsDefinition());
- ReplaceCurrentInstruction(&it, current, replacement);
changed = true;
+
+ if (current->IsInstanceCall()) {
+ current->AsDefinition()->ReplaceWith(replacement->AsDefinition(),
+ &it);
+ } else {
+ // For non-definitions Canonicalize should return either NULL or
+ // this.
+ ASSERT((replacement == NULL) || current->IsDefinition());
+ ReplaceCurrentInstruction(&it, current, replacement);
+ }
}
}
}

Powered by Google App Engine
This is Rietveld 408576698