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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 public: | 140 public: |
141 explicit Unmarker(Isolate* isolate) : ObjectVisitor(isolate) { } | 141 explicit Unmarker(Isolate* isolate) : ObjectVisitor(isolate) { } |
142 | 142 |
143 void VisitObject(RawObject* obj) { | 143 void VisitObject(RawObject* obj) { |
144 if (obj->IsMarked()) { | 144 if (obj->IsMarked()) { |
145 obj->ClearMarkBit(); | 145 obj->ClearMarkBit(); |
146 } | 146 } |
147 } | 147 } |
148 | 148 |
149 static void UnmarkAll(Isolate* isolate) { | 149 static void UnmarkAll(Isolate* isolate) { |
| 150 PageSpace* old_space = isolate->heap()->old_space(); |
| 151 MonitorLocker ml(old_space->tasks_lock()); |
| 152 while (old_space->tasks() > 0) { |
| 153 ml.Wait(); |
| 154 } |
150 Unmarker unmarker(isolate); | 155 Unmarker unmarker(isolate); |
151 isolate->heap()->VisitObjects(&unmarker); | 156 isolate->heap()->VisitObjects(&unmarker); |
152 } | 157 } |
153 | 158 |
154 private: | 159 private: |
155 DISALLOW_COPY_AND_ASSIGN(Unmarker); | 160 DISALLOW_COPY_AND_ASSIGN(Unmarker); |
156 }; | 161 }; |
157 | 162 |
158 | 163 |
159 ObjectGraph::ObjectGraph(Isolate* isolate) | 164 ObjectGraph::ObjectGraph(Isolate* isolate) |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 { | 462 { |
458 WritePointerVisitor ptr_writer(isolate(), stream); | 463 WritePointerVisitor ptr_writer(isolate(), stream); |
459 isolate()->VisitObjectPointers(&ptr_writer, false, false); | 464 isolate()->VisitObjectPointers(&ptr_writer, false, false); |
460 } | 465 } |
461 stream->WriteUnsigned(0); | 466 stream->WriteUnsigned(0); |
462 IterateObjects(&visitor); | 467 IterateObjects(&visitor); |
463 return visitor.count() + 1; // + root | 468 return visitor.count() + 1; // + root |
464 } | 469 } |
465 | 470 |
466 } // namespace dart | 471 } // namespace dart |
OLD | NEW |