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

Unified Diff: runtime/vm/code_generator.cc

Issue 1413233004: nt # Enter a description of the change. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: c Created 5 years, 2 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 | « no previous file | runtime/vm/compiler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/code_generator.cc
diff --git a/runtime/vm/code_generator.cc b/runtime/vm/code_generator.cc
index 41175a72f4e4da6ec19ea601d977ff216b75549a..4ab89ca6e7260fe4025b94ac6fff64b7ad9b8468 100644
--- a/runtime/vm/code_generator.cc
+++ b/runtime/vm/code_generator.cc
@@ -1448,10 +1448,12 @@ DEFINE_RUNTIME_ENTRY(OptimizeInvokedFunction, 1) {
ASSERT(function.HasCode());
if (CanOptimizeFunction(function, isolate)) {
- // Reset usage counter for reoptimization before calling optimizer to
- // prevent recursive triggering of function optimization.
- function.set_usage_counter(0);
if (FLAG_background_compilation) {
+ // Reduce the chance of triggering optimization while the function is
+ // being optimized in the background. INT_MIN should ensure that it takes
+ // long time to trigger optimization.
+ // Note that the background compilation queue rejects duplicate entries.
+ function.set_usage_counter(INT_MIN);
BackgroundCompiler::EnsureInit(thread);
ASSERT(isolate->background_compiler() != NULL);
isolate->background_compiler()->CompileOptimized(function);
@@ -1459,6 +1461,10 @@ DEFINE_RUNTIME_ENTRY(OptimizeInvokedFunction, 1) {
arguments.SetReturn(Code::Handle(zone, function.CurrentCode()));
return;
}
+
+ // Reset usage counter for reoptimization before calling optimizer to
+ // prevent recursive triggering of function optimization.
+ function.set_usage_counter(0);
if (FLAG_trace_compiler) {
if (function.HasOptimizedCode()) {
THR_Print("ReCompiling function: '%s' \n",
« no previous file with comments | « no previous file | runtime/vm/compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698