5 #ifndef V8_COMPILER_DISPATCHER_OPTIMIZING_COMPILE_DISPATCHER_H_ 6 #define V8_COMPILER_DISPATCHER_OPTIMIZING_COMPILE_DISPATCHER_H_ 11 #include "src/allocation.h" 12 #include "src/base/platform/condition-variable.h" 13 #include "src/base/platform/mutex.h" 14 #include "src/base/platform/platform.h" 15 #include "src/flags.h" 16 #include "src/globals.h" 21 class OptimizedCompilationJob;
22 class SharedFunctionInfo;
28 input_queue_capacity_(FLAG_concurrent_recompilation_queue_length),
29 input_queue_length_(0),
30 input_queue_shift_(0),
34 recompilation_delay_(FLAG_concurrent_recompilation_delay) {
35 input_queue_ = NewArray<OptimizedCompilationJob*>(input_queue_capacity_);
41 void Flush(BlockingBehavior blocking_behavior);
45 void InstallOptimizedFunctions();
47 inline bool IsQueueAvailable() {
48 base::MutexGuard access_input_queue(&input_queue_mutex_);
49 return input_queue_length_ < input_queue_capacity_;
52 static bool Enabled() {
return FLAG_concurrent_recompilation; }
57 enum ModeFlag { COMPILE, FLUSH };
59 void FlushOutputQueue(
bool restore_function_code);
63 inline int InputQueueIndex(
int i) {
64 int result = (
i + input_queue_shift_) % input_queue_capacity_;
66 DCHECK_LT(result, input_queue_capacity_);
74 int input_queue_capacity_;
75 int input_queue_length_;
76 int input_queue_shift_;
80 std::queue<OptimizedCompilationJob*> output_queue_;
85 std::atomic<ModeFlag> mode_;
98 int recompilation_delay_;
103 #endif // V8_COMPILER_DISPATCHER_OPTIMIZING_COMPILE_DISPATCHER_H_