OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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/base_isolate.h" |
12 #include "vm/class_table.h" | 12 #include "vm/class_table.h" |
13 #include "vm/gc_callbacks.h" | 13 #include "vm/gc_callbacks.h" |
14 #include "vm/handles.h" | 14 #include "vm/handles.h" |
15 #include "vm/megamorphic_cache_table.h" | 15 #include "vm/megamorphic_cache_table.h" |
| 16 #include "vm/random.h" |
16 #include "vm/store_buffer.h" | 17 #include "vm/store_buffer.h" |
17 #include "vm/timer.h" | 18 #include "vm/timer.h" |
18 | 19 |
19 namespace dart { | 20 namespace dart { |
20 | 21 |
21 // Forward declarations. | 22 // Forward declarations. |
22 class AbstractType; | 23 class AbstractType; |
23 class ApiState; | 24 class ApiState; |
24 class Array; | 25 class Array; |
25 class Class; | 26 class Class; |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 Mutex* mutex() const { return mutex_; } | 267 Mutex* mutex() const { return mutex_; } |
267 | 268 |
268 Debugger* debugger() const { return debugger_; } | 269 Debugger* debugger() const { return debugger_; } |
269 | 270 |
270 void set_single_step(bool value) { single_step_ = value; } | 271 void set_single_step(bool value) { single_step_ = value; } |
271 bool single_step() const { return single_step_; } | 272 bool single_step() const { return single_step_; } |
272 static intptr_t single_step_offset() { | 273 static intptr_t single_step_offset() { |
273 return OFFSET_OF(Isolate, single_step_); | 274 return OFFSET_OF(Isolate, single_step_); |
274 } | 275 } |
275 | 276 |
| 277 Random* random() { return &random_; } |
| 278 |
276 Simulator* simulator() const { return simulator_; } | 279 Simulator* simulator() const { return simulator_; } |
277 void set_simulator(Simulator* value) { simulator_ = value; } | 280 void set_simulator(Simulator* value) { simulator_ = value; } |
278 | 281 |
279 GcPrologueCallbacks& gc_prologue_callbacks() { | 282 GcPrologueCallbacks& gc_prologue_callbacks() { |
280 return gc_prologue_callbacks_; | 283 return gc_prologue_callbacks_; |
281 } | 284 } |
282 | 285 |
283 GcEpilogueCallbacks& gc_epilogue_callbacks() { | 286 GcEpilogueCallbacks& gc_epilogue_callbacks() { |
284 return gc_epilogue_callbacks_; | 287 return gc_epilogue_callbacks_; |
285 } | 288 } |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 static Dart_FileReadCallback file_read_callback() { | 339 static Dart_FileReadCallback file_read_callback() { |
337 return file_read_callback_; | 340 return file_read_callback_; |
338 } | 341 } |
339 static Dart_FileWriteCallback file_write_callback() { | 342 static Dart_FileWriteCallback file_write_callback() { |
340 return file_write_callback_; | 343 return file_write_callback_; |
341 } | 344 } |
342 static Dart_FileCloseCallback file_close_callback() { | 345 static Dart_FileCloseCallback file_close_callback() { |
343 return file_close_callback_; | 346 return file_close_callback_; |
344 } | 347 } |
345 | 348 |
| 349 static void SetEntropySourceCallback(Dart_EntropySource entropy_source) { |
| 350 entropy_source_callback_ = entropy_source; |
| 351 } |
| 352 static Dart_EntropySource entropy_source_callback() { |
| 353 return entropy_source_callback_; |
| 354 } |
| 355 |
346 void set_object_id_ring(ObjectIdRing* ring) { | 356 void set_object_id_ring(ObjectIdRing* ring) { |
347 object_id_ring_ = ring; | 357 object_id_ring_ = ring; |
348 } | 358 } |
349 ObjectIdRing* object_id_ring() { | 359 ObjectIdRing* object_id_ring() { |
350 return object_id_ring_; | 360 return object_id_ring_; |
351 } | 361 } |
352 | 362 |
353 DeoptContext* deopt_context() const { return deopt_context_; } | 363 DeoptContext* deopt_context() const { return deopt_context_; } |
354 void set_deopt_context(DeoptContext* value) { | 364 void set_deopt_context(DeoptContext* value) { |
355 ASSERT(value == NULL || deopt_context_ == NULL); | 365 ASSERT(value == NULL || deopt_context_ == NULL); |
(...skipping 25 matching lines...) Expand all Loading... |
381 | 391 |
382 static bool FetchStacktrace(); | 392 static bool FetchStacktrace(); |
383 static bool FetchStackFrameDetails(); | 393 static bool FetchStackFrameDetails(); |
384 char* GetStatusDetails(); | 394 char* GetStatusDetails(); |
385 char* GetStatusStacktrace(); | 395 char* GetStatusStacktrace(); |
386 char* GetStatusStackFrame(intptr_t index); | 396 char* GetStatusStackFrame(intptr_t index); |
387 char* DoStacktraceInterrupt(Dart_IsolateInterruptCallback cb); | 397 char* DoStacktraceInterrupt(Dart_IsolateInterruptCallback cb); |
388 template<class T> T* AllocateReusableHandle(); | 398 template<class T> T* AllocateReusableHandle(); |
389 | 399 |
390 static ThreadLocalKey isolate_key; | 400 static ThreadLocalKey isolate_key; |
| 401 |
391 StoreBuffer store_buffer_; | 402 StoreBuffer store_buffer_; |
392 ClassTable class_table_; | 403 ClassTable class_table_; |
393 MegamorphicCacheTable megamorphic_cache_table_; | 404 MegamorphicCacheTable megamorphic_cache_table_; |
394 Dart_MessageNotifyCallback message_notify_callback_; | 405 Dart_MessageNotifyCallback message_notify_callback_; |
395 char* name_; | 406 char* name_; |
396 int64_t start_time_; | 407 int64_t start_time_; |
397 Dart_Port main_port_; | 408 Dart_Port main_port_; |
398 Heap* heap_; | 409 Heap* heap_; |
399 ObjectStore* object_store_; | 410 ObjectStore* object_store_; |
400 RawContext* top_context_; | 411 RawContext* top_context_; |
401 uword top_exit_frame_info_; | 412 uword top_exit_frame_info_; |
402 void* init_callback_data_; | 413 void* init_callback_data_; |
403 Dart_EnvironmentCallback environment_callback_; | 414 Dart_EnvironmentCallback environment_callback_; |
404 Dart_LibraryTagHandler library_tag_handler_; | 415 Dart_LibraryTagHandler library_tag_handler_; |
405 ApiState* api_state_; | 416 ApiState* api_state_; |
406 StubCode* stub_code_; | 417 StubCode* stub_code_; |
407 Debugger* debugger_; | 418 Debugger* debugger_; |
408 bool single_step_; | 419 bool single_step_; |
| 420 Random random_; |
409 Simulator* simulator_; | 421 Simulator* simulator_; |
410 LongJump* long_jump_base_; | 422 LongJump* long_jump_base_; |
411 TimerList timer_list_; | 423 TimerList timer_list_; |
412 intptr_t deopt_id_; | 424 intptr_t deopt_id_; |
413 Mutex* mutex_; // protects stack_limit_ and saved_stack_limit_. | 425 Mutex* mutex_; // protects stack_limit_ and saved_stack_limit_. |
414 uword stack_limit_; | 426 uword stack_limit_; |
415 uword saved_stack_limit_; | 427 uword saved_stack_limit_; |
416 MessageHandler* message_handler_; | 428 MessageHandler* message_handler_; |
417 uword spawn_data_; | 429 uword spawn_data_; |
418 bool is_runnable_; | 430 bool is_runnable_; |
(...skipping 19 matching lines...) Expand all Loading... |
438 VMHandles reusable_handles_; | 450 VMHandles reusable_handles_; |
439 | 451 |
440 static Dart_IsolateCreateCallback create_callback_; | 452 static Dart_IsolateCreateCallback create_callback_; |
441 static Dart_IsolateInterruptCallback interrupt_callback_; | 453 static Dart_IsolateInterruptCallback interrupt_callback_; |
442 static Dart_IsolateUnhandledExceptionCallback unhandled_exception_callback_; | 454 static Dart_IsolateUnhandledExceptionCallback unhandled_exception_callback_; |
443 static Dart_IsolateShutdownCallback shutdown_callback_; | 455 static Dart_IsolateShutdownCallback shutdown_callback_; |
444 static Dart_FileOpenCallback file_open_callback_; | 456 static Dart_FileOpenCallback file_open_callback_; |
445 static Dart_FileReadCallback file_read_callback_; | 457 static Dart_FileReadCallback file_read_callback_; |
446 static Dart_FileWriteCallback file_write_callback_; | 458 static Dart_FileWriteCallback file_write_callback_; |
447 static Dart_FileCloseCallback file_close_callback_; | 459 static Dart_FileCloseCallback file_close_callback_; |
| 460 static Dart_EntropySource entropy_source_callback_; |
448 static Dart_IsolateInterruptCallback vmstats_callback_; | 461 static Dart_IsolateInterruptCallback vmstats_callback_; |
449 | 462 |
450 friend class ReusableHandleScope; | 463 friend class ReusableHandleScope; |
451 friend class ReusableObjectHandleScope; | 464 friend class ReusableObjectHandleScope; |
452 DISALLOW_COPY_AND_ASSIGN(Isolate); | 465 DISALLOW_COPY_AND_ASSIGN(Isolate); |
453 }; | 466 }; |
454 | 467 |
455 | 468 |
456 // When we need to execute code in an isolate, we use the | 469 // When we need to execute code in an isolate, we use the |
457 // StartIsolateScope. | 470 // StartIsolateScope. |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 Isolate* isolate_; | 552 Isolate* isolate_; |
540 char* script_url_; | 553 char* script_url_; |
541 char* library_url_; | 554 char* library_url_; |
542 char* function_name_; | 555 char* function_name_; |
543 char* exception_callback_name_; | 556 char* exception_callback_name_; |
544 }; | 557 }; |
545 | 558 |
546 } // namespace dart | 559 } // namespace dart |
547 | 560 |
548 #endif // VM_ISOLATE_H_ | 561 #endif // VM_ISOLATE_H_ |
OLD | NEW |