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

Unified Diff: runtime/vm/flow_graph_inliner.cc

Issue 11567012: Store optimized flow graph statistics on the function itself. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years 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
Index: runtime/vm/flow_graph_inliner.cc
diff --git a/runtime/vm/flow_graph_inliner.cc b/runtime/vm/flow_graph_inliner.cc
index 2b3bfe2d1a92e7d6f6e1de95d8f08ce0a7ce4236..c809814a75b793e1be0bfcdb3a8de35163b923c6 100644
--- a/runtime/vm/flow_graph_inliner.cc
+++ b/runtime/vm/flow_graph_inliner.cc
@@ -353,6 +353,14 @@ class CallSiteInliner : public ValueObject {
return false;
}
+ if (!ShouldWeInline(call->GetBlock()->loop_depth(),
+ function.optimized_instruction_count(),
+ function.optimized_call_site_count(),
+ CountConstants(*arguments))) {
+ TRACE_INLINING(OS::Print(" Bailout: early heuristics\n"));
srdjan 2012/12/13 19:00:17 Maybe print also the arguments that led to inlinin
Vyacheslav Egorov (Google) 2012/12/13 19:14:11 Done.
+ return false;
+ }
+
// Abort if this is a recursive occurrence.
if (IsCallRecursive(function, call)) {
function.set_is_inlinable(false);
@@ -494,6 +502,8 @@ class CallSiteInliner : public ValueObject {
(size > FLAG_inlining_constant_arguments_size_threshold)) {
function.set_is_inlinable(false);
}
+ function.set_optimized_instruction_count(size);
Kevin Millikin (Google) 2012/12/13 16:43:40 Also a bit strange to set this only when we decide
Vyacheslav Egorov (Google) 2012/12/13 18:54:46 Yep, this is wrong.
+ function.set_optimized_call_site_count(info.call_site_count());
isolate->set_long_jump_base(base);
isolate->set_deopt_id(prev_deopt_id);
isolate->set_ic_data_array(prev_ic_data.raw());
@@ -580,6 +590,14 @@ class CallSiteInliner : public ValueObject {
}
}
+ static intptr_t CountConstants(const GrowableArray<Value*>& arguments) {
+ intptr_t count = 0;
+ for (intptr_t i = 0; i < arguments.length(); i++) {
+ if (arguments[i]->BindsToConstant()) count++;
+ }
+ return count;
+ }
+
// Parse a function reusing the cache if possible.
ParsedFunction* GetParsedFunction(const Function& function, bool* in_cache) {
// TODO(zerny): Use a hash map for the cache.
@@ -769,6 +787,17 @@ class CallSiteInliner : public ValueObject {
};
+void FlowGraphInliner::CollectGraphInfo(FlowGraph* flow_graph) {
+ GraphInfoCollector info;
+ info.Collect(*flow_graph);
+ const Function& function = flow_graph->parsed_function().function();
+ function.set_optimized_instruction_count(
+ static_cast<uint16_t>(info.instruction_count()));
+ function.set_optimized_call_site_count(
+ static_cast<uint16_t>(info.call_site_count()));
+}
+
+
void FlowGraphInliner::Inline() {
if ((FLAG_inlining_filter != NULL) &&
(strstr(flow_graph_->

Powered by Google App Engine
This is Rietveld 408576698