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/base_isolate.h" | 10 #include "vm/base_isolate.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 class RawInt32x4; | 71 class RawInt32x4; |
72 class RawUserTag; | 72 class RawUserTag; |
73 class SampleBuffer; | 73 class SampleBuffer; |
74 class SendPort; | 74 class SendPort; |
75 class ServiceIdZone; | 75 class ServiceIdZone; |
76 class Simulator; | 76 class Simulator; |
77 class StackResource; | 77 class StackResource; |
78 class StackZone; | 78 class StackZone; |
79 class StoreBuffer; | 79 class StoreBuffer; |
80 class StubCode; | 80 class StubCode; |
| 81 class ThreadRegistry; |
81 class TypeArguments; | 82 class TypeArguments; |
82 class TypeParameter; | 83 class TypeParameter; |
83 class UserTag; | 84 class UserTag; |
84 | 85 |
85 | 86 |
86 class IsolateVisitor { | 87 class IsolateVisitor { |
87 public: | 88 public: |
88 IsolateVisitor() {} | 89 IsolateVisitor() {} |
89 virtual ~IsolateVisitor() {} | 90 virtual ~IsolateVisitor() {} |
90 | 91 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 bool visit_prologue_weak_persistent_handles, | 138 bool visit_prologue_weak_persistent_handles, |
138 bool validate_frames); | 139 bool validate_frames); |
139 | 140 |
140 // Visits weak object pointers. | 141 // Visits weak object pointers. |
141 void VisitWeakPersistentHandles(HandleVisitor* visitor, | 142 void VisitWeakPersistentHandles(HandleVisitor* visitor, |
142 bool visit_prologue_weak_persistent_handles); | 143 bool visit_prologue_weak_persistent_handles); |
143 void VisitPrologueWeakPersistentHandles(HandleVisitor* visitor); | 144 void VisitPrologueWeakPersistentHandles(HandleVisitor* visitor); |
144 | 145 |
145 StoreBuffer* store_buffer() { return store_buffer_; } | 146 StoreBuffer* store_buffer() { return store_buffer_; } |
146 | 147 |
| 148 ThreadRegistry* thread_registry() { return thread_registry_; } |
| 149 |
147 ClassTable* class_table() { return &class_table_; } | 150 ClassTable* class_table() { return &class_table_; } |
148 static intptr_t class_table_offset() { | 151 static intptr_t class_table_offset() { |
149 return OFFSET_OF(Isolate, class_table_); | 152 return OFFSET_OF(Isolate, class_table_); |
150 } | 153 } |
151 | 154 |
152 MegamorphicCacheTable* megamorphic_cache_table() { | 155 MegamorphicCacheTable* megamorphic_cache_table() { |
153 return &megamorphic_cache_table_; | 156 return &megamorphic_cache_table_; |
154 } | 157 } |
155 | 158 |
156 Dart_MessageNotifyCallback message_notify_callback() const { | 159 Dart_MessageNotifyCallback message_notify_callback() const { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 Heap* heap() const { return heap_; } | 204 Heap* heap() const { return heap_; } |
202 void set_heap(Heap* value) { heap_ = value; } | 205 void set_heap(Heap* value) { heap_ = value; } |
203 static intptr_t heap_offset() { return OFFSET_OF(Isolate, heap_); } | 206 static intptr_t heap_offset() { return OFFSET_OF(Isolate, heap_); } |
204 | 207 |
205 ObjectStore* object_store() const { return object_store_; } | 208 ObjectStore* object_store() const { return object_store_; } |
206 void set_object_store(ObjectStore* value) { object_store_ = value; } | 209 void set_object_store(ObjectStore* value) { object_store_ = value; } |
207 static intptr_t object_store_offset() { | 210 static intptr_t object_store_offset() { |
208 return OFFSET_OF(Isolate, object_store_); | 211 return OFFSET_OF(Isolate, object_store_); |
209 } | 212 } |
210 | 213 |
211 uword top_exit_frame_info() const { return top_exit_frame_info_; } | 214 // DEPRECATED: Use Thread's methods instead. During migration, these default |
212 void set_top_exit_frame_info(uword value) { top_exit_frame_info_ = value; } | 215 // to using the mutator thread (which must also be the current thread). |
213 static intptr_t top_exit_frame_info_offset() { | 216 StackResource* top_resource() const { |
214 return OFFSET_OF(Isolate, top_exit_frame_info_); | 217 ASSERT(Thread::Current() == mutator_thread_); |
| 218 return mutator_thread_->top_resource(); |
| 219 } |
| 220 void set_top_resource(StackResource* value) { |
| 221 ASSERT(Thread::Current() == mutator_thread_); |
| 222 mutator_thread_->set_top_resource(value); |
| 223 } |
| 224 uword top_exit_frame_info() const { |
| 225 ASSERT(Thread::Current() == mutator_thread_); |
| 226 return mutator_thread_->top_exit_frame_info(); |
| 227 } |
| 228 void set_top_exit_frame_info(uword value) { |
| 229 ASSERT(Thread::Current() == mutator_thread_); |
| 230 mutator_thread_->set_top_exit_frame_info(value); |
215 } | 231 } |
216 | 232 |
217 uword vm_tag() const { | 233 uword vm_tag() const { |
218 return vm_tag_; | 234 return vm_tag_; |
219 } | 235 } |
220 void set_vm_tag(uword tag) { | 236 void set_vm_tag(uword tag) { |
221 vm_tag_ = tag; | 237 vm_tag_ = tag; |
222 } | 238 } |
223 static intptr_t vm_tag_offset() { | 239 static intptr_t vm_tag_offset() { |
224 return OFFSET_OF(Isolate, vm_tag_); | 240 return OFFSET_OF(Isolate, vm_tag_); |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE) | 728 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE) |
713 #undef REUSABLE_HANDLE | 729 #undef REUSABLE_HANDLE |
714 | 730 |
715 static void VisitIsolates(IsolateVisitor* visitor); | 731 static void VisitIsolates(IsolateVisitor* visitor); |
716 | 732 |
717 Counters* counters() { return &counters_; } | 733 Counters* counters() { return &counters_; } |
718 | 734 |
719 // Handle service messages until we are told to resume execution. | 735 // Handle service messages until we are told to resume execution. |
720 void PauseEventHandler(); | 736 void PauseEventHandler(); |
721 | 737 |
| 738 // DEPRECATED: Use Thread's methods instead. During migration, these default |
| 739 // to using the mutator thread (which must also be the current thread). |
| 740 Zone* current_zone() const { |
| 741 ASSERT(Thread::Current() == mutator_thread_); |
| 742 return mutator_thread_->zone(); |
| 743 } |
| 744 void set_current_zone(Zone* zone) { |
| 745 ASSERT(Thread::Current() == mutator_thread_); |
| 746 mutator_thread_->set_zone(zone); |
| 747 } |
| 748 |
722 private: | 749 private: |
723 explicit Isolate(const Dart_IsolateFlags& api_flags); | 750 explicit Isolate(const Dart_IsolateFlags& api_flags); |
724 | 751 |
725 void BuildName(const char* name_prefix); | 752 void BuildName(const char* name_prefix); |
726 void PrintInvokedFunctions(); | 753 void PrintInvokedFunctions(); |
727 | 754 |
728 void ProfileIdle(); | 755 void ProfileIdle(); |
729 | 756 |
730 // Visit all object pointers. Caller must ensure concurrent sweeper is not | 757 // Visit all object pointers. Caller must ensure concurrent sweeper is not |
731 // running, and the visitor must not allocate. | 758 // running, and the visitor must not allocate. |
732 void VisitObjectPointers(ObjectPointerVisitor* visitor, | 759 void VisitObjectPointers(ObjectPointerVisitor* visitor, |
733 bool visit_prologue_weak_persistent_handles, | 760 bool visit_prologue_weak_persistent_handles, |
734 bool validate_frames); | 761 bool validate_frames); |
735 | 762 |
736 void set_user_tag(uword tag) { | 763 void set_user_tag(uword tag) { |
737 user_tag_ = tag; | 764 user_tag_ = tag; |
738 } | 765 } |
739 | 766 |
740 void set_mutator_thread(Thread* thread) { | 767 void set_mutator_thread(Thread* thread) { |
741 mutator_thread_ = thread; | 768 mutator_thread_ = thread; |
742 } | 769 } |
743 | 770 |
744 template<class T> T* AllocateReusableHandle(); | 771 template<class T> T* AllocateReusableHandle(); |
745 | 772 |
746 Thread* mutator_thread_; | |
747 uword vm_tag_; | 773 uword vm_tag_; |
748 StoreBuffer* store_buffer_; | 774 StoreBuffer* store_buffer_; |
| 775 ThreadRegistry* thread_registry_; |
749 ClassTable class_table_; | 776 ClassTable class_table_; |
750 MegamorphicCacheTable megamorphic_cache_table_; | 777 MegamorphicCacheTable megamorphic_cache_table_; |
751 Dart_MessageNotifyCallback message_notify_callback_; | 778 Dart_MessageNotifyCallback message_notify_callback_; |
752 char* name_; | 779 char* name_; |
753 char* debugger_name_; | 780 char* debugger_name_; |
754 int64_t start_time_; | 781 int64_t start_time_; |
755 Dart_Port main_port_; | 782 Dart_Port main_port_; |
756 Dart_Port origin_id_; // Isolates created by spawnFunc have some origin id. | 783 Dart_Port origin_id_; // Isolates created by spawnFunc have some origin id. |
757 uint64_t pause_capability_; | 784 uint64_t pause_capability_; |
758 uint64_t terminate_capability_; | 785 uint64_t terminate_capability_; |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1024 intptr_t serialized_args_len_; | 1051 intptr_t serialized_args_len_; |
1025 uint8_t* serialized_message_; | 1052 uint8_t* serialized_message_; |
1026 intptr_t serialized_message_len_; | 1053 intptr_t serialized_message_len_; |
1027 Isolate::Flags isolate_flags_; | 1054 Isolate::Flags isolate_flags_; |
1028 bool paused_; | 1055 bool paused_; |
1029 }; | 1056 }; |
1030 | 1057 |
1031 } // namespace dart | 1058 } // namespace dart |
1032 | 1059 |
1033 #endif // VM_ISOLATE_H_ | 1060 #endif // VM_ISOLATE_H_ |
OLD | NEW |