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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 class RawContext; | 49 class RawContext; |
50 class RawDouble; | 50 class RawDouble; |
51 class RawGrowableObjectArray; | 51 class RawGrowableObjectArray; |
52 class RawMint; | 52 class RawMint; |
53 class RawObject; | 53 class RawObject; |
54 class RawInteger; | 54 class RawInteger; |
55 class RawError; | 55 class RawError; |
56 class RawFloat32x4; | 56 class RawFloat32x4; |
57 class RawInt32x4; | 57 class RawInt32x4; |
58 class RawUserTag; | 58 class RawUserTag; |
| 59 class SafepointHandler; |
59 class SampleBuffer; | 60 class SampleBuffer; |
60 class SendPort; | 61 class SendPort; |
61 class ServiceIdZone; | 62 class ServiceIdZone; |
62 class Simulator; | 63 class Simulator; |
63 class StackResource; | 64 class StackResource; |
64 class StackZone; | 65 class StackZone; |
65 class StoreBuffer; | 66 class StoreBuffer; |
66 class StubCode; | 67 class StubCode; |
67 class ThreadRegistry; | 68 class ThreadRegistry; |
68 class UserTag; | 69 class UserTag; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 void RegisterClassAt(intptr_t index, const Class& cls); | 120 void RegisterClassAt(intptr_t index, const Class& cls); |
120 void ValidateClassTable(); | 121 void ValidateClassTable(); |
121 | 122 |
122 // Visit all object pointers. | 123 // Visit all object pointers. |
123 void IterateObjectPointers(ObjectPointerVisitor* visitor, | 124 void IterateObjectPointers(ObjectPointerVisitor* visitor, |
124 bool validate_frames); | 125 bool validate_frames); |
125 | 126 |
126 // Visits weak object pointers. | 127 // Visits weak object pointers. |
127 void VisitWeakPersistentHandles(HandleVisitor* visitor); | 128 void VisitWeakPersistentHandles(HandleVisitor* visitor); |
128 | 129 |
| 130 // Prepares all threads in an isolate for Garbage Collection. |
| 131 void PrepareForGC(); |
| 132 |
129 StoreBuffer* store_buffer() { return store_buffer_; } | 133 StoreBuffer* store_buffer() { return store_buffer_; } |
130 | 134 |
131 ThreadRegistry* thread_registry() { return thread_registry_; } | 135 ThreadRegistry* thread_registry() const { return thread_registry_; } |
| 136 SafepointHandler* safepoint_handler() const { return safepoint_handler_; } |
132 | 137 |
133 ClassTable* class_table() { return &class_table_; } | 138 ClassTable* class_table() { return &class_table_; } |
134 static intptr_t class_table_offset() { | 139 static intptr_t class_table_offset() { |
135 return OFFSET_OF(Isolate, class_table_); | 140 return OFFSET_OF(Isolate, class_table_); |
136 } | 141 } |
137 | 142 |
138 static intptr_t ic_miss_code_offset() { | 143 static intptr_t ic_miss_code_offset() { |
139 return OFFSET_OF(Isolate, ic_miss_code_); | 144 return OFFSET_OF(Isolate, ic_miss_code_); |
140 } | 145 } |
141 | 146 |
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 RawGrowableObjectArray* pending_service_extension_calls() const { | 685 RawGrowableObjectArray* pending_service_extension_calls() const { |
681 return pending_service_extension_calls_; | 686 return pending_service_extension_calls_; |
682 } | 687 } |
683 void set_pending_service_extension_calls(const GrowableObjectArray& value); | 688 void set_pending_service_extension_calls(const GrowableObjectArray& value); |
684 RawGrowableObjectArray* registered_service_extension_handlers() const { | 689 RawGrowableObjectArray* registered_service_extension_handlers() const { |
685 return registered_service_extension_handlers_; | 690 return registered_service_extension_handlers_; |
686 } | 691 } |
687 void set_registered_service_extension_handlers( | 692 void set_registered_service_extension_handlers( |
688 const GrowableObjectArray& value); | 693 const GrowableObjectArray& value); |
689 | 694 |
690 void ClearMutatorThread() { | 695 Monitor* threads_lock() const; |
691 mutator_thread_ = NULL; | 696 Thread* ScheduleThread(bool is_mutator, bool bypass_safepoint = false); |
692 } | 697 void UnscheduleThread( |
693 void MakeCurrentThreadMutator(Thread* thread) { | 698 Thread* thread, bool is_mutator, bool bypass_safepoint = false); |
694 ASSERT(thread == Thread::Current()); | |
695 DEBUG_ASSERT(IsIsolateOf(thread)); | |
696 mutator_thread_ = thread; | |
697 } | |
698 #if defined(DEBUG) | |
699 bool IsIsolateOf(Thread* thread); | |
700 #endif // DEBUG | |
701 | 699 |
702 // DEPRECATED: Use Thread's methods instead. During migration, these default | 700 // DEPRECATED: Use Thread's methods instead. During migration, these default |
703 // to using the mutator thread (which must also be the current thread). | 701 // to using the mutator thread (which must also be the current thread). |
704 Zone* current_zone() const { | 702 Zone* current_zone() const { |
705 ASSERT(Thread::Current() == mutator_thread_); | 703 ASSERT(Thread::Current() == mutator_thread_); |
706 return mutator_thread_->zone(); | 704 return mutator_thread_->zone(); |
707 } | 705 } |
708 | 706 |
709 // Accessed from generated code: | 707 // Accessed from generated code: |
710 // TODO(asiva): Need to consider moving the stack_limit_ from isolate to | 708 // TODO(asiva): Need to consider moving the stack_limit_ from isolate to |
711 // being thread specific. | 709 // being thread specific. |
712 uword stack_limit_; | 710 uword stack_limit_; |
713 StoreBuffer* store_buffer_; | 711 StoreBuffer* store_buffer_; |
714 Heap* heap_; | 712 Heap* heap_; |
715 uword user_tag_; | 713 uword user_tag_; |
716 RawUserTag* current_tag_; | 714 RawUserTag* current_tag_; |
717 RawUserTag* default_tag_; | 715 RawUserTag* default_tag_; |
718 RawCode* ic_miss_code_; | 716 RawCode* ic_miss_code_; |
719 ClassTable class_table_; | 717 ClassTable class_table_; |
720 bool single_step_; | 718 bool single_step_; |
721 bool skip_step_; // skip the next single step. | 719 bool skip_step_; // skip the next single step. |
722 | 720 |
723 ThreadRegistry* thread_registry_; | 721 ThreadRegistry* thread_registry_; |
| 722 SafepointHandler* safepoint_handler_; |
724 Dart_MessageNotifyCallback message_notify_callback_; | 723 Dart_MessageNotifyCallback message_notify_callback_; |
725 char* name_; | 724 char* name_; |
726 char* debugger_name_; | 725 char* debugger_name_; |
727 int64_t start_time_; | 726 int64_t start_time_; |
728 Dart_Port main_port_; | 727 Dart_Port main_port_; |
729 Dart_Port origin_id_; // Isolates created by spawnFunc have some origin id. | 728 Dart_Port origin_id_; // Isolates created by spawnFunc have some origin id. |
730 uint64_t pause_capability_; | 729 uint64_t pause_capability_; |
731 uint64_t terminate_capability_; | 730 uint64_t terminate_capability_; |
732 bool errors_fatal_; | 731 bool errors_fatal_; |
733 ObjectStore* object_store_; | 732 ObjectStore* object_store_; |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
853 static Monitor* isolates_list_monitor_; | 852 static Monitor* isolates_list_monitor_; |
854 static Isolate* isolates_list_head_; | 853 static Isolate* isolates_list_head_; |
855 static bool creation_enabled_; | 854 static bool creation_enabled_; |
856 | 855 |
857 #define REUSABLE_FRIEND_DECLARATION(name) \ | 856 #define REUSABLE_FRIEND_DECLARATION(name) \ |
858 friend class Reusable##name##HandleScope; | 857 friend class Reusable##name##HandleScope; |
859 REUSABLE_HANDLE_LIST(REUSABLE_FRIEND_DECLARATION) | 858 REUSABLE_HANDLE_LIST(REUSABLE_FRIEND_DECLARATION) |
860 #undef REUSABLE_FRIEND_DECLARATION | 859 #undef REUSABLE_FRIEND_DECLARATION |
861 | 860 |
862 friend class GCMarker; // VisitObjectPointers | 861 friend class GCMarker; // VisitObjectPointers |
| 862 friend class SafepointHandler; |
863 friend class Scavenger; // VisitObjectPointers | 863 friend class Scavenger; // VisitObjectPointers |
864 friend class ServiceIsolate; | 864 friend class ServiceIsolate; |
865 friend class Thread; | 865 friend class Thread; |
866 friend class Timeline; | 866 friend class Timeline; |
867 | 867 |
868 DISALLOW_COPY_AND_ASSIGN(Isolate); | 868 DISALLOW_COPY_AND_ASSIGN(Isolate); |
869 }; | 869 }; |
870 | 870 |
871 | 871 |
872 // When we need to execute code in an isolate, we use the | 872 // When we need to execute code in an isolate, we use the |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
991 intptr_t* spawn_count_; | 991 intptr_t* spawn_count_; |
992 | 992 |
993 Isolate::Flags isolate_flags_; | 993 Isolate::Flags isolate_flags_; |
994 bool paused_; | 994 bool paused_; |
995 bool errors_are_fatal_; | 995 bool errors_are_fatal_; |
996 }; | 996 }; |
997 | 997 |
998 } // namespace dart | 998 } // namespace dart |
999 | 999 |
1000 #endif // VM_ISOLATE_H_ | 1000 #endif // VM_ISOLATE_H_ |
OLD | NEW |