Index: src/optimizing-compiler-thread.h |
diff --git a/src/optimizing-compiler-thread.h b/src/optimizing-compiler-thread.h |
index 7d60d9bf74556317754537296059a29f6336757d..cc2f8d4be3f2817ce3ecca911971f97aadf4a371 100644 |
--- a/src/optimizing-compiler-thread.h |
+++ b/src/optimizing-compiler-thread.h |
@@ -5,14 +5,14 @@ |
#ifndef V8_OPTIMIZING_COMPILER_THREAD_H_ |
#define V8_OPTIMIZING_COMPILER_THREAD_H_ |
+#include <queue> |
+ |
#include "src/base/atomicops.h" |
#include "src/base/platform/condition-variable.h" |
#include "src/base/platform/mutex.h" |
#include "src/base/platform/platform.h" |
-#include "src/base/platform/time.h" |
#include "src/flags.h" |
#include "src/list.h" |
-#include "src/unbound-queue-inl.h" |
namespace v8 { |
namespace internal { |
@@ -21,16 +21,10 @@ class HOptimizedGraphBuilder; |
class OptimizedCompileJob; |
class SharedFunctionInfo; |
-class OptimizingCompilerThread : public base::Thread { |
+class OptimizingCompilerThread { |
public: |
explicit OptimizingCompilerThread(Isolate* isolate) |
- : Thread(Options("OptimizingCompilerThread")), |
-#ifdef DEBUG |
- thread_id_(0), |
-#endif |
- isolate_(isolate), |
- stop_semaphore_(0), |
- input_queue_semaphore_(0), |
+ : isolate_(isolate), |
input_queue_capacity_(FLAG_concurrent_recompilation_queue_length), |
input_queue_length_(0), |
input_queue_shift_(0), |
@@ -40,11 +34,8 @@ class OptimizingCompilerThread : public base::Thread { |
osr_attempts_(0), |
blocked_jobs_(0), |
ref_count_(0), |
- tracing_enabled_(FLAG_trace_concurrent_recompilation), |
- job_based_recompilation_(FLAG_job_based_recompilation), |
recompilation_delay_(FLAG_concurrent_recompilation_delay) { |
- base::NoBarrier_Store(&stop_thread_, |
- static_cast<base::AtomicWord>(CONTINUE)); |
+ base::NoBarrier_Store(&mode_, static_cast<base::AtomicWord>(COMPILE)); |
input_queue_ = NewArray<OptimizedCompileJob*>(input_queue_capacity_); |
if (FLAG_concurrent_osr) { |
// Allocate and mark OSR buffer slots as empty. |
@@ -83,17 +74,11 @@ class OptimizingCompilerThread : public base::Thread { |
return (FLAG_concurrent_recompilation && max_available > 1); |
} |
-#ifdef DEBUG |
- static bool IsOptimizerThread(Isolate* isolate); |
- bool IsOptimizerThread(); |
-#endif |
- |
private: |
class CompileTask; |
- enum StopFlag { CONTINUE, STOP, FLUSH }; |
+ enum ModeFlag { COMPILE, FLUSH }; |
- void FlushInputQueue(bool restore_function_code); |
void FlushOutputQueue(bool restore_function_code); |
void FlushOsrBuffer(bool restore_function_code); |
void CompileNext(OptimizedCompileJob* job); |
@@ -110,14 +95,7 @@ class OptimizingCompilerThread : public base::Thread { |
return result; |
} |
-#ifdef DEBUG |
- int thread_id_; |
- base::Mutex thread_id_mutex_; |
-#endif |
- |
Isolate* isolate_; |
- base::Semaphore stop_semaphore_; |
- base::Semaphore input_queue_semaphore_; |
// Circular queue of incoming recompilation tasks (including OSR). |
OptimizedCompileJob** input_queue_; |
@@ -127,7 +105,7 @@ class OptimizingCompilerThread : public base::Thread { |
base::Mutex input_queue_mutex_; |
// Queue of recompilation tasks ready to be installed (excluding OSR). |
- UnboundQueue<OptimizedCompileJob*> output_queue_; |
+ std::queue<OptimizedCompileJob*> output_queue_; |
// Used for job based recompilation which has multiple producers on |
// different threads. |
base::Mutex output_queue_mutex_; |
@@ -137,9 +115,7 @@ class OptimizingCompilerThread : public base::Thread { |
int osr_buffer_capacity_; |
int osr_buffer_cursor_; |
- volatile base::AtomicWord stop_thread_; |
- base::TimeDelta time_spent_compiling_; |
- base::TimeDelta time_spent_total_; |
+ volatile base::AtomicWord mode_; |
int osr_hits_; |
int osr_attempts_; |
@@ -150,14 +126,11 @@ class OptimizingCompilerThread : public base::Thread { |
base::Mutex ref_count_mutex_; |
base::ConditionVariable ref_count_zero_; |
- // Copies of FLAG_trace_concurrent_recompilation, |
- // FLAG_concurrent_recompilation_delay and |
- // FLAG_job_based_recompilation that will be used from the background thread. |
+ // Copy of FLAG_concurrent_recompilation_delay that will be used from the |
+ // background thread. |
// |
// Since flags might get modified while the background thread is running, it |
// is not safe to access them directly. |
- bool tracing_enabled_; |
- bool job_based_recompilation_; |
int recompilation_delay_; |
}; |