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 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
747 // to using the mutator thread (which must also be the current thread). | 747 // to using the mutator thread (which must also be the current thread). |
748 Zone* current_zone() const { | 748 Zone* current_zone() const { |
749 ASSERT(Thread::Current() == mutator_thread_); | 749 ASSERT(Thread::Current() == mutator_thread_); |
750 return mutator_thread_->zone(); | 750 return mutator_thread_->zone(); |
751 } | 751 } |
752 void set_current_zone(Zone* zone) { | 752 void set_current_zone(Zone* zone) { |
753 ASSERT(Thread::Current() == mutator_thread_); | 753 ASSERT(Thread::Current() == mutator_thread_); |
754 mutator_thread_->set_zone(zone); | 754 mutator_thread_->set_zone(zone); |
755 } | 755 } |
756 | 756 |
| 757 static void KillIsolate(Isolate* isolate); |
| 758 static void KillAllIsolates(); |
| 759 |
| 760 static void DisableIsolateCreation(); |
| 761 static void EnableIsolateCreation(); |
| 762 |
| 763 static int IsolateCount(); |
| 764 |
757 private: | 765 private: |
758 explicit Isolate(const Dart_IsolateFlags& api_flags); | 766 explicit Isolate(const Dart_IsolateFlags& api_flags); |
759 | 767 |
760 void BuildName(const char* name_prefix); | 768 void BuildName(const char* name_prefix); |
761 void PrintInvokedFunctions(); | 769 void PrintInvokedFunctions(); |
762 | 770 |
763 void ProfileIdle(); | 771 void ProfileIdle(); |
764 | 772 |
765 // Visit all object pointers. Caller must ensure concurrent sweeper is not | 773 // Visit all object pointers. Caller must ensure concurrent sweeper is not |
766 // running, and the visitor must not allocate. | 774 // running, and the visitor must not allocate. |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
907 static Dart_FileOpenCallback file_open_callback_; | 915 static Dart_FileOpenCallback file_open_callback_; |
908 static Dart_FileReadCallback file_read_callback_; | 916 static Dart_FileReadCallback file_read_callback_; |
909 static Dart_FileWriteCallback file_write_callback_; | 917 static Dart_FileWriteCallback file_write_callback_; |
910 static Dart_FileCloseCallback file_close_callback_; | 918 static Dart_FileCloseCallback file_close_callback_; |
911 static Dart_EntropySource entropy_source_callback_; | 919 static Dart_EntropySource entropy_source_callback_; |
912 static Dart_IsolateInterruptCallback vmstats_callback_; | 920 static Dart_IsolateInterruptCallback vmstats_callback_; |
913 | 921 |
914 static void WakePauseEventHandler(Dart_Isolate isolate); | 922 static void WakePauseEventHandler(Dart_Isolate isolate); |
915 | 923 |
916 // Manage list of existing isolates. | 924 // Manage list of existing isolates. |
917 static void AddIsolateTolist(Isolate* isolate); | 925 static bool AddIsolateToList(Isolate* isolate); |
918 static void RemoveIsolateFromList(Isolate* isolate); | 926 static void RemoveIsolateFromList(Isolate* isolate); |
919 static void CheckForDuplicateThreadState(InterruptableThreadState* state); | 927 static void CheckForDuplicateThreadState(InterruptableThreadState* state); |
920 | 928 |
921 static Monitor* isolates_list_monitor_; // Protects isolates_list_head_ | 929 // This monitor protects isolates_list_head_, and creation_enabled_. |
| 930 static Monitor* isolates_list_monitor_; |
922 static Isolate* isolates_list_head_; | 931 static Isolate* isolates_list_head_; |
| 932 static bool creation_enabled_; |
923 | 933 |
924 #define REUSABLE_FRIEND_DECLARATION(name) \ | 934 #define REUSABLE_FRIEND_DECLARATION(name) \ |
925 friend class Reusable##name##HandleScope; | 935 friend class Reusable##name##HandleScope; |
926 REUSABLE_HANDLE_LIST(REUSABLE_FRIEND_DECLARATION) | 936 REUSABLE_HANDLE_LIST(REUSABLE_FRIEND_DECLARATION) |
927 #undef REUSABLE_FRIEND_DECLARATION | 937 #undef REUSABLE_FRIEND_DECLARATION |
928 | 938 |
929 friend class GCMarker; // VisitObjectPointers | 939 friend class GCMarker; // VisitObjectPointers |
930 friend class Scavenger; // VisitObjectPointers | 940 friend class Scavenger; // VisitObjectPointers |
931 friend class ServiceIsolate; | 941 friend class ServiceIsolate; |
932 friend class Thread; | 942 friend class Thread; |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1074 uint8_t* serialized_message_; | 1084 uint8_t* serialized_message_; |
1075 intptr_t serialized_message_len_; | 1085 intptr_t serialized_message_len_; |
1076 Isolate::Flags isolate_flags_; | 1086 Isolate::Flags isolate_flags_; |
1077 bool paused_; | 1087 bool paused_; |
1078 bool errors_are_fatal_; | 1088 bool errors_are_fatal_; |
1079 }; | 1089 }; |
1080 | 1090 |
1081 } // namespace dart | 1091 } // namespace dart |
1082 | 1092 |
1083 #endif // VM_ISOLATE_H_ | 1093 #endif // VM_ISOLATE_H_ |
OLD | NEW |