| 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();
|
|
|