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

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

Issue 1090053003: - Avoid inconsistency of for example IterateObjects vs VisitObjects. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/object_test.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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 Unmarker unmarker(isolate); 150 Unmarker unmarker(isolate);
151 isolate->heap()->IterateObjects(&unmarker); 151 isolate->heap()->VisitObjects(&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(Isolate* isolate)
160 : StackResource(isolate) { 160 : StackResource(isolate) {
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
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 const Array& references_; 360 const Array& references_;
361 Object* scratch_; 361 Object* scratch_;
362 intptr_t length_; 362 intptr_t length_;
363 }; 363 };
364 364
365 365
366 intptr_t ObjectGraph::InboundReferences(Object* obj, const Array& references) { 366 intptr_t ObjectGraph::InboundReferences(Object* obj, const Array& references) {
367 Object& scratch = Object::Handle(); 367 Object& scratch = Object::Handle();
368 NoSafepointScope no_safepoint_scope_; 368 NoSafepointScope no_safepoint_scope_;
369 InboundReferencesVisitor visitor(isolate(), obj->raw(), references, &scratch); 369 InboundReferencesVisitor visitor(isolate(), obj->raw(), references, &scratch);
370 isolate()->heap()->IterateObjects(&visitor); 370 isolate()->heap()->VisitObjects(&visitor);
371 return visitor.length(); 371 return visitor.length();
372 } 372 }
373 373
374 374
375 static void WritePtr(RawObject* raw, WriteStream* stream) { 375 static void WritePtr(RawObject* raw, WriteStream* stream) {
376 ASSERT(raw->IsHeapObject()); 376 ASSERT(raw->IsHeapObject());
377 ASSERT(raw->IsOldObject()); 377 ASSERT(raw->IsOldObject());
378 uword addr = RawObject::ToAddr(raw); 378 uword addr = RawObject::ToAddr(raw);
379 ASSERT(Utils::IsAligned(addr, kObjectAlignment)); 379 ASSERT(Utils::IsAligned(addr, kObjectAlignment));
380 // Using units of kObjectAlignment makes the ids fit into Smis when parsed 380 // Using units of kObjectAlignment makes the ids fit into Smis when parsed
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 stream->WriteUnsigned(0); 455 stream->WriteUnsigned(0);
456 { 456 {
457 WritePointerVisitor ptr_writer(isolate(), stream); 457 WritePointerVisitor ptr_writer(isolate(), stream);
458 isolate()->VisitObjectPointers(&ptr_writer, false, false); 458 isolate()->VisitObjectPointers(&ptr_writer, false, false);
459 } 459 }
460 stream->WriteUnsigned(0); 460 stream->WriteUnsigned(0);
461 IterateObjects(&visitor); 461 IterateObjects(&visitor);
462 } 462 }
463 463
464 } // namespace dart 464 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/object_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698