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 "platform/thread.h" | 10 #include "platform/thread.h" |
| 11 #include "vm/base_isolate.h" |
11 #include "vm/gc_callbacks.h" | 12 #include "vm/gc_callbacks.h" |
12 #include "vm/store_buffer.h" | 13 #include "vm/store_buffer.h" |
13 #include "vm/timer.h" | 14 #include "vm/timer.h" |
14 | 15 |
15 namespace dart { | 16 namespace dart { |
16 | 17 |
17 // Forward declarations. | 18 // Forward declarations. |
18 class ApiState; | 19 class ApiState; |
19 class CodeIndexTable; | 20 class CodeIndexTable; |
20 class Debugger; | 21 class Debugger; |
21 class HandleScope; | 22 class HandleScope; |
22 class HandleVisitor; | 23 class HandleVisitor; |
23 class Heap; | 24 class Heap; |
24 class LongJump; | 25 class LongJump; |
25 class MessageHandler; | 26 class MessageHandler; |
26 class Mutex; | 27 class Mutex; |
27 class ObjectPointerVisitor; | 28 class ObjectPointerVisitor; |
28 class ObjectStore; | 29 class ObjectStore; |
29 class RawContext; | 30 class RawContext; |
30 class RawError; | 31 class RawError; |
31 class StackResource; | 32 class StackResource; |
32 class StubCode; | 33 class StubCode; |
33 class Zone; | 34 class Zone; |
34 | 35 |
35 | 36 |
36 class Isolate { | 37 class Isolate : public BaseIsolate { |
37 public: | 38 public: |
38 ~Isolate(); | 39 ~Isolate(); |
39 | 40 |
40 static inline Isolate* Current() { | 41 static inline Isolate* Current() { |
41 return reinterpret_cast<Isolate*>(Thread::GetThreadLocal(isolate_key)); | 42 return reinterpret_cast<Isolate*>(Thread::GetThreadLocal(isolate_key)); |
42 } | 43 } |
43 | 44 |
44 static void SetCurrent(Isolate* isolate); | 45 static void SetCurrent(Isolate* isolate); |
45 | 46 |
46 static void InitOnce(); | 47 static void InitOnce(); |
(...skipping 29 matching lines...) Expand all Loading... |
76 Heap* heap() const { return heap_; } | 77 Heap* heap() const { return heap_; } |
77 void set_heap(Heap* value) { heap_ = value; } | 78 void set_heap(Heap* value) { heap_ = value; } |
78 static intptr_t heap_offset() { return OFFSET_OF(Isolate, heap_); } | 79 static intptr_t heap_offset() { return OFFSET_OF(Isolate, heap_); } |
79 | 80 |
80 ObjectStore* object_store() const { return object_store_; } | 81 ObjectStore* object_store() const { return object_store_; } |
81 void set_object_store(ObjectStore* value) { object_store_ = value; } | 82 void set_object_store(ObjectStore* value) { object_store_ = value; } |
82 static intptr_t object_store_offset() { | 83 static intptr_t object_store_offset() { |
83 return OFFSET_OF(Isolate, object_store_); | 84 return OFFSET_OF(Isolate, object_store_); |
84 } | 85 } |
85 | 86 |
86 StackResource* top_resource() const { return top_resource_; } | |
87 void set_top_resource(StackResource* value) { top_resource_ = value; } | |
88 | |
89 RawContext* top_context() const { return top_context_; } | 87 RawContext* top_context() const { return top_context_; } |
90 void set_top_context(RawContext* value) { top_context_ = value; } | 88 void set_top_context(RawContext* value) { top_context_ = value; } |
91 static intptr_t top_context_offset() { | 89 static intptr_t top_context_offset() { |
92 return OFFSET_OF(Isolate, top_context_); | 90 return OFFSET_OF(Isolate, top_context_); |
93 } | 91 } |
94 | 92 |
95 int32_t random_seed() const { return random_seed_; } | 93 int32_t random_seed() const { return random_seed_; } |
96 void set_random_seed(int32_t value) { random_seed_ = value; } | 94 void set_random_seed(int32_t value) { random_seed_ = value; } |
97 | 95 |
98 uword top_exit_frame_info() const { return top_exit_frame_info_; } | 96 uword top_exit_frame_info() const { return top_exit_frame_info_; } |
(...skipping 11 matching lines...) Expand all Loading... |
110 CodeIndexTable* code_index_table() const { return code_index_table_; } | 108 CodeIndexTable* code_index_table() const { return code_index_table_; } |
111 void set_code_index_table(CodeIndexTable* value) { | 109 void set_code_index_table(CodeIndexTable* value) { |
112 code_index_table_ = value; | 110 code_index_table_ = value; |
113 } | 111 } |
114 | 112 |
115 LongJump* long_jump_base() const { return long_jump_base_; } | 113 LongJump* long_jump_base() const { return long_jump_base_; } |
116 void set_long_jump_base(LongJump* value) { long_jump_base_ = value; } | 114 void set_long_jump_base(LongJump* value) { long_jump_base_ = value; } |
117 | 115 |
118 TimerList& timer_list() { return timer_list_; } | 116 TimerList& timer_list() { return timer_list_; } |
119 | 117 |
120 Zone* current_zone() const { return current_zone_; } | |
121 void set_current_zone(Zone* zone) { current_zone_ = zone; } | |
122 static intptr_t current_zone_offset() { | 118 static intptr_t current_zone_offset() { |
123 return OFFSET_OF(Isolate, current_zone_); | 119 return OFFSET_OF(Isolate, current_zone_); |
124 } | 120 } |
125 | 121 |
126 int32_t no_gc_scope_depth() const { | 122 int32_t no_gc_scope_depth() const { |
127 #if defined(DEBUG) | 123 #if defined(DEBUG) |
128 return no_gc_scope_depth_; | 124 return no_gc_scope_depth_; |
129 #else | 125 #else |
130 return 0; | 126 return 0; |
131 #endif | 127 #endif |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 static const uword kStackSizeBuffer = (128 * KB); | 252 static const uword kStackSizeBuffer = (128 * KB); |
257 static const uword kDefaultStackSize = (1 * MB); | 253 static const uword kDefaultStackSize = (1 * MB); |
258 | 254 |
259 static ThreadLocalKey isolate_key; | 255 static ThreadLocalKey isolate_key; |
260 StoreBufferBlock store_buffer_; | 256 StoreBufferBlock store_buffer_; |
261 Dart_MessageNotifyCallback message_notify_callback_; | 257 Dart_MessageNotifyCallback message_notify_callback_; |
262 char* name_; | 258 char* name_; |
263 Dart_Port main_port_; | 259 Dart_Port main_port_; |
264 Heap* heap_; | 260 Heap* heap_; |
265 ObjectStore* object_store_; | 261 ObjectStore* object_store_; |
266 StackResource* top_resource_; | |
267 RawContext* top_context_; | 262 RawContext* top_context_; |
268 Zone* current_zone_; | |
269 #if defined(DEBUG) | 263 #if defined(DEBUG) |
270 int32_t no_gc_scope_depth_; | 264 int32_t no_gc_scope_depth_; |
271 int32_t no_handle_scope_depth_; | 265 int32_t no_handle_scope_depth_; |
272 HandleScope* top_handle_scope_; | 266 HandleScope* top_handle_scope_; |
273 #endif | 267 #endif |
274 int32_t random_seed_; | 268 int32_t random_seed_; |
275 uword top_exit_frame_info_; | 269 uword top_exit_frame_info_; |
276 void* init_callback_data_; | 270 void* init_callback_data_; |
277 Dart_LibraryTagHandler library_tag_handler_; | 271 Dart_LibraryTagHandler library_tag_handler_; |
278 ApiState* api_state_; | 272 ApiState* api_state_; |
(...skipping 12 matching lines...) Expand all Loading... |
291 | 285 |
292 static Dart_IsolateCreateCallback create_callback_; | 286 static Dart_IsolateCreateCallback create_callback_; |
293 static Dart_IsolateInterruptCallback interrupt_callback_; | 287 static Dart_IsolateInterruptCallback interrupt_callback_; |
294 | 288 |
295 DISALLOW_COPY_AND_ASSIGN(Isolate); | 289 DISALLOW_COPY_AND_ASSIGN(Isolate); |
296 }; | 290 }; |
297 | 291 |
298 } // namespace dart | 292 } // namespace dart |
299 | 293 |
300 #endif // VM_ISOLATE_H_ | 294 #endif // VM_ISOLATE_H_ |
OLD | NEW |