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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 | 162 |
163 static void Stop(BackgroundCompiler* task); | 163 static void Stop(BackgroundCompiler* task); |
164 | 164 |
165 // Call to optimize a function in the background, enters the function in the | 165 // Call to optimize a function in the background, enters the function in the |
166 // compilation queue. | 166 // compilation queue. |
167 void CompileOptimized(const Function& function); | 167 void CompileOptimized(const Function& function); |
168 | 168 |
169 void VisitPointers(ObjectPointerVisitor* visitor); | 169 void VisitPointers(ObjectPointerVisitor* visitor); |
170 | 170 |
171 BackgroundCompilationQueue* function_queue() const { return function_queue_; } | 171 BackgroundCompilationQueue* function_queue() const { return function_queue_; } |
| 172 bool is_running() const { return running_; } |
172 | 173 |
173 private: | 174 private: |
174 explicit BackgroundCompiler(Isolate* isolate); | 175 explicit BackgroundCompiler(Isolate* isolate); |
175 | 176 |
176 virtual void Run(); | 177 virtual void Run(); |
177 | 178 |
178 Isolate* isolate_; | 179 Isolate* isolate_; |
179 bool running_; // While true, will try to read queue and compile. | 180 bool running_; // While true, will try to read queue and compile. |
180 bool* done_; // True if the thread is done. | 181 bool* done_; // True if the thread is done. |
181 Monitor* queue_monitor_; // Controls access to the queue. | 182 Monitor* queue_monitor_; // Controls access to the queue. |
182 Monitor* done_monitor_; // Notify/wait that the thread is done. | 183 Monitor* done_monitor_; // Notify/wait that the thread is done. |
183 | 184 |
184 BackgroundCompilationQueue* function_queue_; | 185 BackgroundCompilationQueue* function_queue_; |
185 | 186 |
186 DISALLOW_IMPLICIT_CONSTRUCTORS(BackgroundCompiler); | 187 DISALLOW_IMPLICIT_CONSTRUCTORS(BackgroundCompiler); |
187 }; | 188 }; |
188 | 189 |
189 } // namespace dart | 190 } // namespace dart |
190 | 191 |
191 #endif // VM_COMPILER_H_ | 192 #endif // VM_COMPILER_H_ |
OLD | NEW |