| 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 // Class to run optimizing compilation in a background thread. | 154 // Class to run optimizing compilation in a background thread. |
| 155 // Current implementation: one task per isolate, it dies with the owning | 155 // Current implementation: one task per isolate, it dies with the owning |
| 156 // isolate. | 156 // isolate. |
| 157 // No OSR compilation in the background compiler. | 157 // No OSR compilation in the background compiler. |
| 158 class BackgroundCompiler : public ThreadPool::Task { | 158 class BackgroundCompiler : public ThreadPool::Task { |
| 159 public: | 159 public: |
| 160 virtual ~BackgroundCompiler(); | 160 virtual ~BackgroundCompiler(); |
| 161 | 161 |
| 162 static void EnsureInit(Thread* thread); | 162 static void EnsureInit(Thread* thread); |
| 163 | 163 |
| 164 static void Stop(BackgroundCompiler* task); | 164 // Stops background compiler of the given isolate. |
| 165 static void Stop(Isolate* isolate); |
| 165 | 166 |
| 166 // Call to optimize a function in the background, enters the function in the | 167 // Call to optimize a function in the background, enters the function in the |
| 167 // compilation queue. | 168 // compilation queue. |
| 168 void CompileOptimized(const Function& function); | 169 void CompileOptimized(const Function& function); |
| 169 | 170 |
| 170 void VisitPointers(ObjectPointerVisitor* visitor); | 171 void VisitPointers(ObjectPointerVisitor* visitor); |
| 171 | 172 |
| 172 BackgroundCompilationQueue* function_queue() const { return function_queue_; } | 173 BackgroundCompilationQueue* function_queue() const { return function_queue_; } |
| 173 bool is_running() const { return running_; } | 174 bool is_running() const { return running_; } |
| 174 | 175 |
| 175 private: | 176 private: |
| 176 explicit BackgroundCompiler(Isolate* isolate); | 177 explicit BackgroundCompiler(Isolate* isolate); |
| 177 | 178 |
| 178 virtual void Run(); | 179 virtual void Run(); |
| 179 | 180 |
| 180 Isolate* isolate_; | 181 Isolate* isolate_; |
| 181 bool running_; // While true, will try to read queue and compile. | 182 bool running_; // While true, will try to read queue and compile. |
| 182 bool* done_; // True if the thread is done. | 183 bool* done_; // True if the thread is done. |
| 183 Monitor* queue_monitor_; // Controls access to the queue. | 184 Monitor* queue_monitor_; // Controls access to the queue. |
| 184 Monitor* done_monitor_; // Notify/wait that the thread is done. | 185 Monitor* done_monitor_; // Notify/wait that the thread is done. |
| 185 | 186 |
| 186 BackgroundCompilationQueue* function_queue_; | 187 BackgroundCompilationQueue* function_queue_; |
| 187 | 188 |
| 188 DISALLOW_IMPLICIT_CONSTRUCTORS(BackgroundCompiler); | 189 DISALLOW_IMPLICIT_CONSTRUCTORS(BackgroundCompiler); |
| 189 }; | 190 }; |
| 190 | 191 |
| 191 } // namespace dart | 192 } // namespace dart |
| 192 | 193 |
| 193 #endif // VM_COMPILER_H_ | 194 #endif // VM_COMPILER_H_ |
| OLD | NEW |