@@ -473,6 +473,7 @@ class CompileParsedFunctionHelper : public ValueObject {
473
473
void FinalizeCompilation (Assembler* assembler,
474
474
FlowGraphCompiler* graph_compiler,
475
475
FlowGraph* flow_graph);
476
+ void CheckIfBackgroundCompilerIsBeingStopped ();
476
477
477
478
ParsedFunction* parsed_function_;
478
479
const bool optimized_;
@@ -666,6 +667,16 @@ NOT_IN_PRODUCT(
666
667
}
667
668
668
669
670
+ void CompileParsedFunctionHelper::CheckIfBackgroundCompilerIsBeingStopped () {
671
+ ASSERT (Compiler::IsBackgroundCompilation ());
672
+ if (!isolate ()->background_compiler ()->is_running ()) {
673
+ // The background compiler is being stopped.
674
+ Compiler::AbortBackgroundCompilation (Thread::kNoDeoptId ,
675
+ " Background compilation is being stopped" );
676
+ }
677
+ }
678
+
679
+
669
680
// Return false if bailed out.
670
681
// If optimized_result_code is not NULL then it is caller's responsibility
671
682
// to install code.
@@ -1133,19 +1144,17 @@ bool CompileParsedFunctionHelper::Compile(CompilationPipeline* pipeline) {
1133
1144
// changes code page access permissions (makes them temporary not
1134
1145
// executable).
1135
1146
{
1147
+ CheckIfBackgroundCompilerIsBeingStopped ();
1136
1148
SafepointOperationScope safepoint_scope (thread ());
1137
1149
// Do not Garbage collect during this stage and instead allow the
1138
1150
// heap to grow.
1139
1151
NoHeapGrowthControlScope no_growth_control;
1140
- if (!isolate ()->background_compiler ()->is_running ()) {
1141
- // The background compiler is being stopped.
1142
- Compiler::AbortBackgroundCompilation (Thread::kNoDeoptId ,
1143
- " Background compilation is being stopped" );
1144
- }
1152
+ CheckIfBackgroundCompilerIsBeingStopped ();
1145
1153
FinalizeCompilation (&assembler, &graph_compiler, flow_graph);
1146
1154
}
1147
1155
// TODO(srdjan): Enable this and remove the one from
1148
- // 'BackgroundCompiler::CompileOptimized'
1156
+ // 'BackgroundCompiler::CompileOptimized' once cause of time-outs
1157
+ // is resolved.
1149
1158
// if (isolate()->heap()->NeedsGarbageCollection()) {
1150
1159
// isolate()->heap()->CollectAllGarbage();
1151
1160
// }
@@ -1916,7 +1925,10 @@ void BackgroundCompiler::VisitPointers(ObjectPointerVisitor* visitor) {
1916
1925
1917
1926
void BackgroundCompiler::Stop (Isolate* isolate) {
1918
1927
BackgroundCompiler* task = isolate->background_compiler ();
1919
- ASSERT (task != NULL );
1928
+ if (task == NULL ) {
1929
+ // Nothing to stop.
1930
+ return ;
1931
+ }
1920
1932
BackgroundCompilationQueue* function_queue = task->function_queue ();
1921
1933
1922
1934
Monitor* queue_monitor = task->queue_monitor_ ;
0 commit comments