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

Unified Diff: runtime/vm/code_generator.cc

Issue 1386503002: Initial design for background compilation (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Address Comments 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.h » ('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 030678cbf6185c487530516b7e7d51da71664e11..5179b4a5f39ea90244209341f76edc923bb8d7d1 100644
--- a/runtime/vm/code_generator.cc
+++ b/runtime/vm/code_generator.cc
@@ -31,6 +31,8 @@ namespace dart {
DEFINE_FLAG(bool, deoptimize_alot, false,
"Deoptimizes all live frames when we are about to return to Dart code from"
" native entries.");
+DEFINE_FLAG(bool, background_compilation, false,
+ "Run optimizing compilation in background");
DEFINE_FLAG(int, max_subtype_cache_entries, 100,
"Maximum number of subtype cache entries (number of checks cached).");
DEFINE_FLAG(int, optimization_counter_threshold, 30000,
@@ -1449,6 +1451,14 @@ DEFINE_RUNTIME_ENTRY(OptimizeInvokedFunction, 1) {
// Reset usage counter for reoptimization before calling optimizer to
// prevent recursive triggering of function optimization.
function.set_usage_counter(0);
+ if (FLAG_background_compilation) {
+ BackgroundCompiler::EnsureInit(isolate);
+ ASSERT(isolate->background_compiler() != NULL);
+ isolate->background_compiler()->CompileOptimized(function);
+ // Continue in the same code.
+ arguments.SetReturn(Code::Handle(isolate, function.CurrentCode()));
+ return;
+ }
if (FLAG_trace_compiler) {
if (function.HasOptimizedCode()) {
THR_Print("ReCompiling function: '%s' \n",
« no previous file with comments | « no previous file | runtime/vm/compiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698