| Index: runtime/vm/flow_graph_inliner.cc
|
| ===================================================================
|
| --- runtime/vm/flow_graph_inliner.cc (revision 25661)
|
| +++ runtime/vm/flow_graph_inliner.cc (working copy)
|
| @@ -681,6 +681,13 @@
|
| new LoadFieldInstr(new Value(closure),
|
| Closure::context_offset(),
|
| Type::ZoneHandle());
|
| + AllocateObjectInstr* alloc =
|
| + closure_call->ArgumentAt(0)->AsAllocateObject();
|
| + if ((alloc != NULL) && !alloc->closure_function().IsNull()) {
|
| + ASSERT(!alloc->context_field().IsNull());
|
| + context->set_field(&alloc->context_field());
|
| + }
|
| +
|
| context->set_ssa_temp_index(caller_graph()->alloc_ssa_temp_index());
|
| context->InsertAfter(callee_entry);
|
| StoreContextInstr* set_context =
|
| @@ -803,9 +810,19 @@
|
| ClosureCallInstr* call = calls[i];
|
| // Find the closure of the callee.
|
| ASSERT(call->ArgumentCount() > 0);
|
| - const CreateClosureInstr* closure =
|
| + Function& target = Function::ZoneHandle();
|
| + CreateClosureInstr* closure =
|
| call->ArgumentAt(0)->AsCreateClosure();
|
| - if (closure == NULL) {
|
| + if (closure != NULL) {
|
| + target ^= closure->function().raw();
|
| + }
|
| + AllocateObjectInstr* alloc =
|
| + call->ArgumentAt(0)->AsAllocateObject();
|
| + if ((alloc != NULL) && !alloc->closure_function().IsNull()) {
|
| + target ^= alloc->closure_function().raw();
|
| + ASSERT(target.signature_class() == alloc->cls().raw());
|
| + }
|
| + if (target.IsNull()) {
|
| TRACE_INLINING(OS::Print(" Bailout: non-closure operator\n"));
|
| continue;
|
| }
|
| @@ -814,7 +831,7 @@
|
| arguments.Add(call->PushArgumentAt(i)->value());
|
| }
|
| InlinedCallData call_data(call, &arguments);
|
| - if (TryInlining(closure->function(),
|
| + if (TryInlining(target,
|
| call->argument_names(),
|
| &call_data)) {
|
| InlineCall(&call_data);
|
| @@ -1180,6 +1197,10 @@
|
| callee_entry->AsGraphEntry()->normal_entry();
|
| cursor->LinkTo(target->next());
|
| target->ReplaceAsPredecessorWith(current_block);
|
| +
|
| + // Unuse the graph entry. It is not in the graph anymore.
|
| + callee_entry->UnuseAllInputs();
|
| +
|
| // All blocks that were dominated by the normal entry are now
|
| // dominated by the current block.
|
| for (intptr_t j = 0;
|
| @@ -1230,6 +1251,10 @@
|
| if (callee_entry->IsGraphEntry()) {
|
| // Unshared.
|
| true_target = callee_entry->AsGraphEntry()->normal_entry();
|
| +
|
| + // Unuse the graph entry. It is not in the graph anymore.
|
| + callee_entry->UnuseAllInputs();
|
| +
|
| } else if (callee_entry->IsTargetEntry()) {
|
| // Shared inlined body and this is the first entry. We have already
|
| // constructed a join and this target jumps to it.
|
|
|