Index: runtime/vm/compiler.cc |
diff --git a/runtime/vm/compiler.cc b/runtime/vm/compiler.cc |
index 92c3d68f3c69c4292e80586d03c19b1117ca946a..cd6208852615f9181c49291e4170cd94a473c42b 100644 |
--- a/runtime/vm/compiler.cc |
+++ b/runtime/vm/compiler.cc |
@@ -1688,7 +1688,10 @@ void BackgroundCompiler::Run() { |
// unoptimized code. Any issues while optimizing are flagged by |
// making the result invalid. |
ASSERT(error.IsNull()); |
- isolate->aggregate_compiler_stats()->Add(*thread->compiler_stats()); |
+ // We cannot aggregate stats if isolate is shutting down. |
+ if (isolate->HasMutatorThread()) { |
+ isolate->aggregate_compiler_stats()->Add(*thread->compiler_stats()); |
+ } |
thread->compiler_stats()->Clear(); |
QueueElement* qelem = function_queue()->Remove(); |
delete qelem; |