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

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

Issue 11953076: Move code around in preparation for better inlining. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 } 429 }
430 430
431 // Load IC data for the callee. 431 // Load IC data for the callee.
432 if (function.HasCode()) { 432 if (function.HasCode()) {
433 const Code& unoptimized_code = 433 const Code& unoptimized_code =
434 Code::Handle(function.unoptimized_code()); 434 Code::Handle(function.unoptimized_code());
435 isolate->set_ic_data_array(unoptimized_code.ExtractTypeFeedbackArray()); 435 isolate->set_ic_data_array(unoptimized_code.ExtractTypeFeedbackArray());
436 } 436 }
437 437
438 // Build the callee graph. 438 // Build the callee graph.
439 ValueInliningContext* inlining_context = new ValueInliningContext(); 439 InliningContext* inlining_context = InliningContext::Create(call);
440 FlowGraphBuilder builder(*parsed_function, inlining_context); 440 FlowGraphBuilder builder(*parsed_function, inlining_context);
441 builder.SetInitialBlockId(caller_graph_->max_block_id()); 441 builder.SetInitialBlockId(caller_graph_->max_block_id());
442 FlowGraph* callee_graph; 442 FlowGraph* callee_graph;
443 { 443 {
444 TimerScope timer(FLAG_compiler_stats, 444 TimerScope timer(FLAG_compiler_stats,
445 &CompilerStats::graphinliner_build_timer, 445 &CompilerStats::graphinliner_build_timer,
446 isolate); 446 isolate);
447 callee_graph = builder.BuildGraph(); 447 callee_graph = builder.BuildGraph();
448 } 448 }
449 449
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 if (inlining_depth_ < FLAG_inlining_depth_threshold) { 552 if (inlining_depth_ < FLAG_inlining_depth_threshold) {
553 collected_call_sites_->FindCallSites(callee_graph); 553 collected_call_sites_->FindCallSites(callee_graph);
554 } 554 }
555 555
556 { 556 {
557 TimerScope timer(FLAG_compiler_stats, 557 TimerScope timer(FLAG_compiler_stats,
558 &CompilerStats::graphinliner_subst_timer, 558 &CompilerStats::graphinliner_subst_timer,
559 isolate); 559 isolate);
560 560
561 // Plug result in the caller graph. 561 // Plug result in the caller graph.
562 caller_graph_->InlineCall(call, callee_graph, inlining_context); 562 inlining_context->ReplaceCall(caller_graph_, call, callee_graph);
563 563
564 // Remove push arguments of the call. 564 // Remove push arguments of the call.
565 for (intptr_t i = 0; i < call->ArgumentCount(); ++i) { 565 for (intptr_t i = 0; i < call->ArgumentCount(); ++i) {
566 PushArgumentInstr* push = call->ArgumentAt(i); 566 PushArgumentInstr* push = call->ArgumentAt(i);
567 push->ReplaceUsesWith(push->value()->definition()); 567 push->ReplaceUsesWith(push->value()->definition());
568 push->RemoveFromGraph(); 568 push->RemoveFromGraph();
569 } 569 }
570 570
571 // Replace each stub with the actual argument or the caller's constant. 571 // Replace each stub with the actual argument or the caller's constant.
572 // Nulls denote optional parameters for which no actual was given. 572 // Nulls denote optional parameters for which no actual was given.
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
868 OS::Print("After Inlining of %s\n", flow_graph_-> 868 OS::Print("After Inlining of %s\n", flow_graph_->
869 parsed_function().function().ToFullyQualifiedCString()); 869 parsed_function().function().ToFullyQualifiedCString());
870 FlowGraphPrinter printer(*flow_graph_); 870 FlowGraphPrinter printer(*flow_graph_);
871 printer.PrintBlocks(); 871 printer.PrintBlocks();
872 } 872 }
873 } 873 }
874 } 874 }
875 } 875 }
876 876
877 } // namespace dart 877 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698