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

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

Issue 10452006: Implement a heap profiler for the Dart managed heap. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: address final review comments Created 8 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/scavenger.h ('k') | runtime/vm/unicode.h » ('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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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/scavenger.h" 5 #include "vm/scavenger.h"
6 6
7 #include "vm/dart.h" 7 #include "vm/dart.h"
8 #include "vm/dart_api_state.h" 8 #include "vm/dart_api_state.h"
9 #include "vm/isolate.h" 9 #include "vm/isolate.h"
10 #include "vm/object.h" 10 #include "vm/object.h"
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 347
348 void Scavenger::VisitObjectPointers(ObjectPointerVisitor* visitor) const { 348 void Scavenger::VisitObjectPointers(ObjectPointerVisitor* visitor) const {
349 uword cur = FirstObjectStart(); 349 uword cur = FirstObjectStart();
350 while (cur < top_) { 350 while (cur < top_) {
351 RawObject* raw_obj = RawObject::FromAddr(cur); 351 RawObject* raw_obj = RawObject::FromAddr(cur);
352 cur += raw_obj->VisitPointers(visitor); 352 cur += raw_obj->VisitPointers(visitor);
353 } 353 }
354 } 354 }
355 355
356 356
357 void Scavenger::VisitObjects(ObjectVisitor* visitor) const {
358 uword cur = FirstObjectStart();
359 while (cur < top_) {
360 RawObject* raw_obj = RawObject::FromAddr(cur);
361 visitor->VisitObject(raw_obj);
362 cur += raw_obj->Size();
363 }
364 }
365
366
357 void Scavenger::Scavenge() { 367 void Scavenger::Scavenge() {
358 // TODO(cshapiro): Add a decision procedure for determining when the 368 // TODO(cshapiro): Add a decision procedure for determining when the
359 // the API callbacks should be invoked. 369 // the API callbacks should be invoked.
360 Scavenge(false); 370 Scavenge(false);
361 } 371 }
362 372
363 373
364 void Scavenger::Scavenge(bool invoke_api_callbacks) { 374 void Scavenger::Scavenge(bool invoke_api_callbacks) {
365 // Scavenging is not reentrant. Make sure that is the case. 375 // Scavenging is not reentrant. Make sure that is the case.
366 ASSERT(!scavenging_); 376 ASSERT(!scavenging_);
(...skipping 30 matching lines...) Expand all
397 OS::PrintErr(" done.\n"); 407 OS::PrintErr(" done.\n");
398 } 408 }
399 409
400 count_++; 410 count_++;
401 // Done scavenging. Reset the marker. 411 // Done scavenging. Reset the marker.
402 ASSERT(scavenging_); 412 ASSERT(scavenging_);
403 scavenging_ = false; 413 scavenging_ = false;
404 } 414 }
405 415
406 } // namespace dart 416 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/scavenger.h ('k') | runtime/vm/unicode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698