| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_OPTIMIZING_COMPILER_THREAD_H_ | 5 #ifndef V8_OPTIMIZING_COMPILER_THREAD_H_ |
| 6 #define V8_OPTIMIZING_COMPILER_THREAD_H_ | 6 #define V8_OPTIMIZING_COMPILER_THREAD_H_ |
| 7 | 7 |
| 8 #include "src/base/atomicops.h" | 8 #include "src/base/atomicops.h" |
| 9 #include "src/base/platform/mutex.h" | 9 #include "src/base/platform/mutex.h" |
| 10 #include "src/base/platform/platform.h" | 10 #include "src/base/platform/platform.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 static bool Enabled(int max_available) { | 77 static bool Enabled(int max_available) { |
| 78 return (FLAG_concurrent_recompilation && max_available > 1); | 78 return (FLAG_concurrent_recompilation && max_available > 1); |
| 79 } | 79 } |
| 80 | 80 |
| 81 #ifdef DEBUG | 81 #ifdef DEBUG |
| 82 static bool IsOptimizerThread(Isolate* isolate); | 82 static bool IsOptimizerThread(Isolate* isolate); |
| 83 bool IsOptimizerThread(); | 83 bool IsOptimizerThread(); |
| 84 #endif | 84 #endif |
| 85 | 85 |
| 86 private: | 86 private: |
| 87 class CompileTask; |
| 88 |
| 87 enum StopFlag { CONTINUE, STOP, FLUSH }; | 89 enum StopFlag { CONTINUE, STOP, FLUSH }; |
| 88 | 90 |
| 89 void FlushInputQueue(bool restore_function_code); | 91 void FlushInputQueue(bool restore_function_code); |
| 90 void FlushOutputQueue(bool restore_function_code); | 92 void FlushOutputQueue(bool restore_function_code); |
| 91 void FlushOsrBuffer(bool restore_function_code); | 93 void FlushOsrBuffer(bool restore_function_code); |
| 92 void CompileNext(); | 94 void CompileNext(); |
| 93 OptimizedCompileJob* NextInput(); | 95 OptimizedCompileJob* NextInput(); |
| 94 | 96 |
| 95 // Add a recompilation task for OSR to the cyclic buffer, awaiting OSR entry. | 97 // Add a recompilation task for OSR to the cyclic buffer, awaiting OSR entry. |
| 96 // Tasks evicted from the cyclic buffer are discarded. | 98 // Tasks evicted from the cyclic buffer are discarded. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 114 | 116 |
| 115 // Circular queue of incoming recompilation tasks (including OSR). | 117 // Circular queue of incoming recompilation tasks (including OSR). |
| 116 OptimizedCompileJob** input_queue_; | 118 OptimizedCompileJob** input_queue_; |
| 117 int input_queue_capacity_; | 119 int input_queue_capacity_; |
| 118 int input_queue_length_; | 120 int input_queue_length_; |
| 119 int input_queue_shift_; | 121 int input_queue_shift_; |
| 120 base::Mutex input_queue_mutex_; | 122 base::Mutex input_queue_mutex_; |
| 121 | 123 |
| 122 // Queue of recompilation tasks ready to be installed (excluding OSR). | 124 // Queue of recompilation tasks ready to be installed (excluding OSR). |
| 123 UnboundQueue<OptimizedCompileJob*> output_queue_; | 125 UnboundQueue<OptimizedCompileJob*> output_queue_; |
| 126 // Used for job based recompilation which has multiple producers on |
| 127 // different threads. |
| 128 base::Mutex output_queue_mutex_; |
| 124 | 129 |
| 125 // Cyclic buffer of recompilation tasks for OSR. | 130 // Cyclic buffer of recompilation tasks for OSR. |
| 126 OptimizedCompileJob** osr_buffer_; | 131 OptimizedCompileJob** osr_buffer_; |
| 127 int osr_buffer_capacity_; | 132 int osr_buffer_capacity_; |
| 128 int osr_buffer_cursor_; | 133 int osr_buffer_cursor_; |
| 129 | 134 |
| 130 volatile base::AtomicWord stop_thread_; | 135 volatile base::AtomicWord stop_thread_; |
| 131 base::TimeDelta time_spent_compiling_; | 136 base::TimeDelta time_spent_compiling_; |
| 132 base::TimeDelta time_spent_total_; | 137 base::TimeDelta time_spent_total_; |
| 133 | 138 |
| 134 int osr_hits_; | 139 int osr_hits_; |
| 135 int osr_attempts_; | 140 int osr_attempts_; |
| 136 | 141 |
| 137 int blocked_jobs_; | 142 int blocked_jobs_; |
| 138 }; | 143 }; |
| 139 | 144 |
| 140 } } // namespace v8::internal | 145 } } // namespace v8::internal |
| 141 | 146 |
| 142 #endif // V8_OPTIMIZING_COMPILER_THREAD_H_ | 147 #endif // V8_OPTIMIZING_COMPILER_THREAD_H_ |
| OLD | NEW |