| Index: runtime/vm/flow_graph.cc
|
| diff --git a/runtime/vm/flow_graph.cc b/runtime/vm/flow_graph.cc
|
| index 92c75ac3f2f97f5e7a6754d2b35dc5ee02d4fb3d..8a3a69155d0fb6b5ac6c536198d5b206f2ff4d95 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();
|
|
|