| 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 "vm/atomic.h" | 10 #include "vm/atomic.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 class RawContext; | 49 class RawContext; |
| 50 class RawDouble; | 50 class RawDouble; |
| 51 class RawGrowableObjectArray; | 51 class RawGrowableObjectArray; |
| 52 class RawMint; | 52 class RawMint; |
| 53 class RawObject; | 53 class RawObject; |
| 54 class RawInteger; | 54 class RawInteger; |
| 55 class RawError; | 55 class RawError; |
| 56 class RawFloat32x4; | 56 class RawFloat32x4; |
| 57 class RawInt32x4; | 57 class RawInt32x4; |
| 58 class RawUserTag; | 58 class RawUserTag; |
| 59 class SafepointHandler; |
| 59 class SampleBuffer; | 60 class SampleBuffer; |
| 60 class SendPort; | 61 class SendPort; |
| 61 class ServiceIdZone; | 62 class ServiceIdZone; |
| 62 class Simulator; | 63 class Simulator; |
| 63 class StackResource; | 64 class StackResource; |
| 64 class StackZone; | 65 class StackZone; |
| 65 class StoreBuffer; | 66 class StoreBuffer; |
| 66 class StubCode; | 67 class StubCode; |
| 67 class ThreadRegistry; | 68 class ThreadRegistry; |
| 68 class UserTag; | 69 class UserTag; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 void RegisterClassAt(intptr_t index, const Class& cls); | 120 void RegisterClassAt(intptr_t index, const Class& cls); |
| 120 void ValidateClassTable(); | 121 void ValidateClassTable(); |
| 121 | 122 |
| 122 // Visit all object pointers. | 123 // Visit all object pointers. |
| 123 void IterateObjectPointers(ObjectPointerVisitor* visitor, | 124 void IterateObjectPointers(ObjectPointerVisitor* visitor, |
| 124 bool validate_frames); | 125 bool validate_frames); |
| 125 | 126 |
| 126 // Visits weak object pointers. | 127 // Visits weak object pointers. |
| 127 void VisitWeakPersistentHandles(HandleVisitor* visitor); | 128 void VisitWeakPersistentHandles(HandleVisitor* visitor); |
| 128 | 129 |
| 130 // Prepares all threads in an isolate for Garbage Collection. |
| 131 void PrepareForGC(); |
| 132 |
| 129 StoreBuffer* store_buffer() { return store_buffer_; } | 133 StoreBuffer* store_buffer() { return store_buffer_; } |
| 130 | 134 |
| 131 ThreadRegistry* thread_registry() { return thread_registry_; } | 135 ThreadRegistry* thread_registry() const { return thread_registry_; } |
| 136 SafepointHandler* safepoint_handler() const { return safepoint_handler_; } |
| 132 | 137 |
| 133 ClassTable* class_table() { return &class_table_; } | 138 ClassTable* class_table() { return &class_table_; } |
| 134 static intptr_t class_table_offset() { | 139 static intptr_t class_table_offset() { |
| 135 return OFFSET_OF(Isolate, class_table_); | 140 return OFFSET_OF(Isolate, class_table_); |
| 136 } | 141 } |
| 137 | 142 |
| 138 static intptr_t ic_miss_code_offset() { | 143 static intptr_t ic_miss_code_offset() { |
| 139 return OFFSET_OF(Isolate, ic_miss_code_); | 144 return OFFSET_OF(Isolate, ic_miss_code_); |
| 140 } | 145 } |
| 141 | 146 |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 685 RawGrowableObjectArray* pending_service_extension_calls() const { | 690 RawGrowableObjectArray* pending_service_extension_calls() const { |
| 686 return pending_service_extension_calls_; | 691 return pending_service_extension_calls_; |
| 687 } | 692 } |
| 688 void set_pending_service_extension_calls(const GrowableObjectArray& value); | 693 void set_pending_service_extension_calls(const GrowableObjectArray& value); |
| 689 RawGrowableObjectArray* registered_service_extension_handlers() const { | 694 RawGrowableObjectArray* registered_service_extension_handlers() const { |
| 690 return registered_service_extension_handlers_; | 695 return registered_service_extension_handlers_; |
| 691 } | 696 } |
| 692 void set_registered_service_extension_handlers( | 697 void set_registered_service_extension_handlers( |
| 693 const GrowableObjectArray& value); | 698 const GrowableObjectArray& value); |
| 694 | 699 |
| 695 void ClearMutatorThread() { | 700 Monitor* threads_lock() const; |
| 696 mutator_thread_ = NULL; | 701 Thread* ScheduleThread(bool is_mutator, bool bypass_safepoint = false); |
| 697 } | 702 void UnscheduleThread( |
| 698 void MakeCurrentThreadMutator(Thread* thread) { | 703 Thread* thread, bool is_mutator, bool bypass_sfepoint = false); |
| 699 ASSERT(thread == Thread::Current()); | |
| 700 DEBUG_ASSERT(IsIsolateOf(thread)); | |
| 701 mutator_thread_ = thread; | |
| 702 } | |
| 703 #if defined(DEBUG) | |
| 704 bool IsIsolateOf(Thread* thread); | |
| 705 #endif // DEBUG | |
| 706 | 704 |
| 707 // DEPRECATED: Use Thread's methods instead. During migration, these default | 705 // DEPRECATED: Use Thread's methods instead. During migration, these default |
| 708 // to using the mutator thread (which must also be the current thread). | 706 // to using the mutator thread (which must also be the current thread). |
| 709 Zone* current_zone() const { | 707 Zone* current_zone() const { |
| 710 ASSERT(Thread::Current() == mutator_thread_); | 708 ASSERT(Thread::Current() == mutator_thread_); |
| 711 return mutator_thread_->zone(); | 709 return mutator_thread_->zone(); |
| 712 } | 710 } |
| 713 | 711 |
| 714 // Accessed from generated code: | 712 // Accessed from generated code: |
| 715 // TODO(asiva): Need to consider moving the stack_limit_ from isolate to | 713 // TODO(asiva): Need to consider moving the stack_limit_ from isolate to |
| 716 // being thread specific. | 714 // being thread specific. |
| 717 uword stack_limit_; | 715 uword stack_limit_; |
| 718 StoreBuffer* store_buffer_; | 716 StoreBuffer* store_buffer_; |
| 719 Heap* heap_; | 717 Heap* heap_; |
| 720 uword user_tag_; | 718 uword user_tag_; |
| 721 RawUserTag* current_tag_; | 719 RawUserTag* current_tag_; |
| 722 RawUserTag* default_tag_; | 720 RawUserTag* default_tag_; |
| 723 RawCode* ic_miss_code_; | 721 RawCode* ic_miss_code_; |
| 724 ClassTable class_table_; | 722 ClassTable class_table_; |
| 725 bool single_step_; | 723 bool single_step_; |
| 726 | 724 |
| 727 ThreadRegistry* thread_registry_; | 725 ThreadRegistry* thread_registry_; |
| 726 SafepointHandler* safepoint_handler_; |
| 728 Dart_MessageNotifyCallback message_notify_callback_; | 727 Dart_MessageNotifyCallback message_notify_callback_; |
| 729 char* name_; | 728 char* name_; |
| 730 char* debugger_name_; | 729 char* debugger_name_; |
| 731 int64_t start_time_; | 730 int64_t start_time_; |
| 732 Dart_Port main_port_; | 731 Dart_Port main_port_; |
| 733 Dart_Port origin_id_; // Isolates created by spawnFunc have some origin id. | 732 Dart_Port origin_id_; // Isolates created by spawnFunc have some origin id. |
| 734 uint64_t pause_capability_; | 733 uint64_t pause_capability_; |
| 735 uint64_t terminate_capability_; | 734 uint64_t terminate_capability_; |
| 736 bool errors_fatal_; | 735 bool errors_fatal_; |
| 737 ObjectStore* object_store_; | 736 ObjectStore* object_store_; |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 852 static Monitor* isolates_list_monitor_; | 851 static Monitor* isolates_list_monitor_; |
| 853 static Isolate* isolates_list_head_; | 852 static Isolate* isolates_list_head_; |
| 854 static bool creation_enabled_; | 853 static bool creation_enabled_; |
| 855 | 854 |
| 856 #define REUSABLE_FRIEND_DECLARATION(name) \ | 855 #define REUSABLE_FRIEND_DECLARATION(name) \ |
| 857 friend class Reusable##name##HandleScope; | 856 friend class Reusable##name##HandleScope; |
| 858 REUSABLE_HANDLE_LIST(REUSABLE_FRIEND_DECLARATION) | 857 REUSABLE_HANDLE_LIST(REUSABLE_FRIEND_DECLARATION) |
| 859 #undef REUSABLE_FRIEND_DECLARATION | 858 #undef REUSABLE_FRIEND_DECLARATION |
| 860 | 859 |
| 861 friend class GCMarker; // VisitObjectPointers | 860 friend class GCMarker; // VisitObjectPointers |
| 861 friend class SafepointHandler; |
| 862 friend class Scavenger; // VisitObjectPointers | 862 friend class Scavenger; // VisitObjectPointers |
| 863 friend class ServiceIsolate; | 863 friend class ServiceIsolate; |
| 864 friend class Thread; | 864 friend class Thread; |
| 865 friend class Timeline; | 865 friend class Timeline; |
| 866 | 866 |
| 867 DISALLOW_COPY_AND_ASSIGN(Isolate); | 867 DISALLOW_COPY_AND_ASSIGN(Isolate); |
| 868 }; | 868 }; |
| 869 | 869 |
| 870 | 870 |
| 871 // When we need to execute code in an isolate, we use the | 871 // When we need to execute code in an isolate, we use the |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 975 uint8_t* serialized_message_; | 975 uint8_t* serialized_message_; |
| 976 intptr_t serialized_message_len_; | 976 intptr_t serialized_message_len_; |
| 977 Isolate::Flags isolate_flags_; | 977 Isolate::Flags isolate_flags_; |
| 978 bool paused_; | 978 bool paused_; |
| 979 bool errors_are_fatal_; | 979 bool errors_are_fatal_; |
| 980 }; | 980 }; |
| 981 | 981 |
| 982 } // namespace dart | 982 } // namespace dart |
| 983 | 983 |
| 984 #endif // VM_ISOLATE_H_ | 984 #endif // VM_ISOLATE_H_ |
| OLD | NEW |