| 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" |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 uword saved_stack_limit() const { return saved_stack_limit_; } | 255 uword saved_stack_limit() const { return saved_stack_limit_; } |
| 256 | 256 |
| 257 static uword GetSpecifiedStackSize(); | 257 static uword GetSpecifiedStackSize(); |
| 258 | 258 |
| 259 static const intptr_t kStackSizeBuffer = (4 * KB * kWordSize); | 259 static const intptr_t kStackSizeBuffer = (4 * KB * kWordSize); |
| 260 | 260 |
| 261 enum { | 261 enum { |
| 262 kApiInterrupt = 0x1, // An interrupt from Dart_InterruptIsolate. | 262 kApiInterrupt = 0x1, // An interrupt from Dart_InterruptIsolate. |
| 263 kMessageInterrupt = 0x2, // An interrupt to process an out of band message. | 263 kMessageInterrupt = 0x2, // An interrupt to process an out of band message. |
| 264 kStoreBufferInterrupt = 0x4, // An interrupt to process the store buffer. | 264 kStoreBufferInterrupt = 0x4, // An interrupt to process the store buffer. |
| 265 kVmStatusInterrupt = 0x8, // An interrupt to process a status request. |
| 265 | 266 |
| 266 kInterruptsMask = | 267 kInterruptsMask = |
| 267 kApiInterrupt | | 268 kApiInterrupt | |
| 268 kMessageInterrupt | | 269 kMessageInterrupt | |
| 269 kStoreBufferInterrupt, | 270 kStoreBufferInterrupt | |
| 271 kVmStatusInterrupt, |
| 270 }; | 272 }; |
| 271 | 273 |
| 272 void ScheduleInterrupts(uword interrupt_bits); | 274 void ScheduleInterrupts(uword interrupt_bits); |
| 273 uword GetAndClearInterrupts(); | 275 uword GetAndClearInterrupts(); |
| 274 | 276 |
| 275 MessageHandler* message_handler() const { return message_handler_; } | 277 MessageHandler* message_handler() const { return message_handler_; } |
| 276 void set_message_handler(MessageHandler* value) { message_handler_ = value; } | 278 void set_message_handler(MessageHandler* value) { message_handler_ = value; } |
| 277 | 279 |
| 278 uword spawn_data() const { return spawn_data_; } | 280 uword spawn_data() const { return spawn_data_; } |
| 279 void set_spawn_data(uword value) { spawn_data_ = value; } | 281 void set_spawn_data(uword value) { spawn_data_ = value; } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 return create_callback_; | 315 return create_callback_; |
| 314 } | 316 } |
| 315 | 317 |
| 316 static void SetInterruptCallback(Dart_IsolateInterruptCallback cb) { | 318 static void SetInterruptCallback(Dart_IsolateInterruptCallback cb) { |
| 317 interrupt_callback_ = cb; | 319 interrupt_callback_ = cb; |
| 318 } | 320 } |
| 319 static Dart_IsolateInterruptCallback InterruptCallback() { | 321 static Dart_IsolateInterruptCallback InterruptCallback() { |
| 320 return interrupt_callback_; | 322 return interrupt_callback_; |
| 321 } | 323 } |
| 322 | 324 |
| 325 static void SetVmStatsCallback(Dart_IsolateInterruptCallback cb) { |
| 326 vmstats_callback_ = cb; |
| 327 } |
| 328 static Dart_IsolateInterruptCallback VmStatsCallback() { |
| 329 return vmstats_callback_; |
| 330 } |
| 331 |
| 323 static void SetUnhandledExceptionCallback( | 332 static void SetUnhandledExceptionCallback( |
| 324 Dart_IsolateUnhandledExceptionCallback cb) { | 333 Dart_IsolateUnhandledExceptionCallback cb) { |
| 325 unhandled_exception_callback_ = cb; | 334 unhandled_exception_callback_ = cb; |
| 326 } | 335 } |
| 327 static Dart_IsolateUnhandledExceptionCallback UnhandledExceptionCallback() { | 336 static Dart_IsolateUnhandledExceptionCallback UnhandledExceptionCallback() { |
| 328 return unhandled_exception_callback_; | 337 return unhandled_exception_callback_; |
| 329 } | 338 } |
| 330 | 339 |
| 331 static void SetShutdownCallback(Dart_IsolateShutdownCallback cb) { | 340 static void SetShutdownCallback(Dart_IsolateShutdownCallback cb) { |
| 332 shutdown_callback_ = cb; | 341 shutdown_callback_ = cb; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 } | 421 } |
| 413 | 422 |
| 414 static char* GetStatus(const char* request); | 423 static char* GetStatus(const char* request); |
| 415 | 424 |
| 416 private: | 425 private: |
| 417 Isolate(); | 426 Isolate(); |
| 418 | 427 |
| 419 void BuildName(const char* name_prefix); | 428 void BuildName(const char* name_prefix); |
| 420 void PrintInvokedFunctions(); | 429 void PrintInvokedFunctions(); |
| 421 | 430 |
| 431 static bool FetchStacktrace(); |
| 432 static bool FetchStackFrameDetails(); |
| 433 char* GetStatusDetails(); |
| 434 char* GetStatusStacktrace(); |
| 435 char* GetStatusStackFrame(intptr_t index); |
| 436 char* DoStacktraceInterrupt(Dart_IsolateInterruptCallback cb); |
| 437 |
| 422 static ThreadLocalKey isolate_key; | 438 static ThreadLocalKey isolate_key; |
| 423 StoreBufferBlock store_buffer_block_; | 439 StoreBufferBlock store_buffer_block_; |
| 424 StoreBuffer store_buffer_; | 440 StoreBuffer store_buffer_; |
| 425 ClassTable class_table_; | 441 ClassTable class_table_; |
| 426 MegamorphicCacheTable megamorphic_cache_table_; | 442 MegamorphicCacheTable megamorphic_cache_table_; |
| 427 Dart_MessageNotifyCallback message_notify_callback_; | 443 Dart_MessageNotifyCallback message_notify_callback_; |
| 428 char* name_; | 444 char* name_; |
| 429 int64_t start_time_; | 445 int64_t start_time_; |
| 430 Dart_Port main_port_; | 446 Dart_Port main_port_; |
| 431 Heap* heap_; | 447 Heap* heap_; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 450 GcPrologueCallbacks gc_prologue_callbacks_; | 466 GcPrologueCallbacks gc_prologue_callbacks_; |
| 451 GcEpilogueCallbacks gc_epilogue_callbacks_; | 467 GcEpilogueCallbacks gc_epilogue_callbacks_; |
| 452 | 468 |
| 453 // Deoptimization support. | 469 // Deoptimization support. |
| 454 intptr_t* deopt_cpu_registers_copy_; | 470 intptr_t* deopt_cpu_registers_copy_; |
| 455 fpu_register_t* deopt_fpu_registers_copy_; | 471 fpu_register_t* deopt_fpu_registers_copy_; |
| 456 intptr_t* deopt_frame_copy_; | 472 intptr_t* deopt_frame_copy_; |
| 457 intptr_t deopt_frame_copy_size_; | 473 intptr_t deopt_frame_copy_size_; |
| 458 DeferredObject* deferred_objects_; | 474 DeferredObject* deferred_objects_; |
| 459 | 475 |
| 476 // Status support. |
| 477 char* stacktrace_; |
| 478 intptr_t stack_frame_index_; |
| 479 |
| 460 static Dart_IsolateCreateCallback create_callback_; | 480 static Dart_IsolateCreateCallback create_callback_; |
| 461 static Dart_IsolateInterruptCallback interrupt_callback_; | 481 static Dart_IsolateInterruptCallback interrupt_callback_; |
| 462 static Dart_IsolateUnhandledExceptionCallback unhandled_exception_callback_; | 482 static Dart_IsolateUnhandledExceptionCallback unhandled_exception_callback_; |
| 463 static Dart_IsolateShutdownCallback shutdown_callback_; | 483 static Dart_IsolateShutdownCallback shutdown_callback_; |
| 464 static Dart_FileOpenCallback file_open_callback_; | 484 static Dart_FileOpenCallback file_open_callback_; |
| 465 static Dart_FileWriteCallback file_write_callback_; | 485 static Dart_FileWriteCallback file_write_callback_; |
| 466 static Dart_FileCloseCallback file_close_callback_; | 486 static Dart_FileCloseCallback file_close_callback_; |
| 487 static Dart_IsolateInterruptCallback vmstats_callback_; |
| 467 | 488 |
| 468 DISALLOW_COPY_AND_ASSIGN(Isolate); | 489 DISALLOW_COPY_AND_ASSIGN(Isolate); |
| 469 }; | 490 }; |
| 470 | 491 |
| 471 // When we need to execute code in an isolate, we use the | 492 // When we need to execute code in an isolate, we use the |
| 472 // StartIsolateScope. | 493 // StartIsolateScope. |
| 473 class StartIsolateScope { | 494 class StartIsolateScope { |
| 474 public: | 495 public: |
| 475 explicit StartIsolateScope(Isolate* new_isolate) | 496 explicit StartIsolateScope(Isolate* new_isolate) |
| 476 : new_isolate_(new_isolate), saved_isolate_(Isolate::Current()) { | 497 : new_isolate_(new_isolate), saved_isolate_(Isolate::Current()) { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 Isolate* new_isolate_; | 549 Isolate* new_isolate_; |
| 529 Isolate* saved_isolate_; | 550 Isolate* saved_isolate_; |
| 530 uword saved_stack_limit_; | 551 uword saved_stack_limit_; |
| 531 | 552 |
| 532 DISALLOW_COPY_AND_ASSIGN(SwitchIsolateScope); | 553 DISALLOW_COPY_AND_ASSIGN(SwitchIsolateScope); |
| 533 }; | 554 }; |
| 534 | 555 |
| 535 } // namespace dart | 556 } // namespace dart |
| 536 | 557 |
| 537 #endif // VM_ISOLATE_H_ | 558 #endif // VM_ISOLATE_H_ |
| OLD | NEW |