| Index: runtime/vm/flow_graph_inliner.cc
|
| diff --git a/runtime/vm/flow_graph_inliner.cc b/runtime/vm/flow_graph_inliner.cc
|
| index d10079c1181b372ce12cd410b3e377188c85e069..03bad1d9d0f440423b15881d7f5b375e40d79a6d 100644
|
| --- a/runtime/vm/flow_graph_inliner.cc
|
| +++ b/runtime/vm/flow_graph_inliner.cc
|
| @@ -269,7 +269,13 @@ class CallSiteInliner : public ValueObject {
|
| if (setjmp(*jump.Set()) == 0) {
|
| // Parse the callee function.
|
| bool in_cache;
|
| - ParsedFunction* parsed_function = ParseFunction(function, &in_cache);
|
| + ParsedFunction* parsed_function;
|
| + {
|
| + TimerScope timer(FLAG_compiler_stats,
|
| + &CompilerStats::graphinliner_parse_timer,
|
| + isolate);
|
| + parsed_function = ParseFunction(function, &in_cache);
|
| + }
|
|
|
| // Load IC data for the callee.
|
| if (function.HasCode()) {
|
| @@ -281,8 +287,13 @@ class CallSiteInliner : public ValueObject {
|
| // Build the callee graph.
|
| FlowGraphBuilder builder(*parsed_function);
|
| builder.SetInitialBlockId(caller_graph_->max_block_id());
|
| - FlowGraph* callee_graph =
|
| - builder.BuildGraph(FlowGraphBuilder::kValueContext);
|
| + FlowGraph* callee_graph;
|
| + {
|
| + TimerScope timer(FLAG_compiler_stats,
|
| + &CompilerStats::graphinliner_build_timer,
|
| + isolate);
|
| + callee_graph = builder.BuildGraph(FlowGraphBuilder::kValueContext);
|
| + }
|
|
|
| // Abort if the callee graph contains control flow.
|
| if (!FLAG_inline_control_flow &&
|
| @@ -294,14 +305,24 @@ class CallSiteInliner : public ValueObject {
|
| return false;
|
| }
|
|
|
| - // Compute SSA on the callee graph, catching bailouts.
|
| - callee_graph->ComputeSSA(next_ssa_temp_index_);
|
| - callee_graph->ComputeUseLists();
|
| + {
|
| + TimerScope timer(FLAG_compiler_stats,
|
| + &CompilerStats::graphinliner_ssa_timer,
|
| + isolate);
|
| + // Compute SSA on the callee graph, catching bailouts.
|
| + callee_graph->ComputeSSA(next_ssa_temp_index_);
|
| + callee_graph->ComputeUseLists();
|
| + }
|
|
|
| - // TODO(zerny): Do more optimization passes on the callee graph.
|
| - FlowGraphOptimizer optimizer(callee_graph);
|
| - optimizer.ApplyICData();
|
| - callee_graph->ComputeUseLists();
|
| + {
|
| + TimerScope timer(FLAG_compiler_stats,
|
| + &CompilerStats::graphinliner_opt_timer,
|
| + isolate);
|
| + // TODO(zerny): Do more optimization passes on the callee graph.
|
| + FlowGraphOptimizer optimizer(callee_graph);
|
| + optimizer.ApplyICData();
|
| + callee_graph->ComputeUseLists();
|
| + }
|
|
|
| if (FLAG_trace_inlining && FLAG_print_flow_graph) {
|
| OS::Print("Callee graph for inlining %s\n",
|
| @@ -327,32 +348,38 @@ class CallSiteInliner : public ValueObject {
|
| collected_call_sites_->FindCallSites(callee_graph);
|
| }
|
|
|
| - // Plug result in the caller graph.
|
| - caller_graph_->InlineCall(call, callee_graph);
|
| - next_ssa_temp_index_ = caller_graph_->max_virtual_register_number();
|
| + {
|
| + TimerScope timer(FLAG_compiler_stats,
|
| + &CompilerStats::graphinliner_subst_timer,
|
| + isolate);
|
|
|
| - // Remove push arguments of the call.
|
| - for (intptr_t i = 0; i < call->ArgumentCount(); ++i) {
|
| - PushArgumentInstr* push = call->ArgumentAt(i);
|
| - push->ReplaceUsesWith(push->value()->definition());
|
| - push->RemoveFromGraph();
|
| - }
|
| + // Plug result in the caller graph.
|
| + caller_graph_->InlineCall(call, callee_graph);
|
| + next_ssa_temp_index_ = caller_graph_->max_virtual_register_number();
|
|
|
| - // Replace formal parameters with actuals.
|
| - intptr_t arg_index = 0;
|
| - GrowableArray<Definition*>* defns =
|
| - callee_graph->graph_entry()->initial_definitions();
|
| - for (intptr_t i = 0; i < defns->length(); ++i) {
|
| - ParameterInstr* param = (*defns)[i]->AsParameter();
|
| - if (param != NULL) {
|
| - param->ReplaceUsesWith((*arguments)[arg_index++]->definition());
|
| + // Remove push arguments of the call.
|
| + for (intptr_t i = 0; i < call->ArgumentCount(); ++i) {
|
| + PushArgumentInstr* push = call->ArgumentAt(i);
|
| + push->ReplaceUsesWith(push->value()->definition());
|
| + push->RemoveFromGraph();
|
| }
|
| - }
|
| - ASSERT(arg_index == arguments->length());
|
|
|
| - // Replace callee's null constant with caller's null constant.
|
| - callee_graph->graph_entry()->constant_null()->ReplaceUsesWith(
|
| - caller_graph_->graph_entry()->constant_null());
|
| + // Replace formal parameters with actuals.
|
| + intptr_t arg_index = 0;
|
| + GrowableArray<Definition*>* defns =
|
| + callee_graph->graph_entry()->initial_definitions();
|
| + for (intptr_t i = 0; i < defns->length(); ++i) {
|
| + ParameterInstr* param = (*defns)[i]->AsParameter();
|
| + if (param != NULL) {
|
| + param->ReplaceUsesWith((*arguments)[arg_index++]->definition());
|
| + }
|
| + }
|
| + ASSERT(arg_index == arguments->length());
|
| +
|
| + // Replace callee's null constant with caller's null constant.
|
| + callee_graph->graph_entry()->constant_null()->ReplaceUsesWith(
|
| + caller_graph_->graph_entry()->constant_null());
|
| + }
|
|
|
| TRACE_INLINING(OS::Print(" Success\n"));
|
|
|
|
|