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) { spawn_data_ = value; } |
282 | 290 |
283 static const intptr_t kNoDeoptId = -1; | 291 static const intptr_t kNoDeoptId = -1; |
284 intptr_t deopt_id() const { return deopt_id_; } | 292 intptr_t deopt_id() const { return deopt_id_; } |
285 void set_deopt_id(int value) { | 293 void set_deopt_id(int value) { |
286 ASSERT(value >= 0); | 294 ASSERT(value >= 0); |
287 deopt_id_ = value; | 295 deopt_id_ = value; |
288 } | 296 } |
289 intptr_t GetNextDeoptId() { | 297 intptr_t GetNextDeoptId() { |
290 ASSERT(deopt_id_ != kNoDeoptId); | 298 ASSERT(deopt_id_ != kNoDeoptId); |
291 return deopt_id_++; | 299 return deopt_id_++; |
292 } | 300 } |
293 | 301 |
294 RawArray* ic_data_array() const { return ic_data_array_; } | 302 RawArray* ic_data_array() const { return ic_data_array_; } |
295 void set_ic_data_array(RawArray* value) { ic_data_array_ = value; } | 303 void set_ic_data_array(RawArray* value) { ic_data_array_ = value; } |
296 ICData* GetICDataForDeoptId(intptr_t deopt_id) const; | 304 ICData* GetICDataForDeoptId(intptr_t deopt_id) const; |
297 | 305 |
| 306 Mutex* mutex() const { return mutex_; } |
| 307 |
298 Debugger* debugger() const { return debugger_; } | 308 Debugger* debugger() const { return debugger_; } |
299 | 309 |
300 Simulator* simulator() const { return simulator_; } | 310 Simulator* simulator() const { return simulator_; } |
301 void set_simulator(Simulator* value) { simulator_ = value; } | 311 void set_simulator(Simulator* value) { simulator_ = value; } |
302 | 312 |
303 GcPrologueCallbacks& gc_prologue_callbacks() { | 313 GcPrologueCallbacks& gc_prologue_callbacks() { |
304 return gc_prologue_callbacks_; | 314 return gc_prologue_callbacks_; |
305 } | 315 } |
306 | 316 |
307 GcEpilogueCallbacks& gc_epilogue_callbacks() { | 317 GcEpilogueCallbacks& gc_epilogue_callbacks() { |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 Simulator* simulator_; | 466 Simulator* simulator_; |
457 LongJump* long_jump_base_; | 467 LongJump* long_jump_base_; |
458 TimerList timer_list_; | 468 TimerList timer_list_; |
459 intptr_t deopt_id_; | 469 intptr_t deopt_id_; |
460 RawArray* ic_data_array_; | 470 RawArray* ic_data_array_; |
461 Mutex* mutex_; // protects stack_limit_ and saved_stack_limit_. | 471 Mutex* mutex_; // protects stack_limit_ and saved_stack_limit_. |
462 uword stack_limit_; | 472 uword stack_limit_; |
463 uword saved_stack_limit_; | 473 uword saved_stack_limit_; |
464 MessageHandler* message_handler_; | 474 MessageHandler* message_handler_; |
465 uword spawn_data_; | 475 uword spawn_data_; |
| 476 bool is_runnable_; |
466 GcPrologueCallbacks gc_prologue_callbacks_; | 477 GcPrologueCallbacks gc_prologue_callbacks_; |
467 GcEpilogueCallbacks gc_epilogue_callbacks_; | 478 GcEpilogueCallbacks gc_epilogue_callbacks_; |
468 | 479 |
469 // Deoptimization support. | 480 // Deoptimization support. |
470 intptr_t* deopt_cpu_registers_copy_; | 481 intptr_t* deopt_cpu_registers_copy_; |
471 fpu_register_t* deopt_fpu_registers_copy_; | 482 fpu_register_t* deopt_fpu_registers_copy_; |
472 intptr_t* deopt_frame_copy_; | 483 intptr_t* deopt_frame_copy_; |
473 intptr_t deopt_frame_copy_size_; | 484 intptr_t deopt_frame_copy_size_; |
474 DeferredObject* deferred_objects_; | 485 DeferredObject* deferred_objects_; |
475 | 486 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 } | 557 } |
547 | 558 |
548 private: | 559 private: |
549 Isolate* new_isolate_; | 560 Isolate* new_isolate_; |
550 Isolate* saved_isolate_; | 561 Isolate* saved_isolate_; |
551 uword saved_stack_limit_; | 562 uword saved_stack_limit_; |
552 | 563 |
553 DISALLOW_COPY_AND_ASSIGN(SwitchIsolateScope); | 564 DISALLOW_COPY_AND_ASSIGN(SwitchIsolateScope); |
554 }; | 565 }; |
555 | 566 |
| 567 |
| 568 class IsolateSpawnState { |
| 569 public: |
| 570 IsolateSpawnState(const Function& func, const Function& callback_func); |
| 571 explicit IsolateSpawnState(const char* script_url); |
| 572 ~IsolateSpawnState(); |
| 573 |
| 574 Isolate* isolate() const { return isolate_; } |
| 575 void set_isolate(Isolate* value) { isolate_ = value; } |
| 576 char* script_url() const { return script_url_; } |
| 577 char* library_url() const { return library_url_; } |
| 578 char* function_name() const { return function_name_; } |
| 579 char* exception_callback_name() const { return exception_callback_name_; } |
| 580 |
| 581 RawObject* ResolveFunction(); |
| 582 void Cleanup(); |
| 583 |
| 584 private: |
| 585 Isolate* isolate_; |
| 586 char* script_url_; |
| 587 char* library_url_; |
| 588 char* function_name_; |
| 589 char* exception_callback_name_; |
| 590 }; |
| 591 |
556 } // namespace dart | 592 } // namespace dart |
557 | 593 |
558 #endif // VM_ISOLATE_H_ | 594 #endif // VM_ISOLATE_H_ |
OLD | NEW |