OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef VM_COMPILER_H_ | 5 #ifndef VM_COMPILER_H_ |
6 #define VM_COMPILER_H_ | 6 #define VM_COMPILER_H_ |
7 | 7 |
8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
9 #include "vm/growable_array.h" | 9 #include "vm/growable_array.h" |
10 #include "vm/runtime_entry.h" | 10 #include "vm/runtime_entry.h" |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 | 166 |
167 // Call to activate/install optimized code (must occur in the mutator thread). | 167 // Call to activate/install optimized code (must occur in the mutator thread). |
168 void InstallGeneratedCode(); | 168 void InstallGeneratedCode(); |
169 | 169 |
170 // Access to queue length is guarded with queue_monitor_; | 170 // Access to queue length is guarded with queue_monitor_; |
171 intptr_t function_queue_length() const { return function_queue_length_; } | 171 intptr_t function_queue_length() const { return function_queue_length_; } |
172 void set_function_queue_length(intptr_t value) { | 172 void set_function_queue_length(intptr_t value) { |
173 function_queue_length_ = value; | 173 function_queue_length_ = value; |
174 } | 174 } |
175 | 175 |
| 176 void VisitPointers(ObjectPointerVisitor* visitor); |
| 177 |
176 private: | 178 private: |
177 explicit BackgroundCompiler(Isolate* isolate); | 179 explicit BackgroundCompiler(Isolate* isolate); |
178 | 180 |
| 181 void set_compilation_function_queue(const GrowableObjectArray& value); |
| 182 void set_compilation_result_queue(const GrowableObjectArray& value); |
| 183 |
179 GrowableObjectArray* FunctionsQueue() const; | 184 GrowableObjectArray* FunctionsQueue() const; |
180 GrowableObjectArray* ResultQueue() const; | 185 GrowableObjectArray* ResultQueue() const; |
181 | 186 |
182 virtual void Run(); | 187 virtual void Run(); |
183 | 188 |
184 void AddFunction(const Function& f); | 189 void AddFunction(const Function& f); |
185 RawFunction* RemoveFunctionOrNull(); | 190 RawFunction* RemoveFunctionOrNull(); |
186 RawFunction* LastFunctionOrNull() const; | 191 RawFunction* LastFunctionOrNull() const; |
187 | 192 |
188 void AddResult(const BackgroundCompilationResult& value); | 193 void AddResult(const BackgroundCompilationResult& value); |
189 | 194 |
190 Isolate* isolate_; | 195 Isolate* isolate_; |
191 bool running_; // While true, will try to read queue and compile. | 196 bool running_; // While true, will try to read queue and compile. |
192 bool* done_; // True if the thread is done. | 197 bool* done_; // True if the thread is done. |
193 Monitor* queue_monitor_; // Controls access to the queue. | 198 Monitor* queue_monitor_; // Controls access to the queue. |
194 Monitor* done_monitor_; // Notify/wait that the thread is done. | 199 Monitor* done_monitor_; // Notify/wait that the thread is done. |
195 | 200 |
196 // Lightweight access to length of compiler queue. | 201 // Lightweight access to length of compiler queue. |
197 intptr_t function_queue_length_; | 202 intptr_t function_queue_length_; |
198 | 203 |
| 204 RawGrowableObjectArray* compilation_function_queue_; |
| 205 RawGrowableObjectArray* compilation_result_queue_; |
| 206 |
199 DISALLOW_IMPLICIT_CONSTRUCTORS(BackgroundCompiler); | 207 DISALLOW_IMPLICIT_CONSTRUCTORS(BackgroundCompiler); |
200 }; | 208 }; |
201 | 209 |
202 } // namespace dart | 210 } // namespace dart |
203 | 211 |
204 #endif // VM_COMPILER_H_ | 212 #endif // VM_COMPILER_H_ |
OLD | NEW |