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