Chromium Code Reviews| Index: runtime/vm/compiler.cc |
| diff --git a/runtime/vm/compiler.cc b/runtime/vm/compiler.cc |
| index be9c996a8ee88a12f439c6bb3fbe4041a12f7223..a43da6bdd5661fa7d233cfa5f3de25aeb9c7dc42 100644 |
| --- a/runtime/vm/compiler.cc |
| +++ b/runtime/vm/compiler.cc |
| @@ -1049,8 +1049,10 @@ bool CompileParsedFunctionHelper::Compile(CompilationPipeline* pipeline) { |
| TimelineDurationScope tds(thread(), |
| compiler_timeline, |
| "FinalizeCompilation"); |
| - // This part of compilation must be at a safepoint. |
| - if (!thread()->IsMutatorThread()) { |
| + if (thread()->IsMutatorThread()) { |
| + FinalizeCompilation(&assembler, &graph_compiler, flow_graph); |
| + } else { |
| + // This part of compilation must be at a safepoint. |
| // Stop mutator thread before creating the instruction object and |
| // installing code. |
| // Mutator thread may not run code while we are creating the |
| @@ -1058,13 +1060,16 @@ bool CompileParsedFunctionHelper::Compile(CompilationPipeline* pipeline) { |
| // changes code page access permissions (makes them temporary not |
| // executable). |
| isolate()->thread_registry()->SafepointThreads(); |
| - } |
| - |
| - FinalizeCompilation(&assembler, &graph_compiler, flow_graph); |
| - |
| - if (!thread()->IsMutatorThread()) { |
| - // Background compilation. |
| + { |
| + // We do not Garbage collect during this stage and allow the |
|
Ivan Posva
2016/01/11 06:14:09
// Do not allow garbage collection during this sta
siva
2016/01/11 18:27:47
Done.
|
| + // heap to grow. |
| + NoHeapGrowthControlScope no_growth_control; |
| + FinalizeCompilation(&assembler, &graph_compiler, flow_graph); |
| + } |
| isolate()->thread_registry()->ResumeAllThreads(); |
| + if (isolate()->heap()->NeedsGarbageCollection()) { |
| + isolate()->heap()->CollectAllGarbage(); |
| + } |
| } |
| } |
| // Mark that this isolate now has compiled code. |