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

Unified Diff: runtime/vm/flow_graph_compiler.cc

Issue 501553005: Scale invocation count by the number of BBs in the flow-graph of a method. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Cleanup Created 6 years, 4 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_compiler.h ('k') | runtime/vm/flow_graph_compiler_arm.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_compiler.cc
diff --git a/runtime/vm/flow_graph_compiler.cc b/runtime/vm/flow_graph_compiler.cc
index 90a8f7d13ef8e5ab4e417d714fd0fb9fa340232d..8b1ea0663005760c7832af5711c73f8e08c0ddc2 100644
--- a/runtime/vm/flow_graph_compiler.cc
+++ b/runtime/vm/flow_graph_compiler.cc
@@ -33,6 +33,11 @@ DECLARE_FLAG(bool, enable_type_checks);
DECLARE_FLAG(bool, intrinsify);
DECLARE_FLAG(bool, propagate_ic_data);
DECLARE_FLAG(int, optimization_counter_threshold);
+DEFINE_FLAG(int, optimization_counter_scale, 2000,
+ "The scale of invocation count, by size of the function.");
+DEFINE_FLAG(int, min_optimization_counter_threshold, 5000,
+ "The minimum invocation count for a function.");
+DECLARE_FLAG(int, reoptimization_counter_threshold);
DECLARE_FLAG(bool, use_cha);
DECLARE_FLAG(bool, use_osr);
DECLARE_FLAG(int, stacktrace_every);
@@ -1429,4 +1434,21 @@ const ICData* FlowGraphCompiler::GetOrAddStaticCallICData(
return &ic_data;
}
+
+intptr_t FlowGraphCompiler::GetOptimizationThreshold() const {
+ intptr_t threshold;
+ if (is_optimizing()) {
+ threshold = FLAG_reoptimization_counter_threshold;
+ } else {
+ const intptr_t basic_blocks = flow_graph().preorder().length();
+ ASSERT(basic_blocks > 0);
+ threshold = FLAG_optimization_counter_scale * basic_blocks +
+ FLAG_min_optimization_counter_threshold;
+ if (threshold > FLAG_optimization_counter_threshold) {
+ threshold = FLAG_optimization_counter_threshold;
+ }
+ }
+ return threshold;
+}
+
} // namespace dart
« no previous file with comments | « runtime/vm/flow_graph_compiler.h ('k') | runtime/vm/flow_graph_compiler_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698