OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 #include "vm/object_graph.h" | 5 #include "vm/object_graph.h" |
6 | 6 |
7 #include "vm/dart.h" | 7 #include "vm/dart.h" |
8 #include "vm/growable_array.h" | 8 #include "vm/growable_array.h" |
9 #include "vm/isolate.h" | 9 #include "vm/isolate.h" |
10 #include "vm/object.h" | 10 #include "vm/object.h" |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 static void UnmarkAll(Isolate* isolate) { | 149 static void UnmarkAll(Isolate* isolate) { |
150 Unmarker unmarker(isolate); | 150 Unmarker unmarker(isolate); |
151 isolate->heap()->IterateObjects(&unmarker); | 151 isolate->heap()->IterateObjects(&unmarker); |
152 } | 152 } |
153 | 153 |
154 private: | 154 private: |
155 DISALLOW_COPY_AND_ASSIGN(Unmarker); | 155 DISALLOW_COPY_AND_ASSIGN(Unmarker); |
156 }; | 156 }; |
157 | 157 |
158 | 158 |
159 ObjectGraph::ObjectGraph(Isolate* isolate) | 159 ObjectGraph::ObjectGraph(Thread* thread) |
160 : StackResource(isolate) { | 160 : StackResource(thread) { |
161 // The VM isolate has all its objects pre-marked, so iterating over it | 161 // The VM isolate has all its objects pre-marked, so iterating over it |
162 // would be a no-op. | 162 // would be a no-op. |
163 ASSERT(isolate != Dart::vm_isolate()); | 163 ASSERT(thread->isolate() != Dart::vm_isolate()); |
164 isolate->heap()->WriteProtectCode(false); | 164 thread->isolate()->heap()->WriteProtectCode(false); |
165 } | 165 } |
166 | 166 |
167 | 167 |
168 ObjectGraph::~ObjectGraph() { | 168 ObjectGraph::~ObjectGraph() { |
169 isolate()->heap()->WriteProtectCode(true); | 169 isolate()->heap()->WriteProtectCode(true); |
170 } | 170 } |
171 | 171 |
172 | 172 |
173 void ObjectGraph::IterateObjects(ObjectGraph::Visitor* visitor) { | 173 void ObjectGraph::IterateObjects(ObjectGraph::Visitor* visitor) { |
174 NoSafepointScope no_safepoint_scope_; | 174 NoSafepointScope no_safepoint_scope_; |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 { | 474 { |
475 WritePointerVisitor ptr_writer(isolate(), stream); | 475 WritePointerVisitor ptr_writer(isolate(), stream); |
476 isolate()->IterateObjectPointers(&ptr_writer, false, false); | 476 isolate()->IterateObjectPointers(&ptr_writer, false, false); |
477 } | 477 } |
478 stream->WriteUnsigned(0); | 478 stream->WriteUnsigned(0); |
479 IterateObjects(&visitor); | 479 IterateObjects(&visitor); |
480 return visitor.count() + 1; // + root | 480 return visitor.count() + 1; // + root |
481 } | 481 } |
482 | 482 |
483 } // namespace dart | 483 } // namespace dart |
OLD | NEW |