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/megamorphic_cache_table.h" | 14 #include "vm/megamorphic_cache_table.h" |
15 #include "vm/store_buffer.h" | 15 #include "vm/store_buffer.h" |
16 #include "vm/timer.h" | 16 #include "vm/timer.h" |
17 | 17 |
18 namespace dart { | 18 namespace dart { |
19 | 19 |
20 // Forward declarations. | 20 // Forward declarations. |
21 class ApiState; | 21 class ApiState; |
22 class CodeIndexTable; | 22 class CodeIndexTable; |
23 class Debugger; | 23 class Debugger; |
| 24 class Function; |
24 class HandleScope; | 25 class HandleScope; |
25 class HandleVisitor; | 26 class HandleVisitor; |
26 class Heap; | 27 class Heap; |
27 class ICData; | 28 class ICData; |
28 class LongJump; | 29 class LongJump; |
29 class MessageHandler; | 30 class MessageHandler; |
30 class Mutex; | 31 class Mutex; |
31 class ObjectPointerVisitor; | 32 class ObjectPointerVisitor; |
32 class ObjectStore; | 33 class ObjectStore; |
33 class RawInstance; | 34 class RawInstance; |
34 class RawArray; | 35 class RawArray; |
35 class RawContext; | 36 class RawContext; |
36 class RawDouble; | 37 class RawDouble; |
37 class RawMint; | 38 class RawMint; |
| 39 class RawObject; |
38 class RawInteger; | 40 class RawInteger; |
39 class RawError; | 41 class RawError; |
40 class Simulator; | 42 class Simulator; |
41 class StackResource; | 43 class StackResource; |
42 class StackZone; | 44 class StackZone; |
43 class StubCode; | 45 class StubCode; |
44 class RawFloat32x4; | 46 class RawFloat32x4; |
45 class RawUint32x4; | 47 class RawUint32x4; |
46 | 48 |
47 | 49 |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 kInterruptsMask = | 269 kInterruptsMask = |
268 kApiInterrupt | | 270 kApiInterrupt | |
269 kMessageInterrupt | | 271 kMessageInterrupt | |
270 kStoreBufferInterrupt | | 272 kStoreBufferInterrupt | |
271 kVmStatusInterrupt, | 273 kVmStatusInterrupt, |
272 }; | 274 }; |
273 | 275 |
274 void ScheduleInterrupts(uword interrupt_bits); | 276 void ScheduleInterrupts(uword interrupt_bits); |
275 uword GetAndClearInterrupts(); | 277 uword GetAndClearInterrupts(); |
276 | 278 |
| 279 bool MakeRunnable(); |
| 280 void Run(); |
| 281 |
277 MessageHandler* message_handler() const { return message_handler_; } | 282 MessageHandler* message_handler() const { return message_handler_; } |
278 void set_message_handler(MessageHandler* value) { message_handler_ = value; } | 283 void set_message_handler(MessageHandler* value) { message_handler_ = value; } |
279 | 284 |
| 285 bool is_runnable() const { return is_runnable_; } |
| 286 void set_is_runnable(bool value) { is_runnable_ = value; } |
| 287 |
280 uword spawn_data() const { return spawn_data_; } | 288 uword spawn_data() const { return spawn_data_; } |
281 void set_spawn_data(uword value) { spawn_data_ = value; } | 289 void set_spawn_data(uword value) { |
| 290 ASSERT(this == Isolate::Current()); |
| 291 spawn_data_ = value; |
| 292 } |
282 | 293 |
283 static const intptr_t kNoDeoptId = -1; | 294 static const intptr_t kNoDeoptId = -1; |
284 intptr_t deopt_id() const { return deopt_id_; } | 295 intptr_t deopt_id() const { return deopt_id_; } |
285 void set_deopt_id(int value) { | 296 void set_deopt_id(int value) { |
286 ASSERT(value >= 0); | 297 ASSERT(value >= 0); |
287 deopt_id_ = value; | 298 deopt_id_ = value; |
288 } | 299 } |
289 intptr_t GetNextDeoptId() { | 300 intptr_t GetNextDeoptId() { |
290 ASSERT(deopt_id_ != kNoDeoptId); | 301 ASSERT(deopt_id_ != kNoDeoptId); |
291 return deopt_id_++; | 302 return deopt_id_++; |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 Simulator* simulator_; | 467 Simulator* simulator_; |
457 LongJump* long_jump_base_; | 468 LongJump* long_jump_base_; |
458 TimerList timer_list_; | 469 TimerList timer_list_; |
459 intptr_t deopt_id_; | 470 intptr_t deopt_id_; |
460 RawArray* ic_data_array_; | 471 RawArray* ic_data_array_; |
461 Mutex* mutex_; // protects stack_limit_ and saved_stack_limit_. | 472 Mutex* mutex_; // protects stack_limit_ and saved_stack_limit_. |
462 uword stack_limit_; | 473 uword stack_limit_; |
463 uword saved_stack_limit_; | 474 uword saved_stack_limit_; |
464 MessageHandler* message_handler_; | 475 MessageHandler* message_handler_; |
465 uword spawn_data_; | 476 uword spawn_data_; |
| 477 bool is_runnable_; |
466 GcPrologueCallbacks gc_prologue_callbacks_; | 478 GcPrologueCallbacks gc_prologue_callbacks_; |
467 GcEpilogueCallbacks gc_epilogue_callbacks_; | 479 GcEpilogueCallbacks gc_epilogue_callbacks_; |
468 | 480 |
469 // Deoptimization support. | 481 // Deoptimization support. |
470 intptr_t* deopt_cpu_registers_copy_; | 482 intptr_t* deopt_cpu_registers_copy_; |
471 fpu_register_t* deopt_fpu_registers_copy_; | 483 fpu_register_t* deopt_fpu_registers_copy_; |
472 intptr_t* deopt_frame_copy_; | 484 intptr_t* deopt_frame_copy_; |
473 intptr_t deopt_frame_copy_size_; | 485 intptr_t deopt_frame_copy_size_; |
474 DeferredObject* deferred_objects_; | 486 DeferredObject* deferred_objects_; |
475 | 487 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 } | 558 } |
547 | 559 |
548 private: | 560 private: |
549 Isolate* new_isolate_; | 561 Isolate* new_isolate_; |
550 Isolate* saved_isolate_; | 562 Isolate* saved_isolate_; |
551 uword saved_stack_limit_; | 563 uword saved_stack_limit_; |
552 | 564 |
553 DISALLOW_COPY_AND_ASSIGN(SwitchIsolateScope); | 565 DISALLOW_COPY_AND_ASSIGN(SwitchIsolateScope); |
554 }; | 566 }; |
555 | 567 |
| 568 |
| 569 class IsolateSpawnState { |
| 570 public: |
| 571 IsolateSpawnState(const Function& func, const Function& callback_func); |
| 572 explicit IsolateSpawnState(const char* script_url); |
| 573 ~IsolateSpawnState(); |
| 574 |
| 575 Isolate* isolate() const { return isolate_; } |
| 576 void set_isolate(Isolate* value) { isolate_ = value; } |
| 577 char* script_url() const { return script_url_; } |
| 578 char* library_url() const { return library_url_; } |
| 579 char* function_name() const { return function_name_; } |
| 580 char* exception_callback_name() const { return exception_callback_name_; } |
| 581 |
| 582 RawObject* ResolveFunction(); |
| 583 void Cleanup(); |
| 584 |
| 585 private: |
| 586 Isolate* isolate_; |
| 587 char* script_url_; |
| 588 char* library_url_; |
| 589 char* function_name_; |
| 590 char* exception_callback_name_; |
| 591 }; |
| 592 |
556 } // namespace dart | 593 } // namespace dart |
557 | 594 |
558 #endif // VM_ISOLATE_H_ | 595 #endif // VM_ISOLATE_H_ |
OLD | NEW |