Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(312)

Side by Side Diff: runtime/vm/flow_graph_inliner.cc

Issue 14067002: Incrementally recompute dominators when inlining. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/flow_graph_inliner.h" 5 #include "vm/flow_graph_inliner.h"
6 6
7 #include "vm/compiler.h" 7 #include "vm/compiler.h"
8 #include "vm/flags.h" 8 #include "vm/flags.h"
9 #include "vm/flow_graph.h" 9 #include "vm/flow_graph.h"
10 #include "vm/flow_graph_builder.h" 10 #include "vm/flow_graph_builder.h"
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 } 432 }
433 433
434 // Load IC data for the callee. 434 // Load IC data for the callee.
435 if (function.HasCode()) { 435 if (function.HasCode()) {
436 const Code& unoptimized_code = 436 const Code& unoptimized_code =
437 Code::Handle(function.unoptimized_code()); 437 Code::Handle(function.unoptimized_code());
438 isolate->set_ic_data_array(unoptimized_code.ExtractTypeFeedbackArray()); 438 isolate->set_ic_data_array(unoptimized_code.ExtractTypeFeedbackArray());
439 } 439 }
440 440
441 // Build the callee graph. 441 // Build the callee graph.
442 InliningContext inlining_context; 442 InliningContext inlining_context(caller_graph_, call);
443 FlowGraphBuilder builder(*parsed_function, &inlining_context); 443 FlowGraphBuilder builder(*parsed_function, &inlining_context);
444 builder.SetInitialBlockId(caller_graph_->max_block_id()); 444 builder.SetInitialBlockId(caller_graph_->max_block_id());
445 FlowGraph* callee_graph; 445 FlowGraph* callee_graph;
446 { 446 {
447 TimerScope timer(FLAG_compiler_stats, 447 TimerScope timer(FLAG_compiler_stats,
448 &CompilerStats::graphinliner_build_timer, 448 &CompilerStats::graphinliner_build_timer,
449 isolate); 449 isolate);
450 callee_graph = builder.BuildGraph(); 450 callee_graph = builder.BuildGraph();
451 } 451 }
452 452
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 if (inlining_depth_ < FLAG_inlining_depth_threshold) { 555 if (inlining_depth_ < FLAG_inlining_depth_threshold) {
556 collected_call_sites_->FindCallSites(callee_graph); 556 collected_call_sites_->FindCallSites(callee_graph);
557 } 557 }
558 558
559 { 559 {
560 TimerScope timer(FLAG_compiler_stats, 560 TimerScope timer(FLAG_compiler_stats,
561 &CompilerStats::graphinliner_subst_timer, 561 &CompilerStats::graphinliner_subst_timer,
562 isolate); 562 isolate);
563 563
564 // Plug result in the caller graph. 564 // Plug result in the caller graph.
565 inlining_context.ReplaceCall(caller_graph_, call, callee_graph); 565 inlining_context.ReplaceCall(callee_graph);
566 566
567 // Replace each stub with the actual argument or the caller's constant. 567 // Replace each stub with the actual argument or the caller's constant.
568 // Nulls denote optional parameters for which no actual was given. 568 // Nulls denote optional parameters for which no actual was given.
569 for (intptr_t i = 0; i < arguments->length(); ++i) { 569 for (intptr_t i = 0; i < arguments->length(); ++i) {
570 Definition* stub = param_stubs[i]; 570 Definition* stub = param_stubs[i];
571 Value* actual = (*arguments)[i]; 571 Value* actual = (*arguments)[i];
572 if (actual != NULL) stub->ReplaceUsesWith(actual->definition()); 572 if (actual != NULL) stub->ReplaceUsesWith(actual->definition());
573 } 573 }
574 574
575 // Remove push arguments of the call. 575 // Remove push arguments of the call.
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
873 OS::Print("Before Inlining of %s\n", flow_graph_-> 873 OS::Print("Before Inlining of %s\n", flow_graph_->
874 parsed_function().function().ToFullyQualifiedCString()); 874 parsed_function().function().ToFullyQualifiedCString());
875 FlowGraphPrinter printer(*flow_graph_); 875 FlowGraphPrinter printer(*flow_graph_);
876 printer.PrintBlocks(); 876 printer.PrintBlocks();
877 } 877 }
878 878
879 CallSiteInliner inliner(flow_graph_, guarded_fields_); 879 CallSiteInliner inliner(flow_graph_, guarded_fields_);
880 inliner.InlineCalls(); 880 inliner.InlineCalls();
881 881
882 if (inliner.inlined()) { 882 if (inliner.inlined()) {
883 flow_graph_->RepairGraphAfterInlining(); 883 flow_graph_->DiscoverBlocks();
884 if (FLAG_trace_inlining) { 884 if (FLAG_trace_inlining) {
885 OS::Print("Inlining growth factor: %f\n", inliner.GrowthFactor()); 885 OS::Print("Inlining growth factor: %f\n", inliner.GrowthFactor());
886 if (FLAG_print_flow_graph || FLAG_print_flow_graph_optimized) { 886 if (FLAG_print_flow_graph || FLAG_print_flow_graph_optimized) {
887 OS::Print("After Inlining of %s\n", flow_graph_-> 887 OS::Print("After Inlining of %s\n", flow_graph_->
888 parsed_function().function().ToFullyQualifiedCString()); 888 parsed_function().function().ToFullyQualifiedCString());
889 FlowGraphPrinter printer(*flow_graph_); 889 FlowGraphPrinter printer(*flow_graph_);
890 printer.PrintBlocks(); 890 printer.PrintBlocks();
891 } 891 }
892 } 892 }
893 } 893 }
894 } 894 }
895 895
896 } // namespace dart 896 } // namespace dart
OLDNEW
« runtime/vm/flow_graph_builder.cc ('K') | « runtime/vm/flow_graph_builder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698