OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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_COMPILER_DISPATCHER_H_ | 5 #ifndef V8_COMPILER_DISPATCHER_COMPILER_DISPATCHER_H_ |
6 #define V8_COMPILER_DISPATCHER_COMPILER_DISPATCHER_H_ | 6 #define V8_COMPILER_DISPATCHER_COMPILER_DISPATCHER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <unordered_set> | 10 #include <unordered_set> |
(...skipping 10 matching lines...) Expand all Loading... |
21 namespace v8 { | 21 namespace v8 { |
22 | 22 |
23 class Platform; | 23 class Platform; |
24 enum class MemoryPressureLevel; | 24 enum class MemoryPressureLevel; |
25 | 25 |
26 namespace internal { | 26 namespace internal { |
27 | 27 |
28 class CancelableTaskManager; | 28 class CancelableTaskManager; |
29 class CompilerDispatcherJob; | 29 class CompilerDispatcherJob; |
30 class CompilerDispatcherTracer; | 30 class CompilerDispatcherTracer; |
| 31 class DeferredHandles; |
31 class FunctionLiteral; | 32 class FunctionLiteral; |
32 class Isolate; | 33 class Isolate; |
33 class SharedFunctionInfo; | 34 class SharedFunctionInfo; |
| 35 class Zone; |
34 | 36 |
35 template <typename T> | 37 template <typename T> |
36 class Handle; | 38 class Handle; |
37 | 39 |
38 // The CompilerDispatcher uses a combination of idle tasks and background tasks | 40 // The CompilerDispatcher uses a combination of idle tasks and background tasks |
39 // to parse and compile lazily parsed functions. | 41 // to parse and compile lazily parsed functions. |
40 // | 42 // |
41 // As both parsing and compilation currently requires a preparation and | 43 // As both parsing and compilation currently requires a preparation and |
42 // finalization step that happens on the main thread, every task has to be | 44 // finalization step that happens on the main thread, every task has to be |
43 // advanced during idle time first. Depending on the properties of the task, it | 45 // advanced during idle time first. Depending on the properties of the task, it |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 // Enqueue a job for parse and compile. Returns true if a job was enqueued. | 77 // Enqueue a job for parse and compile. Returns true if a job was enqueued. |
76 bool Enqueue(Handle<SharedFunctionInfo> function); | 78 bool Enqueue(Handle<SharedFunctionInfo> function); |
77 | 79 |
78 // Like Enqueue, but also advances the job so that it can potentially | 80 // Like Enqueue, but also advances the job so that it can potentially |
79 // continue running on a background thread (if at all possible). Returns | 81 // continue running on a background thread (if at all possible). Returns |
80 // true if the job was enqueued. | 82 // true if the job was enqueued. |
81 bool EnqueueAndStep(Handle<SharedFunctionInfo> function); | 83 bool EnqueueAndStep(Handle<SharedFunctionInfo> function); |
82 | 84 |
83 // Enqueue a job for compilation. Function must have already been parsed and | 85 // Enqueue a job for compilation. Function must have already been parsed and |
84 // analyzed and be ready for compilation. Returns true if a job was enqueued. | 86 // analyzed and be ready for compilation. Returns true if a job was enqueued. |
85 bool Enqueue(Handle<SharedFunctionInfo> function, FunctionLiteral* literal); | 87 bool Enqueue(Handle<SharedFunctionInfo> function, FunctionLiteral* literal, |
| 88 std::shared_ptr<Zone> parse_zone, |
| 89 std::shared_ptr<DeferredHandles> parse_handles, |
| 90 std::shared_ptr<DeferredHandles> compile_handles); |
86 | 91 |
87 // Like Enqueue, but also advances the job so that it can potentially | 92 // Like Enqueue, but also advances the job so that it can potentially |
88 // continue running on a background thread (if at all possible). Returns | 93 // continue running on a background thread (if at all possible). Returns |
89 // true if the job was enqueued. | 94 // true if the job was enqueued. |
90 bool EnqueueAndStep(Handle<SharedFunctionInfo> function, | 95 bool EnqueueAndStep(Handle<SharedFunctionInfo> function, |
91 FunctionLiteral* literal); | 96 FunctionLiteral* literal, |
| 97 std::shared_ptr<Zone> parse_zone, |
| 98 std::shared_ptr<DeferredHandles> parse_handles, |
| 99 std::shared_ptr<DeferredHandles> compile_handles); |
92 | 100 |
93 // Returns true if there is a pending job for the given function. | 101 // Returns true if there is a pending job for the given function. |
94 bool IsEnqueued(Handle<SharedFunctionInfo> function) const; | 102 bool IsEnqueued(Handle<SharedFunctionInfo> function) const; |
95 | 103 |
96 // Blocks until the given function is compiled (and does so as fast as | 104 // Blocks until the given function is compiled (and does so as fast as |
97 // possible). Returns true if the compile job was successful. | 105 // possible). Returns true if the compile job was successful. |
98 bool FinishNow(Handle<SharedFunctionInfo> function); | 106 bool FinishNow(Handle<SharedFunctionInfo> function); |
99 | 107 |
100 // Blocks until all enqueued jobs have finished. Returns true if all the | 108 // Blocks until all enqueued jobs have finished. Returns true if all the |
101 // compile jobs were successful. | 109 // compile jobs were successful. |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 base::AtomicValue<bool> block_for_testing_; | 195 base::AtomicValue<bool> block_for_testing_; |
188 base::Semaphore semaphore_for_testing_; | 196 base::Semaphore semaphore_for_testing_; |
189 | 197 |
190 DISALLOW_COPY_AND_ASSIGN(CompilerDispatcher); | 198 DISALLOW_COPY_AND_ASSIGN(CompilerDispatcher); |
191 }; | 199 }; |
192 | 200 |
193 } // namespace internal | 201 } // namespace internal |
194 } // namespace v8 | 202 } // namespace v8 |
195 | 203 |
196 #endif // V8_COMPILER_DISPATCHER_COMPILER_DISPATCHER_H_ | 204 #endif // V8_COMPILER_DISPATCHER_COMPILER_DISPATCHER_H_ |
OLD | NEW |