Chromium Code Reviews| Index: src/optimizing-compiler-thread.h |
| diff --git a/src/optimizing-compiler-thread.h b/src/optimizing-compiler-thread.h |
| index 42317657024fbc3ced25ec8381d231225728e29c..69bb209c663ecef6b26410b002e77305ad54195d 100644 |
| --- a/src/optimizing-compiler-thread.h |
| +++ b/src/optimizing-compiler-thread.h |
| @@ -54,11 +54,12 @@ class OptimizingCompilerThread : public Thread { |
| stop_semaphore_(0), |
| input_queue_semaphore_(0), |
| osr_candidates_(2), |
| - ready_for_osr_(2), |
| + osr_cursor_(0), |
| osr_hits_(0), |
| osr_attempts_(0) { |
| NoBarrier_Store(&stop_thread_, static_cast<AtomicWord>(CONTINUE)); |
| NoBarrier_Store(&queue_length_, static_cast<AtomicWord>(0)); |
| + for (int i = 0; i < kOsrBufferSize; i++) osr_buffer_[i] = NULL; |
| } |
| ~OptimizingCompilerThread() {} |
| @@ -94,14 +95,16 @@ class OptimizingCompilerThread : public Thread { |
| private: |
| enum StopFlag { CONTINUE, STOP, FLUSH }; |
| - // Remove the oldest OSR candidates that are ready so that we |
| - // only have |limit| left waiting. |
| - void RemoveStaleOSRCandidates(int limit = kReadyForOSRLimit); |
| - |
| void FlushInputQueue(bool restore_function_code); |
| void FlushOutputQueue(bool restore_function_code); |
| void CompileNext(); |
| + // Add a recompilation task for OSR to the cyclic buffer, awaiting OSR entry. |
| + // Tasks evicted from the cyclic buffer are discarded. |
| + void AddToOsrBuffer(OptimizingCompiler* compiler); |
| + |
| + static const int kOsrBufferSize = 8; |
| + |
| #ifdef DEBUG |
| int thread_id_; |
| Mutex thread_id_mutex_; |
| @@ -117,8 +120,10 @@ class OptimizingCompilerThread : public Thread { |
| UnboundQueue<OptimizingCompiler*> output_queue_; |
| // List of recompilation tasks for OSR in the input queue. |
| List<OptimizingCompiler*> osr_candidates_; |
|
titzer
2013/09/24 09:42:01
First, I am not even sure why you need two buffers
Yang
2013/09/24 10:07:11
osr_candidates_ simply mirrors OSR jobs that are e
|
| - // List of recompilation tasks ready for OSR. |
| - List<OptimizingCompiler*> ready_for_osr_; |
| + // Cyclic buffer of recompilation tasks ready for OSR. |
| + OptimizingCompiler* osr_buffer_[kOsrBufferSize]; |
| + // Cursor for the cyclic buffer. |
| + int osr_cursor_; |
| volatile AtomicWord stop_thread_; |
| volatile Atomic32 queue_length_; |
| @@ -127,11 +132,8 @@ class OptimizingCompilerThread : public Thread { |
| // TODO(yangguo): remove this once the memory leak has been figured out. |
| Mutex queue_mutex_; |
| - Mutex osr_list_mutex_; |
| int osr_hits_; |
| int osr_attempts_; |
| - |
| - static const int kReadyForOSRLimit = 4; |
| }; |
| } } // namespace v8::internal |