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 <limits.h> | 8 #include <limits.h> |
9 | 9 |
10 #include "include/dart_api.h" | 10 #include "include/dart_api.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 Dart_ClosePortCallback close_port_callback() const { | 56 Dart_ClosePortCallback close_port_callback() const { |
57 return close_port_callback_; | 57 return close_port_callback_; |
58 } | 58 } |
59 void set_close_port_callback(Dart_ClosePortCallback value) { | 59 void set_close_port_callback(Dart_ClosePortCallback value) { |
60 close_port_callback_ = value; | 60 close_port_callback_ = value; |
61 } | 61 } |
62 | 62 |
63 MessageQueue* message_queue() const { return message_queue_; } | 63 MessageQueue* message_queue() const { return message_queue_; } |
64 void set_message_queue(MessageQueue* value) { message_queue_ = value; } | 64 void set_message_queue(MessageQueue* value) { message_queue_ = value; } |
65 | 65 |
66 // The count of active ports is only correct when read from the current | 66 // The number of ports is only correct when read from the current |
67 // isolate. This value is not protected from being updated concurrently. | 67 // isolate. This value is not protected from being updated |
68 intptr_t active_ports() const { return active_ports_; } | 68 // concurrently. |
69 void increment_active_ports() { | 69 intptr_t num_ports() const { return num_ports_; } |
| 70 void increment_num_ports() { |
70 ASSERT(this == Isolate::Current()); | 71 ASSERT(this == Isolate::Current()); |
71 active_ports_++; | 72 num_ports_++; |
72 } | 73 } |
73 void decrement_active_ports() { | 74 void decrement_num_ports() { |
74 ASSERT(this == Isolate::Current()); | 75 ASSERT(this == Isolate::Current()); |
75 active_ports_--; | 76 num_ports_--; |
| 77 } |
| 78 |
| 79 intptr_t live_ports() const { return live_ports_; } |
| 80 void increment_live_ports() { |
| 81 ASSERT(this == Isolate::Current()); |
| 82 live_ports_++; |
| 83 } |
| 84 void decrement_live_ports() { |
| 85 ASSERT(this == Isolate::Current()); |
| 86 live_ports_--; |
| 87 } |
| 88 |
| 89 Dart_Port main_port() { return main_port_; } |
| 90 void set_main_port(Dart_Port port) { |
| 91 ASSERT(main_port_ == 0); // Only set main port once. |
| 92 main_port_ = port; |
76 } | 93 } |
77 | 94 |
78 Heap* heap() const { return heap_; } | 95 Heap* heap() const { return heap_; } |
79 void set_heap(Heap* value) { heap_ = value; } | 96 void set_heap(Heap* value) { heap_ = value; } |
80 static intptr_t heap_offset() { return OFFSET_OF(Isolate, heap_); } | 97 static intptr_t heap_offset() { return OFFSET_OF(Isolate, heap_); } |
81 | 98 |
82 ObjectStore* object_store() const { return object_store_; } | 99 ObjectStore* object_store() const { return object_store_; } |
83 void set_object_store(ObjectStore* value) { object_store_ = value; } | 100 void set_object_store(ObjectStore* value) { object_store_ = value; } |
84 static intptr_t object_store_offset() { | 101 static intptr_t object_store_offset() { |
85 return OFFSET_OF(Isolate, object_store_); | 102 return OFFSET_OF(Isolate, object_store_); |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 static uword GetSpecifiedStackSize(); | 250 static uword GetSpecifiedStackSize(); |
234 | 251 |
235 static const uword kStackSizeBuffer = (128 * KB); | 252 static const uword kStackSizeBuffer = (128 * KB); |
236 static const uword kDefaultStackSize = (1 * MB); | 253 static const uword kDefaultStackSize = (1 * MB); |
237 | 254 |
238 StoreBufferBlock store_buffer_; | 255 StoreBufferBlock store_buffer_; |
239 Monitor* monitor_; | 256 Monitor* monitor_; |
240 MessageQueue* message_queue_; | 257 MessageQueue* message_queue_; |
241 Dart_PostMessageCallback post_message_callback_; | 258 Dart_PostMessageCallback post_message_callback_; |
242 Dart_ClosePortCallback close_port_callback_; | 259 Dart_ClosePortCallback close_port_callback_; |
243 intptr_t active_ports_; | 260 intptr_t num_ports_; |
| 261 intptr_t live_ports_; |
| 262 Dart_Port main_port_; |
244 Heap* heap_; | 263 Heap* heap_; |
245 ObjectStore* object_store_; | 264 ObjectStore* object_store_; |
246 StackResource* top_resource_; | 265 StackResource* top_resource_; |
247 RawContext* top_context_; | 266 RawContext* top_context_; |
248 Zone* current_zone_; | 267 Zone* current_zone_; |
249 #if defined(DEBUG) | 268 #if defined(DEBUG) |
250 int32_t no_gc_scope_depth_; | 269 int32_t no_gc_scope_depth_; |
251 int32_t no_handle_scope_depth_; | 270 int32_t no_handle_scope_depth_; |
252 HandleScope* top_handle_scope_; | 271 HandleScope* top_handle_scope_; |
253 #endif | 272 #endif |
(...skipping 22 matching lines...) Expand all Loading... |
276 #include "vm/isolate_linux.h" | 295 #include "vm/isolate_linux.h" |
277 #elif defined(TARGET_OS_MACOS) | 296 #elif defined(TARGET_OS_MACOS) |
278 #include "vm/isolate_macos.h" | 297 #include "vm/isolate_macos.h" |
279 #elif defined(TARGET_OS_WINDOWS) | 298 #elif defined(TARGET_OS_WINDOWS) |
280 #include "vm/isolate_win.h" | 299 #include "vm/isolate_win.h" |
281 #else | 300 #else |
282 #error Unknown target os. | 301 #error Unknown target os. |
283 #endif | 302 #endif |
284 | 303 |
285 #endif // VM_ISOLATE_H_ | 304 #endif // VM_ISOLATE_H_ |
OLD | NEW |