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

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

Issue 222553002: Add flag --inlining-callee-size-threshold (80), that prevents inlining too large functions. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/block_scheduler.h" 7 #include "vm/block_scheduler.h"
8 #include "vm/compiler.h" 8 #include "vm/compiler.h"
9 #include "vm/flags.h" 9 #include "vm/flags.h"
10 #include "vm/flow_graph.h" 10 #include "vm/flow_graph.h"
(...skipping 16 matching lines...) Expand all
27 27
28 // Flags for inlining heuristics. 28 // Flags for inlining heuristics.
29 DEFINE_FLAG(int, inline_getters_setters_smaller_than, 10, 29 DEFINE_FLAG(int, inline_getters_setters_smaller_than, 10,
30 "Always inline getters and setters that have fewer instructions"); 30 "Always inline getters and setters that have fewer instructions");
31 DEFINE_FLAG(int, inlining_depth_threshold, 3, 31 DEFINE_FLAG(int, inlining_depth_threshold, 3,
32 "Inline function calls up to threshold nesting depth"); 32 "Inline function calls up to threshold nesting depth");
33 DEFINE_FLAG(int, inlining_size_threshold, 25, 33 DEFINE_FLAG(int, inlining_size_threshold, 25,
34 "Always inline functions that have threshold or fewer instructions"); 34 "Always inline functions that have threshold or fewer instructions");
35 DEFINE_FLAG(int, inlining_callee_call_sites_threshold, 1, 35 DEFINE_FLAG(int, inlining_callee_call_sites_threshold, 1,
36 "Always inline functions containing threshold or fewer calls."); 36 "Always inline functions containing threshold or fewer calls.");
37 DEFINE_FLAG(int, inlining_callee_size_threshold, 80,
38 "Do not inline callees larger than threshold");
37 DEFINE_FLAG(int, inlining_caller_size_threshold, 50000, 39 DEFINE_FLAG(int, inlining_caller_size_threshold, 50000,
38 "Stop inlining once caller reaches the threshold."); 40 "Stop inlining once caller reaches the threshold.");
39 DEFINE_FLAG(int, inlining_constant_arguments_count, 1, 41 DEFINE_FLAG(int, inlining_constant_arguments_count, 1,
40 "Inline function calls with sufficient constant arguments " 42 "Inline function calls with sufficient constant arguments "
41 "and up to the increased threshold on instructions"); 43 "and up to the increased threshold on instructions");
42 DEFINE_FLAG(int, inlining_constant_arguments_size_threshold, 60, 44 DEFINE_FLAG(int, inlining_constant_arguments_size_threshold, 60,
43 "Inline function calls with sufficient constant arguments " 45 "Inline function calls with sufficient constant arguments "
44 "and up to the increased threshold on instructions"); 46 "and up to the increased threshold on instructions");
45 DEFINE_FLAG(int, inlining_hotness, 10, 47 DEFINE_FLAG(int, inlining_hotness, 10,
46 "Inline only hotter calls, in percents (0 .. 100); " 48 "Inline only hotter calls, in percents (0 .. 100); "
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 420
419 // Inlining heuristics based on Cooper et al. 2008. 421 // Inlining heuristics based on Cooper et al. 2008.
420 bool ShouldWeInline(const Function& callee, 422 bool ShouldWeInline(const Function& callee,
421 intptr_t instr_count, 423 intptr_t instr_count,
422 intptr_t call_site_count, 424 intptr_t call_site_count,
423 intptr_t const_arg_count) { 425 intptr_t const_arg_count) {
424 if (inlined_size_ > FLAG_inlining_caller_size_threshold) { 426 if (inlined_size_ > FLAG_inlining_caller_size_threshold) {
425 // Prevent methods becoming humongous and thus slow to compile. 427 // Prevent methods becoming humongous and thus slow to compile.
426 return false; 428 return false;
427 } 429 }
430 if (instr_count > FLAG_inlining_callee_size_threshold) {
431 return false;
432 }
428 // 'instr_count' can be 0 if it was not computed yet. 433 // 'instr_count' can be 0 if it was not computed yet.
429 if ((instr_count != 0) && (instr_count <= FLAG_inlining_size_threshold)) { 434 if ((instr_count != 0) && (instr_count <= FLAG_inlining_size_threshold)) {
430 return true; 435 return true;
431 } 436 }
432 if (call_site_count <= FLAG_inlining_callee_call_sites_threshold) { 437 if (call_site_count <= FLAG_inlining_callee_call_sites_threshold) {
433 return true; 438 return true;
434 } 439 }
435 if ((const_arg_count >= FLAG_inlining_constant_arguments_count) && 440 if ((const_arg_count >= FLAG_inlining_constant_arguments_count) &&
436 (instr_count <= FLAG_inlining_constant_arguments_size_threshold)) { 441 (instr_count <= FLAG_inlining_constant_arguments_size_threshold)) {
437 return true; 442 return true;
(...skipping 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after
1643 OS::Print("After Inlining of %s\n", flow_graph_-> 1648 OS::Print("After Inlining of %s\n", flow_graph_->
1644 parsed_function().function().ToFullyQualifiedCString()); 1649 parsed_function().function().ToFullyQualifiedCString());
1645 FlowGraphPrinter printer(*flow_graph_); 1650 FlowGraphPrinter printer(*flow_graph_);
1646 printer.PrintBlocks(); 1651 printer.PrintBlocks();
1647 } 1652 }
1648 } 1653 }
1649 } 1654 }
1650 } 1655 }
1651 1656
1652 } // namespace dart 1657 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698