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