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_ISOLATE_H_ | 5 #ifndef VM_ISOLATE_H_ |
6 #define VM_ISOLATE_H_ | 6 #define VM_ISOLATE_H_ |
7 | 7 |
8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
10 #include "vm/class_table.h" | 10 #include "vm/class_table.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 class LongJump; | 26 class LongJump; |
27 class MessageHandler; | 27 class MessageHandler; |
28 class Mutex; | 28 class Mutex; |
29 class ObjectPointerVisitor; | 29 class ObjectPointerVisitor; |
30 class ObjectStore; | 30 class ObjectStore; |
31 class RawArray; | 31 class RawArray; |
32 class RawContext; | 32 class RawContext; |
33 class RawError; | 33 class RawError; |
34 class StackResource; | 34 class StackResource; |
35 class StubCode; | 35 class StubCode; |
| 36 class Symbols; |
36 class Zone; | 37 class Zone; |
37 | 38 |
38 class Isolate : public BaseIsolate { | 39 class Isolate : public BaseIsolate { |
39 public: | 40 public: |
40 ~Isolate(); | 41 ~Isolate(); |
41 | 42 |
42 static inline Isolate* Current() { | 43 static inline Isolate* Current() { |
43 return reinterpret_cast<Isolate*>(Thread::GetThreadLocal(isolate_key)); | 44 return reinterpret_cast<Isolate*>(Thread::GetThreadLocal(isolate_key)); |
44 } | 45 } |
45 | 46 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 void set_ast_node_id(int value) { ast_node_id_ = value; } | 175 void set_ast_node_id(int value) { ast_node_id_ = value; } |
175 | 176 |
176 intptr_t computation_id() const { return computation_id_; } | 177 intptr_t computation_id() const { return computation_id_; } |
177 void set_computation_id(int value) { computation_id_ = value; } | 178 void set_computation_id(int value) { computation_id_ = value; } |
178 | 179 |
179 RawArray* ic_data_array() const { return ic_data_array_; } | 180 RawArray* ic_data_array() const { return ic_data_array_; } |
180 void set_ic_data_array(RawArray* value) { ic_data_array_ = value; } | 181 void set_ic_data_array(RawArray* value) { ic_data_array_ = value; } |
181 | 182 |
182 Debugger* debugger() const { return debugger_; } | 183 Debugger* debugger() const { return debugger_; } |
183 | 184 |
| 185 GcPrologueCallbacks& gc_prologue_callbacks() { |
| 186 return gc_prologue_callbacks_; |
| 187 } |
| 188 |
| 189 GcEpilogueCallbacks& gc_epilogue_callbacks() { |
| 190 return gc_epilogue_callbacks_; |
| 191 } |
| 192 |
| 193 Symbols* symbols() const { return symbols_; } |
| 194 void set_symbols(Symbols* value) { symbols_ = value; } |
| 195 |
184 static void SetCreateCallback(Dart_IsolateCreateCallback cb) { | 196 static void SetCreateCallback(Dart_IsolateCreateCallback cb) { |
185 create_callback_ = cb; | 197 create_callback_ = cb; |
186 } | 198 } |
187 static Dart_IsolateCreateCallback CreateCallback() { | 199 static Dart_IsolateCreateCallback CreateCallback() { |
188 return create_callback_; | 200 return create_callback_; |
189 } | 201 } |
190 | 202 |
191 static void SetInterruptCallback(Dart_IsolateInterruptCallback cb) { | 203 static void SetInterruptCallback(Dart_IsolateInterruptCallback cb) { |
192 interrupt_callback_ = cb; | 204 interrupt_callback_ = cb; |
193 } | 205 } |
194 static Dart_IsolateInterruptCallback InterruptCallback() { | 206 static Dart_IsolateInterruptCallback InterruptCallback() { |
195 return interrupt_callback_; | 207 return interrupt_callback_; |
196 } | 208 } |
197 | 209 |
198 static void SetShutdownCallback(Dart_IsolateShutdownCallback cb) { | 210 static void SetShutdownCallback(Dart_IsolateShutdownCallback cb) { |
199 shutdown_callback_ = cb; | 211 shutdown_callback_ = cb; |
200 } | 212 } |
201 static Dart_IsolateShutdownCallback ShutdownCallback() { | 213 static Dart_IsolateShutdownCallback ShutdownCallback() { |
202 return shutdown_callback_; | 214 return shutdown_callback_; |
203 } | 215 } |
204 | 216 |
205 GcPrologueCallbacks& gc_prologue_callbacks() { | |
206 return gc_prologue_callbacks_; | |
207 } | |
208 | |
209 GcEpilogueCallbacks& gc_epilogue_callbacks() { | |
210 return gc_epilogue_callbacks_; | |
211 } | |
212 | |
213 private: | 217 private: |
214 Isolate(); | 218 Isolate(); |
215 | 219 |
216 void BuildName(const char* name_prefix); | 220 void BuildName(const char* name_prefix); |
217 void PrintInvokedFunctions(); | 221 void PrintInvokedFunctions(); |
218 | 222 |
219 static uword GetSpecifiedStackSize(); | 223 static uword GetSpecifiedStackSize(); |
220 | 224 |
221 static const intptr_t kStackSizeBuffer = (16 * KB); | 225 static const intptr_t kStackSizeBuffer = (16 * KB); |
222 | 226 |
(...skipping 19 matching lines...) Expand all Loading... |
242 intptr_t ast_node_id_; // Deprecate. | 246 intptr_t ast_node_id_; // Deprecate. |
243 intptr_t computation_id_; | 247 intptr_t computation_id_; |
244 RawArray* ic_data_array_; | 248 RawArray* ic_data_array_; |
245 Mutex* mutex_; // protects stack_limit_ and saved_stack_limit_. | 249 Mutex* mutex_; // protects stack_limit_ and saved_stack_limit_. |
246 uword stack_limit_; | 250 uword stack_limit_; |
247 uword saved_stack_limit_; | 251 uword saved_stack_limit_; |
248 MessageHandler* message_handler_; | 252 MessageHandler* message_handler_; |
249 uword spawn_data_; | 253 uword spawn_data_; |
250 GcPrologueCallbacks gc_prologue_callbacks_; | 254 GcPrologueCallbacks gc_prologue_callbacks_; |
251 GcEpilogueCallbacks gc_epilogue_callbacks_; | 255 GcEpilogueCallbacks gc_epilogue_callbacks_; |
| 256 Symbols* symbols_; |
252 | 257 |
253 static Dart_IsolateCreateCallback create_callback_; | 258 static Dart_IsolateCreateCallback create_callback_; |
254 static Dart_IsolateInterruptCallback interrupt_callback_; | 259 static Dart_IsolateInterruptCallback interrupt_callback_; |
255 static Dart_IsolateShutdownCallback shutdown_callback_; | 260 static Dart_IsolateShutdownCallback shutdown_callback_; |
256 | 261 |
257 DISALLOW_COPY_AND_ASSIGN(Isolate); | 262 DISALLOW_COPY_AND_ASSIGN(Isolate); |
258 }; | 263 }; |
259 | 264 |
260 // When we need to execute code in an isolate, we use the | 265 // When we need to execute code in an isolate, we use the |
261 // StartIsolateScope. | 266 // StartIsolateScope. |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 Isolate* new_isolate_; | 322 Isolate* new_isolate_; |
318 Isolate* saved_isolate_; | 323 Isolate* saved_isolate_; |
319 uword saved_stack_limit_; | 324 uword saved_stack_limit_; |
320 | 325 |
321 DISALLOW_COPY_AND_ASSIGN(SwitchIsolateScope); | 326 DISALLOW_COPY_AND_ASSIGN(SwitchIsolateScope); |
322 }; | 327 }; |
323 | 328 |
324 } // namespace dart | 329 } // namespace dart |
325 | 330 |
326 #endif // VM_ISOLATE_H_ | 331 #endif // VM_ISOLATE_H_ |
OLD | NEW |