| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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_THREAD_REGISTRY_H_ | 5 #ifndef VM_THREAD_REGISTRY_H_ |
| 6 #define VM_THREAD_REGISTRY_H_ | 6 #define VM_THREAD_REGISTRY_H_ |
| 7 | 7 |
| 8 #include "vm/globals.h" | 8 #include "vm/globals.h" |
| 9 #include "vm/growable_array.h" | 9 #include "vm/growable_array.h" |
| 10 #include "vm/isolate.h" | 10 #include "vm/isolate.h" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 const Entry& entry = entries_[i]; | 108 const Entry& entry = entries_[i]; |
| 109 if (entry.scheduled) { | 109 if (entry.scheduled) { |
| 110 FATAL3("Isolate %p still scheduled on %p (whose isolate_ is %p)\n", | 110 FATAL3("Isolate %p still scheduled on %p (whose isolate_ is %p)\n", |
| 111 isolate, | 111 isolate, |
| 112 entry.thread, | 112 entry.thread, |
| 113 entry.thread->isolate()); | 113 entry.thread->isolate()); |
| 114 } | 114 } |
| 115 } | 115 } |
| 116 } | 116 } |
| 117 | 117 |
| 118 void VisitObjectPointers(ObjectPointerVisitor* visitor) { | 118 void VisitObjectPointers(ObjectPointerVisitor* visitor, |
| 119 bool validate_frames) { |
| 119 MonitorLocker ml(monitor_); | 120 MonitorLocker ml(monitor_); |
| 120 for (int i = 0; i < entries_.length(); ++i) { | 121 for (int i = 0; i < entries_.length(); ++i) { |
| 121 const Entry& entry = entries_[i]; | 122 const Entry& entry = entries_[i]; |
| 122 const Thread::State& state = | 123 const Thread::State& state = |
| 123 entry.scheduled ? entry.thread->state_ : entry.state; | 124 entry.scheduled ? entry.thread->state_ : entry.state; |
| 124 if (state.zone != NULL) { | 125 if (state.zone != NULL) { |
| 125 state.zone->VisitObjectPointers(visitor); | 126 state.zone->VisitObjectPointers(visitor); |
| 126 } | 127 } |
| 127 // Iterate over all the stack frames and visit objects on the stack. | 128 // Iterate over all the stack frames and visit objects on the stack. |
| 128 uword efi = state.top_exit_frame_info; | 129 StackFrameIterator frames_iterator(state.top_exit_frame_info, |
| 129 if (efi == 0) continue; | 130 validate_frames); |
| 130 StackFrameIterator frames_iterator(efi, false); | |
| 131 StackFrame* frame = frames_iterator.NextFrame(); | 131 StackFrame* frame = frames_iterator.NextFrame(); |
| 132 while (frame != NULL) { | 132 while (frame != NULL) { |
| 133 frame->VisitObjectPointers(visitor); | 133 frame->VisitObjectPointers(visitor); |
| 134 frame = frames_iterator.NextFrame(); | 134 frame = frames_iterator.NextFrame(); |
| 135 } | 135 } |
| 136 } | 136 } |
| 137 } | 137 } |
| 138 | 138 |
| 139 private: | 139 private: |
| 140 struct Entry { | 140 struct Entry { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 170 intptr_t remaining_; // Number of threads yet to reach their safepoint. | 170 intptr_t remaining_; // Number of threads yet to reach their safepoint. |
| 171 int64_t round_; // Counter, to prevent missing updates to remaining_ | 171 int64_t round_; // Counter, to prevent missing updates to remaining_ |
| 172 // (see comments in CheckSafepointLocked). | 172 // (see comments in CheckSafepointLocked). |
| 173 | 173 |
| 174 DISALLOW_COPY_AND_ASSIGN(ThreadRegistry); | 174 DISALLOW_COPY_AND_ASSIGN(ThreadRegistry); |
| 175 }; | 175 }; |
| 176 | 176 |
| 177 } // namespace dart | 177 } // namespace dart |
| 178 | 178 |
| 179 #endif // VM_THREAD_REGISTRY_H_ | 179 #endif // VM_THREAD_REGISTRY_H_ |
| OLD | NEW |