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

Unified Diff: runtime/vm/compiler.cc

Issue 2172063003: Retry background compilation if an assumption is invalidated (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/compiler.cc
diff --git a/runtime/vm/compiler.cc b/runtime/vm/compiler.cc
index cc3b69161b382adfc552185160f65bb74e610fc2..1bc179cdd3f696979ca6d252f09ef86522b1d08d 100644
--- a/runtime/vm/compiler.cc
+++ b/runtime/vm/compiler.cc
@@ -1167,8 +1167,10 @@ bool CompileParsedFunctionHelper::Compile(CompilationPipeline* pipeline) {
done = true;
}
- // Clear the error if it was not a real error, but just a bailout.
- if (error.IsLanguageError() &&
+ // If is is not a background compilation, clear the error if it was not a
+ // real error, but just a bailout. If we're it a background compilation
+ // this will be dealt with in the caller.
+ if (!Compiler::IsBackgroundCompilation() && error.IsLanguageError() &&
(LanguageError::Cast(error).kind() == Report::kBailout)) {
thread()->clear_sticky_error();
}
@@ -1277,6 +1279,21 @@ static RawError* CompileFunctionHelper(CompilationPipeline* pipeline,
THR_Print("Aborted background compilation: %s\n",
function.ToFullyQualifiedCString());
}
+ {
+ // If it was a bailout, then disable optimization.
+ Error& error = Error::Handle();
+ // We got an error during compilation.
+ error = thread->sticky_error();
+ thread->clear_sticky_error();
+ if (error.IsLanguageError() &&
+ LanguageError::Cast(error).kind() == Report::kBailout) {
+ if (FLAG_trace_compiler) {
+ THR_Print("--> disabling optimizations for '%s'\n",
+ function.ToFullyQualifiedCString());
+ }
+ function.SetIsOptimizable(false);
+ }
+ }
return Error::null();
}
// Optimizer bailed out. Disable optimizations and never try again.
@@ -1295,6 +1312,7 @@ static RawError* CompileFunctionHelper(CompilationPipeline* pipeline,
// We got an error during compilation.
error = thread->sticky_error();
thread->clear_sticky_error();
+ // The non-optimizing compiler should not bail out.
ASSERT(error.IsLanguageError() &&
LanguageError::Cast(error).kind() != Report::kBailout);
return error.raw();
@@ -1870,8 +1888,9 @@ void BackgroundCompiler::Run() {
function = Function::null();
} else {
qelem = function_queue()->Remove();
- if (FLAG_stress_test_background_compilation) {
- const Function& old = Function::Handle(qelem->Function());
+ const Function& old = Function::Handle(qelem->Function());
+ if ((!old.HasOptimizedCode() && old.IsOptimizable()) ||
+ FLAG_stress_test_background_compilation) {
if (Compiler::CanOptimizeFunction(thread, old)) {
QueueElement* repeat_qelem = new QueueElement(old);
function_queue()->Add(repeat_qelem);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698