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

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: added basic test code 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
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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 337
338 void Scavenger::VisitObjectPointers(ObjectPointerVisitor* visitor) const { 338 void Scavenger::VisitObjectPointers(ObjectPointerVisitor* visitor) const {
339 uword cur = FirstObjectStart(); 339 uword cur = FirstObjectStart();
340 while (cur < top_) { 340 while (cur < top_) {
341 RawObject* raw_obj = RawObject::FromAddr(cur); 341 RawObject* raw_obj = RawObject::FromAddr(cur);
342 cur += raw_obj->VisitPointers(visitor); 342 cur += raw_obj->VisitPointers(visitor);
343 } 343 }
344 } 344 }
345 345
346 346
347 void Scavenger::VisitObjects(ObjectVisitor* visitor) const {
348 uword cur = FirstObjectStart();
349 while (cur < top_) {
350 RawObject* raw_obj = RawObject::FromAddr(cur);
351 visitor->VisitObject(raw_obj);
352 cur += raw_obj->Size();
353 }
354 }
355
356
347 void Scavenger::Scavenge() { 357 void Scavenger::Scavenge() {
348 // TODO(cshapiro): Add a decision procedure for determining when the 358 // TODO(cshapiro): Add a decision procedure for determining when the
349 // the API callbacks should be invoked. 359 // the API callbacks should be invoked.
350 Scavenge(false); 360 Scavenge(false);
351 } 361 }
352 362
353 363
354 void Scavenger::Scavenge(bool invoke_api_callbacks) { 364 void Scavenger::Scavenge(bool invoke_api_callbacks) {
355 // Scavenging is not reentrant. Make sure that is the case. 365 // Scavenging is not reentrant. Make sure that is the case.
356 ASSERT(!scavenging_); 366 ASSERT(!scavenging_);
(...skipping 30 matching lines...) Expand all
387 OS::PrintErr(" done.\n"); 397 OS::PrintErr(" done.\n");
388 } 398 }
389 399
390 count_++; 400 count_++;
391 // Done scavenging. Reset the marker. 401 // Done scavenging. Reset the marker.
392 ASSERT(scavenging_); 402 ASSERT(scavenging_);
393 scavenging_ = false; 403 scavenging_ = false;
394 } 404 }
395 405
396 } // namespace dart 406 } // namespace dart
OLDNEW
« runtime/vm/raw_object.h ('K') | « runtime/vm/scavenger.h ('k') | runtime/vm/unicode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698