Index: runtime/vm/compiler.cc |
diff --git a/runtime/vm/compiler.cc b/runtime/vm/compiler.cc |
index 842ffea26b6474a4ad92f56d84bcd7006d5cc8c2..7f84e1407de635450ed583a4975946d3c650e29d 100644 |
--- a/runtime/vm/compiler.cc |
+++ b/runtime/vm/compiler.cc |
@@ -1754,7 +1754,7 @@ void BackgroundCompiler::Run() { |
{ MonitorLocker ml(queue_monitor_); |
function = function_queue()->PeekFunction(); |
} |
- while (running_ && !function.IsNull()) { |
+ while (running_ && !function.IsNull() && !isolate_->IsTopLevelParsing()) { |
// Check that we have aggregated and cleared the stats. |
ASSERT(thread->compiler_stats()->IsCleared()); |
const Error& error = Error::Handle(zone, |
@@ -1794,7 +1794,8 @@ void BackgroundCompiler::Run() { |
{ |
// Wait to be notified when the work queue is not empty. |
MonitorLocker ml(queue_monitor_); |
- while (function_queue()->IsEmpty() && running_) { |
+ while ((function_queue()->IsEmpty() || isolate_->IsTopLevelParsing()) |
+ && running_) { |
ml.Wait(); |
} |
} |