Chromium Code Reviews| 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 450 GcPrologueCallbacks gc_prologue_callbacks_; | 459 GcPrologueCallbacks gc_prologue_callbacks_; |
| 451 GcEpilogueCallbacks gc_epilogue_callbacks_; | 460 GcEpilogueCallbacks gc_epilogue_callbacks_; |
| 452 | 461 |
| 453 // Deoptimization support. | 462 // Deoptimization support. |
| 454 intptr_t* deopt_cpu_registers_copy_; | 463 intptr_t* deopt_cpu_registers_copy_; |
| 455 fpu_register_t* deopt_fpu_registers_copy_; | 464 fpu_register_t* deopt_fpu_registers_copy_; |
| 456 intptr_t* deopt_frame_copy_; | 465 intptr_t* deopt_frame_copy_; |
| 457 intptr_t deopt_frame_copy_size_; | 466 intptr_t deopt_frame_copy_size_; |
| 458 DeferredObject* deferred_objects_; | 467 DeferredObject* deferred_objects_; |
| 459 | 468 |
| 469 // Status support. | |
| 470 char* stacktrace_; | |
| 471 intptr_t stack_frame_index_; | |
| 472 static bool FetchStacktrace(); | |
| 473 static bool FetchStackFrameDetails(); | |
| 474 char* GetStatusDetails(); | |
| 475 char* GetStatusStacktrace(); | |
| 476 char* GetStatusStackFrame(intptr_t index); | |
| 477 char* DoStacktraceInterrupt(Dart_IsolateInterruptCallback cb); | |
|
siva
2013/04/01 22:07:55
Normally we try to list all the functions first an
Tom Ball
2013/04/02 16:49:16
Moved functions up with the others.
| |
| 478 | |
| 460 static Dart_IsolateCreateCallback create_callback_; | 479 static Dart_IsolateCreateCallback create_callback_; |
| 461 static Dart_IsolateInterruptCallback interrupt_callback_; | 480 static Dart_IsolateInterruptCallback interrupt_callback_; |
| 462 static Dart_IsolateUnhandledExceptionCallback unhandled_exception_callback_; | 481 static Dart_IsolateUnhandledExceptionCallback unhandled_exception_callback_; |
| 463 static Dart_IsolateShutdownCallback shutdown_callback_; | 482 static Dart_IsolateShutdownCallback shutdown_callback_; |
| 464 static Dart_FileOpenCallback file_open_callback_; | 483 static Dart_FileOpenCallback file_open_callback_; |
| 465 static Dart_FileWriteCallback file_write_callback_; | 484 static Dart_FileWriteCallback file_write_callback_; |
| 466 static Dart_FileCloseCallback file_close_callback_; | 485 static Dart_FileCloseCallback file_close_callback_; |
| 486 static Dart_IsolateInterruptCallback vmstats_callback_; | |
| 467 | 487 |
| 468 DISALLOW_COPY_AND_ASSIGN(Isolate); | 488 DISALLOW_COPY_AND_ASSIGN(Isolate); |
| 469 }; | 489 }; |
| 470 | 490 |
| 471 // When we need to execute code in an isolate, we use the | 491 // When we need to execute code in an isolate, we use the |
| 472 // StartIsolateScope. | 492 // StartIsolateScope. |
| 473 class StartIsolateScope { | 493 class StartIsolateScope { |
| 474 public: | 494 public: |
| 475 explicit StartIsolateScope(Isolate* new_isolate) | 495 explicit StartIsolateScope(Isolate* new_isolate) |
| 476 : new_isolate_(new_isolate), saved_isolate_(Isolate::Current()) { | 496 : 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_; | 548 Isolate* new_isolate_; |
| 529 Isolate* saved_isolate_; | 549 Isolate* saved_isolate_; |
| 530 uword saved_stack_limit_; | 550 uword saved_stack_limit_; |
| 531 | 551 |
| 532 DISALLOW_COPY_AND_ASSIGN(SwitchIsolateScope); | 552 DISALLOW_COPY_AND_ASSIGN(SwitchIsolateScope); |
| 533 }; | 553 }; |
| 534 | 554 |
| 535 } // namespace dart | 555 } // namespace dart |
| 536 | 556 |
| 537 #endif // VM_ISOLATE_H_ | 557 #endif // VM_ISOLATE_H_ |
| OLD | NEW |