OLD | NEW |
---|---|
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 "vm/assert.h" | 9 #include "vm/assert.h" |
10 #include "vm/store_buffer.h" | 10 #include "vm/store_buffer.h" |
11 #include "vm/timer.h" | 11 #include "vm/timer.h" |
12 | 12 |
13 namespace dart { | 13 namespace dart { |
14 | 14 |
15 // Forward declarations. | 15 // Forward declarations. |
16 class ApiState; | 16 class ApiState; |
17 class BigintStore; | 17 class BigintStore; |
18 class CodeIndexTable; | 18 class CodeIndexTable; |
19 class Debugger; | 19 class Debugger; |
20 class HandleScope; | 20 class HandleScope; |
21 class Heap; | 21 class Heap; |
22 class LongJump; | 22 class LongJump; |
23 class Message; | |
23 class MessageQueue; | 24 class MessageQueue; |
24 class Mutex; | 25 class Mutex; |
25 class ObjectPointerVisitor; | 26 class ObjectPointerVisitor; |
26 class ObjectStore; | 27 class ObjectStore; |
27 class RawContext; | 28 class RawContext; |
28 class RawObject; | 29 class RawObject; |
29 class StackResource; | 30 class StackResource; |
30 class StubCode; | 31 class StubCode; |
31 class Zone; | 32 class Zone; |
32 | 33 |
(...skipping 11 matching lines...) Expand all Loading... | |
44 // Visit all object pointers. | 45 // Visit all object pointers. |
45 void VisitObjectPointers(ObjectPointerVisitor* visitor, bool validate_frames); | 46 void VisitObjectPointers(ObjectPointerVisitor* visitor, bool validate_frames); |
46 | 47 |
47 void VisitStrongObjectPointers(ObjectPointerVisitor* visitor, | 48 void VisitStrongObjectPointers(ObjectPointerVisitor* visitor, |
48 bool validate_frames); | 49 bool validate_frames); |
49 | 50 |
50 void VisitWeakObjectPointers(ObjectPointerVisitor* visitor); | 51 void VisitWeakObjectPointers(ObjectPointerVisitor* visitor); |
51 | 52 |
52 StoreBufferBlock* store_buffer() { return &store_buffer_; } | 53 StoreBufferBlock* store_buffer() { return &store_buffer_; } |
53 | 54 |
54 Dart_PostMessageCallback post_message_callback() const { | 55 Dart_MessageNotifyCallback message_notify_callback() const { |
55 return post_message_callback_; | 56 return message_notify_callback_; |
56 } | 57 } |
57 void set_post_message_callback(Dart_PostMessageCallback value) { | 58 void set_message_notify_callback(Dart_MessageNotifyCallback value) { |
58 post_message_callback_ = value; | 59 message_notify_callback_ = value; |
59 } | |
60 | |
61 Dart_ClosePortCallback close_port_callback() const { | |
62 return close_port_callback_; | |
63 } | |
64 void set_close_port_callback(Dart_ClosePortCallback value) { | |
65 close_port_callback_ = value; | |
66 } | 60 } |
67 | 61 |
68 MessageQueue* message_queue() const { return message_queue_; } | 62 MessageQueue* message_queue() const { return message_queue_; } |
69 void set_message_queue(MessageQueue* value) { message_queue_ = value; } | 63 void set_message_queue(MessageQueue* value) { message_queue_ = value; } |
70 | 64 |
71 // The number of ports is only correct when read from the current | 65 // The number of ports is only correct when read from the current |
72 // isolate. This value is not protected from being updated | 66 // isolate. This value is not protected from being updated |
73 // concurrently. | 67 // concurrently. |
74 intptr_t num_ports() const { return num_ports_; } | 68 intptr_t num_ports() const { return num_ports_; } |
75 void increment_num_ports() { | 69 void increment_num_ports() { |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
231 | 225 |
232 // The current stack limit. This may be overwritten with a special | 226 // The current stack limit. This may be overwritten with a special |
233 // value to trigger interrupts. | 227 // value to trigger interrupts. |
234 uword stack_limit() const { return stack_limit_; } | 228 uword stack_limit() const { return stack_limit_; } |
235 | 229 |
236 // The true stack limit for this isolate. This does not change | 230 // The true stack limit for this isolate. This does not change |
237 // after isolate initialization. | 231 // after isolate initialization. |
238 uword saved_stack_limit() const { return saved_stack_limit_; } | 232 uword saved_stack_limit() const { return saved_stack_limit_; } |
239 | 233 |
240 enum { | 234 enum { |
241 kInterruptsMask = 0x1, | 235 kInterruptsMask = 0x3, |
Anton Muhin
2012/01/12 12:58:16
maybe kInterruptsMask = kApiInterrupt | kMessageIn
turnidge
2012/01/12 19:01:55
Done.
| |
242 kApiInterrupt = 0x1, // An interrupt from Dart_InterruptIsolate. | 236 kApiInterrupt = 0x1, // An interrupt from Dart_InterruptIsolate. |
243 // More interrupt types will go here. | 237 kMessageInterrupt = 0x2, // An interrupt to process an out of band message. |
244 }; | 238 }; |
245 | 239 |
246 void ScheduleInterrupts(uword interrupt_bits); | 240 void ScheduleInterrupts(uword interrupt_bits); |
247 uword GetAndClearInterrupts(); | 241 uword GetAndClearInterrupts(); |
248 | 242 |
243 void PostMessage(Message* message); | |
244 void ClosePort(Dart_Port port); | |
245 void CloseAllPorts(); | |
246 | |
249 // Returns null on success, unhandled exception on failure. | 247 // Returns null on success, unhandled exception on failure. |
250 RawObject* StandardRunLoop(); | 248 RawObject* StandardRunLoop(); |
251 | 249 |
252 intptr_t ast_node_id() const { return ast_node_id_; } | 250 intptr_t ast_node_id() const { return ast_node_id_; } |
253 void set_ast_node_id(int value) { ast_node_id_ = value; } | 251 void set_ast_node_id(int value) { ast_node_id_ = value; } |
254 | 252 |
255 Debugger* debugger() const { return debugger_; } | 253 Debugger* debugger() const { return debugger_; } |
256 | 254 |
257 static void SetCreateCallback(Dart_IsolateCreateCallback cback); | 255 static void SetCreateCallback(Dart_IsolateCreateCallback cback); |
258 static Dart_IsolateCreateCallback CreateCallback(); | 256 static Dart_IsolateCreateCallback CreateCallback(); |
259 | 257 |
260 static void SetInterruptCallback(Dart_IsolateInterruptCallback cback); | 258 static void SetInterruptCallback(Dart_IsolateInterruptCallback cback); |
261 static Dart_IsolateInterruptCallback InterruptCallback(); | 259 static Dart_IsolateInterruptCallback InterruptCallback(); |
262 | 260 |
263 private: | 261 private: |
264 Isolate(); | 262 Isolate(); |
265 | 263 |
266 void PrintInvokedFunctions(); | 264 void PrintInvokedFunctions(); |
267 | 265 |
268 static uword GetSpecifiedStackSize(); | 266 static uword GetSpecifiedStackSize(); |
269 | 267 |
270 static const uword kStackSizeBuffer = (128 * KB); | 268 static const uword kStackSizeBuffer = (128 * KB); |
271 static const uword kDefaultStackSize = (1 * MB); | 269 static const uword kDefaultStackSize = (1 * MB); |
272 | 270 |
273 StoreBufferBlock store_buffer_; | 271 StoreBufferBlock store_buffer_; |
274 MessageQueue* message_queue_; | 272 MessageQueue* message_queue_; |
275 Dart_PostMessageCallback post_message_callback_; | 273 Dart_MessageNotifyCallback message_notify_callback_; |
276 Dart_ClosePortCallback close_port_callback_; | |
277 intptr_t num_ports_; | 274 intptr_t num_ports_; |
278 intptr_t live_ports_; | 275 intptr_t live_ports_; |
279 Dart_Port main_port_; | 276 Dart_Port main_port_; |
280 Heap* heap_; | 277 Heap* heap_; |
281 ObjectStore* object_store_; | 278 ObjectStore* object_store_; |
282 StackResource* top_resource_; | 279 StackResource* top_resource_; |
283 RawContext* top_context_; | 280 RawContext* top_context_; |
284 Zone* current_zone_; | 281 Zone* current_zone_; |
285 #if defined(DEBUG) | 282 #if defined(DEBUG) |
286 int32_t no_gc_scope_depth_; | 283 int32_t no_gc_scope_depth_; |
(...skipping 28 matching lines...) Expand all Loading... | |
315 #include "vm/isolate_linux.h" | 312 #include "vm/isolate_linux.h" |
316 #elif defined(TARGET_OS_MACOS) | 313 #elif defined(TARGET_OS_MACOS) |
317 #include "vm/isolate_macos.h" | 314 #include "vm/isolate_macos.h" |
318 #elif defined(TARGET_OS_WINDOWS) | 315 #elif defined(TARGET_OS_WINDOWS) |
319 #include "vm/isolate_win.h" | 316 #include "vm/isolate_win.h" |
320 #else | 317 #else |
321 #error Unknown target os. | 318 #error Unknown target os. |
322 #endif | 319 #endif |
323 | 320 |
324 #endif // VM_ISOLATE_H_ | 321 #endif // VM_ISOLATE_H_ |
OLD | NEW |