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

Side by Side Diff: src/compiler-dispatcher/optimizing-compile-dispatcher.h

Issue 2662883003: Add a test for OptimizingCompileDispatcher::Flush's non-blocking behavior (Closed)
Patch Set: updates Created 3 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/compiler.h ('k') | src/compiler-dispatcher/optimizing-compile-dispatcher.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_COMPILER_DISPATCHER_OPTIMIZING_COMPILE_DISPATCHER_H_ 5 #ifndef V8_COMPILER_DISPATCHER_OPTIMIZING_COMPILE_DISPATCHER_H_
6 #define V8_COMPILER_DISPATCHER_OPTIMIZING_COMPILE_DISPATCHER_H_ 6 #define V8_COMPILER_DISPATCHER_OPTIMIZING_COMPILE_DISPATCHER_H_
7 7
8 #include <queue> 8 #include <queue>
9 9
10 #include "src/base/atomicops.h" 10 #include "src/base/atomicops.h"
11 #include "src/base/platform/condition-variable.h" 11 #include "src/base/platform/condition-variable.h"
12 #include "src/base/platform/mutex.h" 12 #include "src/base/platform/mutex.h"
13 #include "src/base/platform/platform.h" 13 #include "src/base/platform/platform.h"
14 #include "src/flags.h" 14 #include "src/flags.h"
15 #include "src/globals.h"
15 #include "src/list.h" 16 #include "src/list.h"
16 17
17 namespace v8 { 18 namespace v8 {
18 namespace internal { 19 namespace internal {
19 20
20 class CompilationJob; 21 class CompilationJob;
21 class SharedFunctionInfo; 22 class SharedFunctionInfo;
22 23
23 class OptimizingCompileDispatcher { 24 class V8_EXPORT_PRIVATE OptimizingCompileDispatcher {
24 public: 25 public:
25 enum class BlockingBehavior { kBlock, kDontBlock }; 26 enum class BlockingBehavior { kBlock, kDontBlock };
26 27
27 explicit OptimizingCompileDispatcher(Isolate* isolate) 28 explicit OptimizingCompileDispatcher(Isolate* isolate)
28 : isolate_(isolate), 29 : isolate_(isolate),
29 input_queue_capacity_(FLAG_concurrent_recompilation_queue_length), 30 input_queue_capacity_(FLAG_concurrent_recompilation_queue_length),
30 input_queue_length_(0), 31 input_queue_length_(0),
31 input_queue_shift_(0), 32 input_queue_shift_(0),
32 blocked_jobs_(0), 33 blocked_jobs_(0),
33 ref_count_(0), 34 ref_count_(0),
34 recompilation_delay_(FLAG_concurrent_recompilation_delay) { 35 recompilation_delay_(FLAG_concurrent_recompilation_delay) {
35 base::NoBarrier_Store(&mode_, static_cast<base::AtomicWord>(COMPILE)); 36 base::NoBarrier_Store(&mode_, static_cast<base::AtomicWord>(COMPILE));
36 input_queue_ = NewArray<CompilationJob*>(input_queue_capacity_); 37 input_queue_ = NewArray<CompilationJob*>(input_queue_capacity_);
37 } 38 }
38 39
39 ~OptimizingCompileDispatcher(); 40 ~OptimizingCompileDispatcher();
40 41
41 void Run();
42 void Stop(); 42 void Stop();
43 void Flush(BlockingBehavior blocking_behavior); 43 void Flush(BlockingBehavior blocking_behavior);
44 // Takes ownership of |job|.
44 void QueueForOptimization(CompilationJob* job); 45 void QueueForOptimization(CompilationJob* job);
45 void Unblock(); 46 void Unblock();
46 void InstallOptimizedFunctions(); 47 void InstallOptimizedFunctions();
47 48
48 inline bool IsQueueAvailable() { 49 inline bool IsQueueAvailable() {
49 base::LockGuard<base::Mutex> access_input_queue(&input_queue_mutex_); 50 base::LockGuard<base::Mutex> access_input_queue(&input_queue_mutex_);
50 return input_queue_length_ < input_queue_capacity_; 51 return input_queue_length_ < input_queue_capacity_;
51 } 52 }
52 53
53 static bool Enabled() { return FLAG_concurrent_recompilation; } 54 static bool Enabled() { return FLAG_concurrent_recompilation; }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 // background thread. 96 // background thread.
96 // 97 //
97 // Since flags might get modified while the background thread is running, it 98 // Since flags might get modified while the background thread is running, it
98 // is not safe to access them directly. 99 // is not safe to access them directly.
99 int recompilation_delay_; 100 int recompilation_delay_;
100 }; 101 };
101 } // namespace internal 102 } // namespace internal
102 } // namespace v8 103 } // namespace v8
103 104
104 #endif // V8_COMPILER_DISPATCHER_OPTIMIZING_COMPILE_DISPATCHER_H_ 105 #endif // V8_COMPILER_DISPATCHER_OPTIMIZING_COMPILE_DISPATCHER_H_
OLDNEW
« no previous file with comments | « src/compiler.h ('k') | src/compiler-dispatcher/optimizing-compile-dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698