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

Unified Diff: runtime/vm/flow_graph_inliner.cc

Issue 133073019: Improve inlining decision: --inline_getters_setters_smaller_than (default 10). Don not inline gette… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/flow_graph_inliner.h ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_inliner.cc
===================================================================
--- runtime/vm/flow_graph_inliner.cc (revision 32381)
+++ runtime/vm/flow_graph_inliner.cc (working copy)
@@ -26,6 +26,8 @@
DEFINE_FLAG(charp, inlining_filter, NULL, "Inline only in named function");
// Flags for inlining heuristics.
+DEFINE_FLAG(int, inline_getters_setters_smaller_than, 10,
+ "Always inline getters and setters that have fewer instructions");
DEFINE_FLAG(int, inlining_depth_threshold, 3,
"Inline function calls up to threshold nesting depth");
DEFINE_FLAG(int, inlining_size_threshold, 25,
@@ -363,7 +365,8 @@
// Prevent methods becoming humongous and thus slow to compile.
return false;
}
- if (instr_count <= FLAG_inlining_size_threshold) {
+ // 'instr_count' can be 0 if it was not computed yet.
+ if ((instr_count != 0) && (instr_count <= FLAG_inlining_size_threshold)) {
return true;
}
if (call_site_count <= FLAG_inlining_callee_call_sites_threshold) {
@@ -373,7 +376,7 @@
(instr_count <= FLAG_inlining_constant_arguments_size_threshold)) {
return true;
}
- if (MethodRecognizer::AlwaysInline(callee)) {
+ if (FlowGraphInliner::AlwaysInline(callee)) {
return true;
}
return false;
@@ -775,7 +778,7 @@
}
}
const Function& target = call->function();
- if (!MethodRecognizer::AlwaysInline(target) &&
+ if (!FlowGraphInliner::AlwaysInline(target) &&
(call_info[call_idx].ratio * 100) < FLAG_inlining_hotness) {
TRACE_INLINING(OS::Print(
" => %s (deopt count %d)\n Bailout: cold %f\n",
@@ -847,7 +850,7 @@
const ICData& ic_data = call->ic_data();
const Function& target = Function::ZoneHandle(ic_data.GetTargetAt(0));
- if (!MethodRecognizer::AlwaysInline(target) &&
+ if (!FlowGraphInliner::AlwaysInline(target) &&
(call_info[call_idx].ratio * 100) < FLAG_inlining_hotness) {
TRACE_INLINING(OS::Print(
" => %s (deopt count %d)\n Bailout: cold %f\n",
@@ -1446,6 +1449,18 @@
}
+bool FlowGraphInliner::AlwaysInline(const Function& function) {
+ if (function.IsImplicitGetterFunction() || function.IsGetterFunction() ||
+ function.IsImplicitSetterFunction() || function.IsSetterFunction()) {
+ const intptr_t count = function.optimized_instruction_count();
+ if ((count != 0) && (count < FLAG_inline_getters_setters_smaller_than)) {
+ return true;
+ }
+ }
+ return MethodRecognizer::AlwaysInline(function);
+}
+
+
void FlowGraphInliner::Inline() {
// Collect graph info and store it on the function.
// We might later use it for an early bailout from the inlining.
« no previous file with comments | « runtime/vm/flow_graph_inliner.h ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698