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