@@ -54,7 +54,7 @@ DEFINE_FLAG(int,
5454 " Always inline functions containing threshold or fewer calls." );
5555DEFINE_FLAG (int ,
5656 inlining_callee_size_threshold,
57- 80 ,
57+ 160 ,
5858 " Do not inline callees larger than threshold" );
5959DEFINE_FLAG (int ,
6060 inlining_small_leaf_size_threshold,
@@ -64,21 +64,6 @@ DEFINE_FLAG(int,
6464 inlining_caller_size_threshold,
6565 50000 ,
6666 " Stop inlining once caller reaches the threshold." );
67- DEFINE_FLAG (int ,
68- inlining_constant_arguments_count,
69- 1 ,
70- " Inline function calls with sufficient constant arguments "
71- " and up to the increased threshold on instructions" );
72- DEFINE_FLAG (
73- int ,
74- inlining_constant_arguments_max_size_threshold,
75- 200 ,
76- " Do not inline callees larger than threshold if constant arguments" );
77- DEFINE_FLAG (int ,
78- inlining_constant_arguments_min_size_threshold,
79- 60 ,
80- " Inline function calls with sufficient constant arguments "
81- " and up to the increased threshold on instructions" );
8267DEFINE_FLAG (int ,
8368 inlining_hotness,
8469 10 ,
@@ -779,45 +764,36 @@ class CallSiteInliner : public ValueObject {
779764 };
780765
781766 // Inlining heuristics based on Cooper et al. 2008.
782- // TODO(ajcbik): with the better specialized computation of counts,
783- // do we still want to special-case const_arg_count here?
784767 InliningDecision ShouldWeInline (const Function& callee,
785768 intptr_t instr_count,
786- intptr_t call_site_count,
787- intptr_t const_arg_count) {
769+ intptr_t call_site_count) {
770+ // Pragma or size heuristics.
788771 if (inliner_->AlwaysInline (callee)) {
789772 return InliningDecision::Yes (" AlwaysInline" );
790- }
791- if (inlined_size_ > FLAG_inlining_caller_size_threshold) {
792- // Prevent methods becoming humongous and thus slow to compile.
773+ } else if (inlined_size_ > FLAG_inlining_caller_size_threshold) {
774+ // Prevent caller methods becoming humongous and thus slow to compile.
793775 return InliningDecision::No (" --inlining-caller-size-threshold" );
794- }
795- if (const_arg_count > 0 ) {
796- if (instr_count > FLAG_inlining_constant_arguments_max_size_threshold) {
797- return InliningDecision (
798- false , " --inlining-constant-arguments-max-size-threshold" );
799- }
800776 } else if (instr_count > FLAG_inlining_callee_size_threshold) {
777+ // Prevent inlining of callee methods that exceed certain size.
801778 return InliningDecision::No (" --inlining-callee-size-threshold" );
802779 }
803- int callee_inlining_depth = callee.inlining_depth ();
804- if (callee_inlining_depth > 0 && callee_inlining_depth + inlining_depth_ >
805- FLAG_inlining_depth_threshold) {
780+ // Inlining depth.
781+ const int callee_inlining_depth = callee.inlining_depth ();
782+ if (callee_inlining_depth > 0 &&
783+ ((callee_inlining_depth + inlining_depth_) >
784+ FLAG_inlining_depth_threshold)) {
806785 return InliningDecision::No (" --inlining-depth-threshold" );
807786 }
808- // 'instr_count' can be 0 if it was not computed yet.
809- if ((instr_count != 0 ) && (instr_count <= FLAG_inlining_size_threshold)) {
787+ // Situation instr_count == 0 denotes no counts have been computed yet.
788+ // In that case, we say ok to the early heuristic and come back with the
789+ // late heuristic.
790+ if (instr_count == 0 ) {
791+ return InliningDecision::Yes (" need to count first" );
792+ } else if (instr_count <= FLAG_inlining_size_threshold) {
810793 return InliningDecision::Yes (" --inlining-size-threshold" );
811- }
812- if (call_site_count <= FLAG_inlining_callee_call_sites_threshold) {
794+ } else if (call_site_count <= FLAG_inlining_callee_call_sites_threshold) {
813795 return InliningDecision::Yes (" --inlining-callee-call-sites-threshold" );
814796 }
815- if ((const_arg_count >= FLAG_inlining_constant_arguments_count) &&
816- (instr_count <= FLAG_inlining_constant_arguments_min_size_threshold)) {
817- return InliningDecision (true ,
818- " --inlining-constant-arguments-count and "
819- " inlining-constant-arguments-min-size-threshold" );
820- }
821797 return InliningDecision::No (" default" );
822798 }
823799
@@ -968,8 +944,8 @@ class CallSiteInliner : public ValueObject {
968944 constant_arg_count == 0 ? function.optimized_instruction_count () : 0 ;
969945 const intptr_t call_site_count =
970946 constant_arg_count == 0 ? function.optimized_call_site_count () : 0 ;
971- InliningDecision decision = ShouldWeInline (
972- function, instruction_count, call_site_count, constant_arg_count );
947+ InliningDecision decision =
948+ ShouldWeInline ( function, instruction_count, call_site_count);
973949 if (!decision.value ) {
974950 TRACE_INLINING (
975951 THR_Print (" Bailout: early heuristics (%s) with "
@@ -1216,16 +1192,12 @@ class CallSiteInliner : public ValueObject {
12161192 &call_site_count);
12171193
12181194 // Use heuristics do decide if this call should be inlined.
1219- InliningDecision decision = ShouldWeInline (
1220- function, instruction_count, call_site_count, constants_count );
1195+ InliningDecision decision =
1196+ ShouldWeInline ( function, instruction_count, call_site_count);
12211197 if (!decision.value ) {
12221198 // If size is larger than all thresholds, don't consider it again.
12231199 if ((instruction_count > FLAG_inlining_size_threshold) &&
1224- (call_site_count > FLAG_inlining_callee_call_sites_threshold) &&
1225- (instruction_count >
1226- FLAG_inlining_constant_arguments_min_size_threshold) &&
1227- (instruction_count >
1228- FLAG_inlining_constant_arguments_max_size_threshold)) {
1200+ (call_site_count > FLAG_inlining_callee_call_sites_threshold)) {
12291201 function.set_is_inlinable (false );
12301202 }
12311203 TRACE_INLINING (
0 commit comments