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 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 // to using the mutator thread (which must also be the current thread). | 740 // to using the mutator thread (which must also be the current thread). |
741 Zone* current_zone() const { | 741 Zone* current_zone() const { |
742 ASSERT(Thread::Current() == mutator_thread_); | 742 ASSERT(Thread::Current() == mutator_thread_); |
743 return mutator_thread_->zone(); | 743 return mutator_thread_->zone(); |
744 } | 744 } |
745 void set_current_zone(Zone* zone) { | 745 void set_current_zone(Zone* zone) { |
746 ASSERT(Thread::Current() == mutator_thread_); | 746 ASSERT(Thread::Current() == mutator_thread_); |
747 mutator_thread_->set_zone(zone); | 747 mutator_thread_->set_zone(zone); |
748 } | 748 } |
749 | 749 |
| 750 static void KillIsolate(Isolate* isolate); |
| 751 static void KillAllIsolates(); |
| 752 |
| 753 static void DisableIsolateCreation(); |
| 754 static void EnableIsolateCreation(); |
| 755 |
750 private: | 756 private: |
751 friend class Dart; // Init, InitOnce, Shutdown. | 757 friend class Dart; // Init, InitOnce, Shutdown. |
752 | 758 |
753 explicit Isolate(const Dart_IsolateFlags& api_flags); | 759 explicit Isolate(const Dart_IsolateFlags& api_flags); |
754 | 760 |
755 static void InitOnce(); | 761 static void InitOnce(); |
756 static Isolate* Init(const char* name_prefix, | 762 static Isolate* Init(const char* name_prefix, |
757 const Dart_IsolateFlags& api_flags, | 763 const Dart_IsolateFlags& api_flags, |
758 bool is_vm_isolate = false); | 764 bool is_vm_isolate = false); |
| 765 void LowLevelShutdown(); |
759 void Shutdown(); | 766 void Shutdown(); |
760 | 767 |
761 void BuildName(const char* name_prefix); | 768 void BuildName(const char* name_prefix); |
762 void PrintInvokedFunctions(); | 769 void PrintInvokedFunctions(); |
763 | 770 |
764 void ProfileIdle(); | 771 void ProfileIdle(); |
765 | 772 |
766 // Visit all object pointers. Caller must ensure concurrent sweeper is not | 773 // Visit all object pointers. Caller must ensure concurrent sweeper is not |
767 // running, and the visitor must not allocate. | 774 // running, and the visitor must not allocate. |
768 void VisitObjectPointers(ObjectPointerVisitor* visitor, | 775 void VisitObjectPointers(ObjectPointerVisitor* visitor, |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
916 static Dart_FileOpenCallback file_open_callback_; | 923 static Dart_FileOpenCallback file_open_callback_; |
917 static Dart_FileReadCallback file_read_callback_; | 924 static Dart_FileReadCallback file_read_callback_; |
918 static Dart_FileWriteCallback file_write_callback_; | 925 static Dart_FileWriteCallback file_write_callback_; |
919 static Dart_FileCloseCallback file_close_callback_; | 926 static Dart_FileCloseCallback file_close_callback_; |
920 static Dart_EntropySource entropy_source_callback_; | 927 static Dart_EntropySource entropy_source_callback_; |
921 static Dart_IsolateInterruptCallback vmstats_callback_; | 928 static Dart_IsolateInterruptCallback vmstats_callback_; |
922 | 929 |
923 static void WakePauseEventHandler(Dart_Isolate isolate); | 930 static void WakePauseEventHandler(Dart_Isolate isolate); |
924 | 931 |
925 // Manage list of existing isolates. | 932 // Manage list of existing isolates. |
926 static void AddIsolateTolist(Isolate* isolate); | 933 static bool AddIsolateToList(Isolate* isolate); |
927 static void RemoveIsolateFromList(Isolate* isolate); | 934 static void RemoveIsolateFromList(Isolate* isolate); |
928 static void CheckForDuplicateThreadState(InterruptableThreadState* state); | 935 static void CheckForDuplicateThreadState(InterruptableThreadState* state); |
929 | 936 |
930 static Monitor* isolates_list_monitor_; // Protects isolates_list_head_ | 937 // This monitor protects isolates_list_head_, and creation_enabled_. |
| 938 static Monitor* isolates_list_monitor_; |
931 static Isolate* isolates_list_head_; | 939 static Isolate* isolates_list_head_; |
| 940 static bool creation_enabled_; |
932 | 941 |
933 #define REUSABLE_FRIEND_DECLARATION(name) \ | 942 #define REUSABLE_FRIEND_DECLARATION(name) \ |
934 friend class Reusable##name##HandleScope; | 943 friend class Reusable##name##HandleScope; |
935 REUSABLE_HANDLE_LIST(REUSABLE_FRIEND_DECLARATION) | 944 REUSABLE_HANDLE_LIST(REUSABLE_FRIEND_DECLARATION) |
936 #undef REUSABLE_FRIEND_DECLARATION | 945 #undef REUSABLE_FRIEND_DECLARATION |
937 | 946 |
938 friend class GCMarker; // VisitObjectPointers | 947 friend class GCMarker; // VisitObjectPointers |
939 friend class Scavenger; // VisitObjectPointers | 948 friend class Scavenger; // VisitObjectPointers |
940 friend class ServiceIsolate; | 949 friend class ServiceIsolate; |
941 friend class Thread; | 950 friend class Thread; |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1083 uint8_t* serialized_message_; | 1092 uint8_t* serialized_message_; |
1084 intptr_t serialized_message_len_; | 1093 intptr_t serialized_message_len_; |
1085 Isolate::Flags isolate_flags_; | 1094 Isolate::Flags isolate_flags_; |
1086 bool paused_; | 1095 bool paused_; |
1087 bool errors_are_fatal_; | 1096 bool errors_are_fatal_; |
1088 }; | 1097 }; |
1089 | 1098 |
1090 } // namespace dart | 1099 } // namespace dart |
1091 | 1100 |
1092 #endif // VM_ISOLATE_H_ | 1101 #endif // VM_ISOLATE_H_ |
OLD | NEW |