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

Unified Diff: runtime/vm/compiler.cc

Issue 1821283002: Fix background compilation: handle compilation abort during parsing. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: t Created 4 years, 9 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/object.cc » ('j') | 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 d7a889c37637a7982211940be1f33d6c990e0e90..14bcc09403163ef425a4f0f9bb5e64539db47995 100644
--- a/runtime/vm/compiler.cc
+++ b/runtime/vm/compiler.cc
@@ -1171,6 +1171,10 @@ static RawError* CompileFunctionHelper(CompilationPipeline* pipeline,
if (Compiler::IsBackgroundCompilation()) {
// Try again later, background compilation may abort because of
// state change during compilation.
+ if (FLAG_trace_compiler) {
+ THR_Print("Aborted background compilation: %s\n",
+ function.ToFullyQualifiedCString());
+ }
return Error::null();
}
// Optimizer bailed out. Disable optimizations and never try again.
@@ -1225,9 +1229,18 @@ static RawError* CompileFunctionHelper(CompilationPipeline* pipeline,
Thread* const thread = Thread::Current();
StackZone stack_zone(thread);
Error& error = Error::Handle();
- // We got an error during compilation.
+ // We got an error during compilation or it is a bailout from background
+ // compilation (e.g., during parsing with EnsureIsFinalized).
error = thread->sticky_error();
thread->clear_sticky_error();
+ if (error.raw() == Object::background_compilation_error().raw()) {
+ // Exit compilation, retry it later.
+ if (FLAG_trace_bailout) {
+ THR_Print("Aborted background compilation: %s\n",
+ function.ToFullyQualifiedCString());
+ }
+ return Error::null();
+ }
// Unoptimized compilation or precompilation may encounter compile-time
// errors, but regular optimized compilation should not.
ASSERT(!optimized);
« no previous file with comments | « no previous file | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698