Index: runtime/vm/compiler.h |
diff --git a/runtime/vm/compiler.h b/runtime/vm/compiler.h |
index 9dc11b810541b2fa2ad60138e3752967a475021e..f31e00ac76d68087f82358f0ea1aa555a548e0a1 100644 |
--- a/runtime/vm/compiler.h |
+++ b/runtime/vm/compiler.h |
@@ -8,6 +8,7 @@ |
#include "vm/allocation.h" |
#include "vm/growable_array.h" |
#include "vm/runtime_entry.h" |
+#include "vm/thread_pool.h" |
namespace dart { |
@@ -99,6 +100,35 @@ class Compiler : public AllStatic { |
static bool allow_recompilation_; |
}; |
+ |
+// Class to run optimizing compilation in a background thread. |
+// Current implementation: one task per isolate, it dies with the owning |
+// isolate. |
+class BackgroundCompiler : public ThreadPool::Task { |
+ public: |
+ static void EnsureInit(Isolate* isolate); |
+ |
+ static void Stop(BackgroundCompiler* task); |
+ |
+ void CompileOptimized(const Function& function); |
+ |
+ private: |
+ explicit BackgroundCompiler(Isolate* isolate); |
+ |
+ virtual void Run(); |
+ |
+ void Add(const Function& f) const; |
+ RawFunction* RemoveOrNull() const; |
+ |
+ Isolate* isolate_; |
+ bool running_; |
+ bool* done_; |
+ Monitor* monitor_; |
+ Monitor* done_monitor_; |
+ |
+ DISALLOW_IMPLICIT_CONSTRUCTORS(BackgroundCompiler); |
+}; |
+ |
} // namespace dart |
#endif // VM_COMPILER_H_ |