Index: src/optimizing-compiler-thread.cc |
diff --git a/src/optimizing-compiler-thread.cc b/src/optimizing-compiler-thread.cc |
index 202e6e5c57e0b2ac2624f369c704344300219e44..0053148a02b4d746a8f20aba9869be350057ba04 100644 |
--- a/src/optimizing-compiler-thread.cc |
+++ b/src/optimizing-compiler-thread.cc |
@@ -168,6 +168,7 @@ void OptimizingCompilerThread::FlushOsrBuffer(bool restore_function_code) { |
void OptimizingCompilerThread::Flush() { |
ASSERT(!IsOptimizerThread()); |
Release_Store(&stop_thread_, static_cast<AtomicWord>(FLUSH)); |
+ if (FLAG_block_concurrent_recompilation) Unblock(); |
input_queue_semaphore_.Signal(); |
stop_semaphore_.Wait(); |
FlushOutputQueue(true); |
@@ -181,6 +182,7 @@ void OptimizingCompilerThread::Flush() { |
void OptimizingCompilerThread::Stop() { |
ASSERT(!IsOptimizerThread()); |
Release_Store(&stop_thread_, static_cast<AtomicWord>(STOP)); |
+ if (FLAG_block_concurrent_recompilation) Unblock(); |
input_queue_semaphore_.Signal(); |
stop_semaphore_.Wait(); |
@@ -252,7 +254,20 @@ void OptimizingCompilerThread::QueueForOptimization(RecompileJob* job) { |
info->closure()->MarkInRecompileQueue(); |
} |
input_queue_.Enqueue(job); |
- input_queue_semaphore_.Signal(); |
+ if (FLAG_block_concurrent_recompilation) { |
+ blocked_jobs_++; |
+ } else { |
+ input_queue_semaphore_.Signal(); |
+ } |
+} |
+ |
+ |
+void OptimizingCompilerThread::Unblock() { |
+ ASSERT(!IsOptimizerThread()); |
+ while (blocked_jobs_ > 0) { |
+ input_queue_semaphore_.Signal(); |
+ blocked_jobs_--; |
+ } |
} |