Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(216)

Side by Side Diff: src/optimizing-compiler-thread.h

Issue 948863002: Get rid of recursive locks for job based recompilation (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/flag-definitions.h ('k') | src/optimizing-compiler-thread.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 17 matching lines...) Expand all
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 task_count_(0),
39 osr_hits_(0), 38 osr_hits_(0),
40 osr_attempts_(0), 39 osr_attempts_(0),
41 blocked_jobs_(0), 40 blocked_jobs_(0),
41 ref_count_(1),
42 tracing_enabled_(FLAG_trace_concurrent_recompilation), 42 tracing_enabled_(FLAG_trace_concurrent_recompilation),
43 job_based_recompilation_(FLAG_job_based_recompilation), 43 job_based_recompilation_(FLAG_job_based_recompilation),
44 recompilation_delay_(FLAG_concurrent_recompilation_delay) { 44 recompilation_delay_(FLAG_concurrent_recompilation_delay) {
45 base::NoBarrier_Store(&stop_thread_, 45 base::NoBarrier_Store(&stop_thread_,
46 static_cast<base::AtomicWord>(CONTINUE)); 46 static_cast<base::AtomicWord>(CONTINUE));
47 input_queue_ = NewArray<OptimizedCompileJob*>(input_queue_capacity_); 47 input_queue_ = NewArray<OptimizedCompileJob*>(input_queue_capacity_);
48 if (FLAG_concurrent_osr) { 48 if (FLAG_concurrent_osr) {
49 // Allocate and mark OSR buffer slots as empty. 49 // Allocate and mark OSR buffer slots as empty.
50 osr_buffer_ = NewArray<OptimizedCompileJob*>(osr_buffer_capacity_); 50 osr_buffer_ = NewArray<OptimizedCompileJob*>(osr_buffer_capacity_);
51 for (int i = 0; i < osr_buffer_capacity_; i++) osr_buffer_[i] = NULL; 51 for (int i = 0; i < osr_buffer_capacity_; i++) osr_buffer_[i] = NULL;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 133
134 // Cyclic buffer of recompilation tasks for OSR. 134 // Cyclic buffer of recompilation tasks for OSR.
135 OptimizedCompileJob** osr_buffer_; 135 OptimizedCompileJob** osr_buffer_;
136 int osr_buffer_capacity_; 136 int osr_buffer_capacity_;
137 int osr_buffer_cursor_; 137 int osr_buffer_cursor_;
138 138
139 volatile base::AtomicWord stop_thread_; 139 volatile base::AtomicWord stop_thread_;
140 base::TimeDelta time_spent_compiling_; 140 base::TimeDelta time_spent_compiling_;
141 base::TimeDelta time_spent_total_; 141 base::TimeDelta time_spent_total_;
142 142
143 int task_count_;
144 // TODO(jochen): This is currently a RecursiveMutex since both Flush/Stop and
145 // Unblock try to get it, but the former methods both can call Unblock. Once
146 // job based recompilation is on by default, and the dedicated thread can be
147 // removed, this should be refactored to not use a RecursiveMutex.
148 base::RecursiveMutex task_count_mutex_;
149
150 int osr_hits_; 143 int osr_hits_;
151 int osr_attempts_; 144 int osr_attempts_;
152 145
153 int blocked_jobs_; 146 int blocked_jobs_;
154 147
148 volatile base::AtomicWord ref_count_;
149
155 // Copies of FLAG_trace_concurrent_recompilation, 150 // Copies of FLAG_trace_concurrent_recompilation,
156 // FLAG_concurrent_recompilation_delay and 151 // FLAG_concurrent_recompilation_delay and
157 // FLAG_job_based_recompilation that will be used from the background thread. 152 // FLAG_job_based_recompilation that will be used from the background thread.
158 // 153 //
159 // Since flags might get modified while the background thread is running, it 154 // Since flags might get modified while the background thread is running, it
160 // is not safe to access them directly. 155 // is not safe to access them directly.
161 bool tracing_enabled_; 156 bool tracing_enabled_;
162 bool job_based_recompilation_; 157 bool job_based_recompilation_;
163 int recompilation_delay_; 158 int recompilation_delay_;
164 }; 159 };
165 160
166 } } // namespace v8::internal 161 } } // namespace v8::internal
167 162
168 #endif // V8_OPTIMIZING_COMPILER_THREAD_H_ 163 #endif // V8_OPTIMIZING_COMPILER_THREAD_H_
OLDNEW
« no previous file with comments | « src/flag-definitions.h ('k') | src/optimizing-compiler-thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698