Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(876)

Side by Side Diff: runtime/vm/isolate.h

Issue 9182001: OOB messages and general message refactor. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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 kApiInterrupt = 0x1, // An interrupt from Dart_InterruptIsolate.
242 kApiInterrupt = 0x1, // An interrupt from Dart_InterruptIsolate. 236 kMessageInterrupt = 0x2, // An interrupt to process an out of band message.
243 // More interrupt types will go here. 237
238 kInterruptsMask = kApiInterrupt | kMessageInterrupt,
244 }; 239 };
245 240
246 void ScheduleInterrupts(uword interrupt_bits); 241 void ScheduleInterrupts(uword interrupt_bits);
247 uword GetAndClearInterrupts(); 242 uword GetAndClearInterrupts();
248 243
244 void PostMessage(Message* message);
245 void ClosePort(Dart_Port port);
246 void CloseAllPorts();
247
249 // Returns null on success, unhandled exception on failure. 248 // Returns null on success, unhandled exception on failure.
250 RawObject* StandardRunLoop(); 249 RawObject* StandardRunLoop();
251 250
252 intptr_t ast_node_id() const { return ast_node_id_; } 251 intptr_t ast_node_id() const { return ast_node_id_; }
253 void set_ast_node_id(int value) { ast_node_id_ = value; } 252 void set_ast_node_id(int value) { ast_node_id_ = value; }
254 253
255 Debugger* debugger() const { return debugger_; } 254 Debugger* debugger() const { return debugger_; }
256 255
257 static void SetCreateCallback(Dart_IsolateCreateCallback cback); 256 static void SetCreateCallback(Dart_IsolateCreateCallback cback);
258 static Dart_IsolateCreateCallback CreateCallback(); 257 static Dart_IsolateCreateCallback CreateCallback();
259 258
260 static void SetInterruptCallback(Dart_IsolateInterruptCallback cback); 259 static void SetInterruptCallback(Dart_IsolateInterruptCallback cback);
261 static Dart_IsolateInterruptCallback InterruptCallback(); 260 static Dart_IsolateInterruptCallback InterruptCallback();
262 261
263 private: 262 private:
264 Isolate(); 263 Isolate();
265 264
266 void PrintInvokedFunctions(); 265 void PrintInvokedFunctions();
267 266
268 static uword GetSpecifiedStackSize(); 267 static uword GetSpecifiedStackSize();
269 268
270 static const uword kStackSizeBuffer = (128 * KB); 269 static const uword kStackSizeBuffer = (128 * KB);
271 static const uword kDefaultStackSize = (1 * MB); 270 static const uword kDefaultStackSize = (1 * MB);
272 271
273 StoreBufferBlock store_buffer_; 272 StoreBufferBlock store_buffer_;
274 MessageQueue* message_queue_; 273 MessageQueue* message_queue_;
275 Dart_PostMessageCallback post_message_callback_; 274 Dart_MessageNotifyCallback message_notify_callback_;
276 Dart_ClosePortCallback close_port_callback_;
277 intptr_t num_ports_; 275 intptr_t num_ports_;
278 intptr_t live_ports_; 276 intptr_t live_ports_;
279 Dart_Port main_port_; 277 Dart_Port main_port_;
280 Heap* heap_; 278 Heap* heap_;
281 ObjectStore* object_store_; 279 ObjectStore* object_store_;
282 StackResource* top_resource_; 280 StackResource* top_resource_;
283 RawContext* top_context_; 281 RawContext* top_context_;
284 Zone* current_zone_; 282 Zone* current_zone_;
285 #if defined(DEBUG) 283 #if defined(DEBUG)
286 int32_t no_gc_scope_depth_; 284 int32_t no_gc_scope_depth_;
(...skipping 28 matching lines...) Expand all
315 #include "vm/isolate_linux.h" 313 #include "vm/isolate_linux.h"
316 #elif defined(TARGET_OS_MACOS) 314 #elif defined(TARGET_OS_MACOS)
317 #include "vm/isolate_macos.h" 315 #include "vm/isolate_macos.h"
318 #elif defined(TARGET_OS_WINDOWS) 316 #elif defined(TARGET_OS_WINDOWS)
319 #include "vm/isolate_win.h" 317 #include "vm/isolate_win.h"
320 #else 318 #else
321 #error Unknown target os. 319 #error Unknown target os.
322 #endif 320 #endif
323 321
324 #endif // VM_ISOLATE_H_ 322 #endif // VM_ISOLATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698