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 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
752 // to using the mutator thread (which must also be the current thread). | 752 // to using the mutator thread (which must also be the current thread). |
753 Zone* current_zone() const { | 753 Zone* current_zone() const { |
754 ASSERT(Thread::Current() == mutator_thread_); | 754 ASSERT(Thread::Current() == mutator_thread_); |
755 return mutator_thread_->zone(); | 755 return mutator_thread_->zone(); |
756 } | 756 } |
757 void set_current_zone(Zone* zone) { | 757 void set_current_zone(Zone* zone) { |
758 ASSERT(Thread::Current() == mutator_thread_); | 758 ASSERT(Thread::Current() == mutator_thread_); |
759 mutator_thread_->set_zone(zone); | 759 mutator_thread_->set_zone(zone); |
760 } | 760 } |
761 | 761 |
762 // The isolates_list_monitor_ should be held when calling Kill(). | |
763 void Kill(); | |
Ivan Posva
2015/09/14 21:52:13
Since Kill assumes the the monitor is locked then
zra
2015/09/14 22:59:00
Done.
| |
764 | |
765 static void KillAllIsolates(); | |
766 static void KillIfExists(Isolate* isolate); | |
767 | |
768 static void DisableIsolateCreation(); | |
769 static void EnableIsolateCreation(); | |
770 | |
762 private: | 771 private: |
763 friend class Dart; // Init, InitOnce, Shutdown. | 772 friend class Dart; // Init, InitOnce, Shutdown. |
764 | 773 |
765 explicit Isolate(const Dart_IsolateFlags& api_flags); | 774 explicit Isolate(const Dart_IsolateFlags& api_flags); |
766 | 775 |
767 static void InitOnce(); | 776 static void InitOnce(); |
768 static Isolate* Init(const char* name_prefix, | 777 static Isolate* Init(const char* name_prefix, |
769 const Dart_IsolateFlags& api_flags, | 778 const Dart_IsolateFlags& api_flags, |
770 bool is_vm_isolate = false); | 779 bool is_vm_isolate = false); |
780 void LowLevelShutdown(); | |
771 void Shutdown(); | 781 void Shutdown(); |
772 | 782 |
773 void BuildName(const char* name_prefix); | 783 void BuildName(const char* name_prefix); |
774 void PrintInvokedFunctions(); | 784 void PrintInvokedFunctions(); |
775 | 785 |
776 void ProfileIdle(); | 786 void ProfileIdle(); |
777 | 787 |
778 // Visit all object pointers. Caller must ensure concurrent sweeper is not | 788 // Visit all object pointers. Caller must ensure concurrent sweeper is not |
779 // running, and the visitor must not allocate. | 789 // running, and the visitor must not allocate. |
780 void VisitObjectPointers(ObjectPointerVisitor* visitor, | 790 void VisitObjectPointers(ObjectPointerVisitor* visitor, |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
955 static Dart_FileOpenCallback file_open_callback_; | 965 static Dart_FileOpenCallback file_open_callback_; |
956 static Dart_FileReadCallback file_read_callback_; | 966 static Dart_FileReadCallback file_read_callback_; |
957 static Dart_FileWriteCallback file_write_callback_; | 967 static Dart_FileWriteCallback file_write_callback_; |
958 static Dart_FileCloseCallback file_close_callback_; | 968 static Dart_FileCloseCallback file_close_callback_; |
959 static Dart_EntropySource entropy_source_callback_; | 969 static Dart_EntropySource entropy_source_callback_; |
960 static Dart_IsolateInterruptCallback vmstats_callback_; | 970 static Dart_IsolateInterruptCallback vmstats_callback_; |
961 | 971 |
962 static void WakePauseEventHandler(Dart_Isolate isolate); | 972 static void WakePauseEventHandler(Dart_Isolate isolate); |
963 | 973 |
964 // Manage list of existing isolates. | 974 // Manage list of existing isolates. |
965 static void AddIsolateTolist(Isolate* isolate); | 975 static bool AddIsolateToList(Isolate* isolate); |
966 static void RemoveIsolateFromList(Isolate* isolate); | 976 static void RemoveIsolateFromList(Isolate* isolate); |
967 | 977 |
968 static Monitor* isolates_list_monitor_; // Protects isolates_list_head_ | 978 // This monitor protects isolates_list_head_, and creation_enabled_. |
979 static Monitor* isolates_list_monitor_; | |
969 static Isolate* isolates_list_head_; | 980 static Isolate* isolates_list_head_; |
981 static bool creation_enabled_; | |
970 | 982 |
971 #define REUSABLE_FRIEND_DECLARATION(name) \ | 983 #define REUSABLE_FRIEND_DECLARATION(name) \ |
972 friend class Reusable##name##HandleScope; | 984 friend class Reusable##name##HandleScope; |
973 REUSABLE_HANDLE_LIST(REUSABLE_FRIEND_DECLARATION) | 985 REUSABLE_HANDLE_LIST(REUSABLE_FRIEND_DECLARATION) |
974 #undef REUSABLE_FRIEND_DECLARATION | 986 #undef REUSABLE_FRIEND_DECLARATION |
975 | 987 |
976 friend class GCMarker; // VisitObjectPointers | 988 friend class GCMarker; // VisitObjectPointers |
977 friend class Scavenger; // VisitObjectPointers | 989 friend class Scavenger; // VisitObjectPointers |
978 friend class ServiceIsolate; | 990 friend class ServiceIsolate; |
979 friend class Thread; | 991 friend class Thread; |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1121 uint8_t* serialized_message_; | 1133 uint8_t* serialized_message_; |
1122 intptr_t serialized_message_len_; | 1134 intptr_t serialized_message_len_; |
1123 Isolate::Flags isolate_flags_; | 1135 Isolate::Flags isolate_flags_; |
1124 bool paused_; | 1136 bool paused_; |
1125 bool errors_are_fatal_; | 1137 bool errors_are_fatal_; |
1126 }; | 1138 }; |
1127 | 1139 |
1128 } // namespace dart | 1140 } // namespace dart |
1129 | 1141 |
1130 #endif // VM_ISOLATE_H_ | 1142 #endif // VM_ISOLATE_H_ |
OLD | NEW |