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" |
11 #include "src/base/platform/time.h" | 11 #include "src/base/platform/time.h" |
12 #include "src/flags.h" | 12 #include "src/flags.h" |
13 #include "src/list.h" | 13 #include "src/list.h" |
14 #include "src/unbound-queue-inl.h" | 14 #include "src/unbound-queue-inl.h" |
15 | 15 |
16 namespace v8 { | 16 namespace v8 { |
17 namespace internal { | 17 namespace internal { |
18 | 18 |
19 class HOptimizedGraphBuilder; | 19 class HOptimizedGraphBuilder; |
20 class OptimizedCompileJob; | 20 class OptimizedCompileJob; |
21 class SharedFunctionInfo; | 21 class SharedFunctionInfo; |
22 | 22 |
23 class OptimizingCompilerThread : public base::Thread { | 23 class OptimizingCompilerThread : public base::Thread { |
24 public: | 24 public: |
25 explicit OptimizingCompilerThread(Isolate *isolate) : | 25 explicit OptimizingCompilerThread(Isolate* isolate) |
26 Thread("OptimizingCompilerThread"), | 26 : Thread(Options("OptimizingCompilerThread")), |
27 #ifdef DEBUG | 27 #ifdef DEBUG |
28 thread_id_(0), | 28 thread_id_(0), |
29 #endif | 29 #endif |
30 isolate_(isolate), | 30 isolate_(isolate), |
31 stop_semaphore_(0), | 31 stop_semaphore_(0), |
32 input_queue_semaphore_(0), | 32 input_queue_semaphore_(0), |
33 input_queue_capacity_(FLAG_concurrent_recompilation_queue_length), | 33 input_queue_capacity_(FLAG_concurrent_recompilation_queue_length), |
34 input_queue_length_(0), | 34 input_queue_length_(0), |
35 input_queue_shift_(0), | 35 input_queue_shift_(0), |
36 osr_buffer_capacity_(FLAG_concurrent_recompilation_queue_length + 4), | 36 osr_buffer_capacity_(FLAG_concurrent_recompilation_queue_length + 4), |
37 osr_buffer_cursor_(0), | 37 osr_buffer_cursor_(0), |
38 osr_hits_(0), | 38 osr_hits_(0), |
39 osr_attempts_(0), | 39 osr_attempts_(0), |
40 blocked_jobs_(0) { | 40 blocked_jobs_(0) { |
41 base::NoBarrier_Store(&stop_thread_, | 41 base::NoBarrier_Store(&stop_thread_, |
42 static_cast<base::AtomicWord>(CONTINUE)); | 42 static_cast<base::AtomicWord>(CONTINUE)); |
43 input_queue_ = NewArray<OptimizedCompileJob*>(input_queue_capacity_); | 43 input_queue_ = NewArray<OptimizedCompileJob*>(input_queue_capacity_); |
44 if (FLAG_concurrent_osr) { | 44 if (FLAG_concurrent_osr) { |
45 // Allocate and mark OSR buffer slots as empty. | 45 // Allocate and mark OSR buffer slots as empty. |
46 osr_buffer_ = NewArray<OptimizedCompileJob*>(osr_buffer_capacity_); | 46 osr_buffer_ = NewArray<OptimizedCompileJob*>(osr_buffer_capacity_); |
47 for (int i = 0; i < osr_buffer_capacity_; i++) osr_buffer_[i] = NULL; | 47 for (int i = 0; i < osr_buffer_capacity_; i++) osr_buffer_[i] = NULL; |
48 } | 48 } |
49 } | 49 } |
50 | 50 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 | 133 |
134 int osr_hits_; | 134 int osr_hits_; |
135 int osr_attempts_; | 135 int osr_attempts_; |
136 | 136 |
137 int blocked_jobs_; | 137 int blocked_jobs_; |
138 }; | 138 }; |
139 | 139 |
140 } } // namespace v8::internal | 140 } } // namespace v8::internal |
141 | 141 |
142 #endif // V8_OPTIMIZING_COMPILER_THREAD_H_ | 142 #endif // V8_OPTIMIZING_COMPILER_THREAD_H_ |
OLD | NEW |