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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 static bool always_optimize_; | 99 static bool always_optimize_; |
100 static bool allow_recompilation_; | 100 static bool allow_recompilation_; |
101 }; | 101 }; |
102 | 102 |
103 | 103 |
104 // Class to run optimizing compilation in a background thread. | 104 // Class to run optimizing compilation in a background thread. |
105 // Current implementation: one task per isolate, it dies with the owning | 105 // Current implementation: one task per isolate, it dies with the owning |
106 // isolate. | 106 // isolate. |
107 class BackgroundCompiler : public ThreadPool::Task { | 107 class BackgroundCompiler : public ThreadPool::Task { |
108 public: | 108 public: |
109 static void EnsureInit(Isolate* isolate); | 109 static void EnsureInit(Thread* thread); |
110 | 110 |
111 static void Stop(BackgroundCompiler* task); | 111 static void Stop(BackgroundCompiler* task); |
112 | 112 |
113 void CompileOptimized(const Function& function); | 113 void CompileOptimized(const Function& function); |
114 | 114 |
115 private: | 115 private: |
116 explicit BackgroundCompiler(Isolate* isolate); | 116 explicit BackgroundCompiler(Isolate* isolate); |
117 | 117 |
118 virtual void Run(); | 118 virtual void Run(); |
119 | 119 |
120 void Add(const Function& f) const; | 120 void Add(const Function& f) const; |
121 RawFunction* RemoveOrNull() const; | 121 RawFunction* RemoveOrNull() const; |
122 | 122 |
123 Isolate* isolate_; | 123 Isolate* isolate_; |
124 bool running_; | 124 bool running_; |
125 bool* done_; | 125 bool* done_; |
126 Monitor* monitor_; | 126 Monitor* monitor_; |
127 Monitor* done_monitor_; | 127 Monitor* done_monitor_; |
128 | 128 |
129 DISALLOW_IMPLICIT_CONSTRUCTORS(BackgroundCompiler); | 129 DISALLOW_IMPLICIT_CONSTRUCTORS(BackgroundCompiler); |
130 }; | 130 }; |
131 | 131 |
132 } // namespace dart | 132 } // namespace dart |
133 | 133 |
134 #endif // VM_COMPILER_H_ | 134 #endif // VM_COMPILER_H_ |
OLD | NEW |