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

Unified Diff: runtime/vm/flow_graph.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.cc
diff --git a/runtime/vm/flow_graph.cc b/runtime/vm/flow_graph.cc
index 16ed1ebacf2ba492cc0366c771511fe4e3790cf0..3e52e904f29c0aca28c337e755d057550e64201f 100644
--- a/runtime/vm/flow_graph.cc
+++ b/runtime/vm/flow_graph.cc
@@ -83,11 +83,15 @@ void FlowGraph::ReplaceCurrentInstruction(ForwardInstructionIterator* iterator,
}
}
if (current->ArgumentCount() != 0) {
- // This is a call instruction. Must remove original push arguments.
+ // Replacing a call instruction with something else. Must remove
+ // superfluous push arguments.
for (intptr_t i = 0; i < current->ArgumentCount(); ++i) {
PushArgumentInstr* push = current->PushArgumentAt(i);
- push->ReplaceUsesWith(push->value()->definition());
- push->RemoveFromGraph();
+ if (replacement == NULL || i >= replacement->ArgumentCount() ||
+ replacement->PushArgumentAt(i) != push) {
+ push->ReplaceUsesWith(push->value()->definition());
+ push->RemoveFromGraph();
+ }
}
}
iterator->RemoveCurrentFromGraph();

Powered by Google App Engine
This is Rietveld 408576698