Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: runtime/vm/object_graph.cc

Issue 1181943002: Assert no allocation during heap iteration; fix unsafe iteration in ObjectGraph. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: spelling fix Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/heap.h ('k') | runtime/vm/pages.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « runtime/vm/heap.h ('k') | runtime/vm/pages.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698