| Index: runtime/vm/flow_graph.cc
|
| diff --git a/runtime/vm/flow_graph.cc b/runtime/vm/flow_graph.cc
|
| index 71c6c31ad2f070f2584d6c781551e7281c022cbb..bbc2bee5b4a438970577eb86d9438e3bf07aa8e7 100644
|
| --- a/runtime/vm/flow_graph.cc
|
| +++ b/runtime/vm/flow_graph.cc
|
| @@ -753,13 +753,13 @@ static void Link(Instruction* prev, Instruction* next) {
|
|
|
| // Inline a flow graph at a call site.
|
| //
|
| -// Assumes the callee graph was computed with BuildGraphForInlining and
|
| -// transformed to SSA with ComputeSSAForInlining, and that the use lists have
|
| -// been correctly computed.
|
| +// Assumes the callee graph was computed by BuildGraph with an inlining context
|
| +// and transformed to SSA with ComputeSSA with a correct virtual register
|
| +// number, and that the use lists have been correctly computed.
|
| //
|
| // After inlining the caller graph will correctly have adjusted the pre/post
|
| // orders, the dominator tree and the use lists.
|
| -void FlowGraph::InlineCall(StaticCallInstr* call, FlowGraph* callee_graph) {
|
| +void FlowGraph::InlineCall(Definition* call, FlowGraph* callee_graph) {
|
| ASSERT(callee_graph->exits() != NULL);
|
| ASSERT(callee_graph->graph_entry()->SuccessorCount() == 1);
|
| ASSERT(callee_graph->max_virtual_register_number() >
|
| @@ -771,11 +771,16 @@ void FlowGraph::InlineCall(StaticCallInstr* call, FlowGraph* callee_graph) {
|
| // Adjust the SSA temp index by the callee graph's index.
|
| current_ssa_temp_index_ = callee_graph->max_virtual_register_number();
|
|
|
| + BlockEntryInstr* caller_entry = GetBlockEntry(call);
|
| TargetEntryInstr* callee_entry = callee_graph->graph_entry()->normal_entry();
|
| ZoneGrowableArray<ReturnInstr*>* callee_exits = callee_graph->exits();
|
|
|
| // 1. Insert the callee graph into the caller graph.
|
| - if (callee_exits->length() == 1) {
|
| + if (callee_exits->length() == 0) {
|
| + // If no normal exits exist, inline and truncate the block after inlining.
|
| + Link(call->previous(), callee_entry->next());
|
| + caller_entry->set_last_instruction(callee_entry->last_instruction());
|
| + } else if (callee_exits->length() == 1) {
|
| ReturnInstr* exit = (*callee_exits)[0];
|
| // TODO(zerny): Support one exit graph containing control flow.
|
| ASSERT(callee_entry == GetBlockEntry(exit));
|
| @@ -790,13 +795,6 @@ void FlowGraph::InlineCall(StaticCallInstr* call, FlowGraph* callee_graph) {
|
|
|
| // TODO(zerny): Adjust pre/post orders.
|
| // TODO(zerny): Update dominator tree.
|
| -
|
| - // Remove original arguments to the call.
|
| - for (intptr_t i = 0; i < call->ArgumentCount(); ++i) {
|
| - PushArgumentInstr* push = call->ArgumentAt(i);
|
| - push->ReplaceUsesWith(push->value()->definition());
|
| - push->RemoveFromGraph();
|
| - }
|
| }
|
|
|
|
|
|
|