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

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

Issue 10696029: Implement a 2-pass heap verification algorithm. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase Created 8 years, 5 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/verifier.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 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 375
376 void Scavenger::Scavenge(bool invoke_api_callbacks) { 376 void Scavenger::Scavenge(bool invoke_api_callbacks) {
377 // Scavenging is not reentrant. Make sure that is the case. 377 // Scavenging is not reentrant. Make sure that is the case.
378 ASSERT(!scavenging_); 378 ASSERT(!scavenging_);
379 scavenging_ = true; 379 scavenging_ = true;
380 had_promotion_failure_ = false; 380 had_promotion_failure_ = false;
381 Isolate* isolate = Isolate::Current(); 381 Isolate* isolate = Isolate::Current();
382 NoHandleScope no_handles(isolate); 382 NoHandleScope no_handles(isolate);
383 383
384 if (FLAG_verify_before_gc) { 384 if (FLAG_verify_before_gc) {
385 OS::PrintErr("Verifying before Scavenge... "); 385 OS::PrintErr("Verifying before Scavenge...");
386 heap_->Verify(); 386 heap_->Verify();
387 OS::PrintErr(" done.\n"); 387 OS::PrintErr(" done.\n");
388 } 388 }
389 389
390 Timer timer(FLAG_verbose_gc, "Scavenge"); 390 Timer timer(FLAG_verbose_gc, "Scavenge");
391 timer.Start(); 391 timer.Start();
392 // Setup the visitor and run a scavenge. 392 // Setup the visitor and run a scavenge.
393 ScavengerVisitor visitor(isolate, this); 393 ScavengerVisitor visitor(isolate, this);
394 Prologue(isolate, invoke_api_callbacks); 394 Prologue(isolate, invoke_api_callbacks);
395 IterateRoots(isolate, &visitor, !invoke_api_callbacks); 395 IterateRoots(isolate, &visitor, !invoke_api_callbacks);
396 ProcessToSpace(&visitor); 396 ProcessToSpace(&visitor);
397 IterateWeakReferences(isolate, &visitor); 397 IterateWeakReferences(isolate, &visitor);
398 ScavengerWeakVisitor weak_visitor(this); 398 ScavengerWeakVisitor weak_visitor(this);
399 IterateWeakRoots(isolate, &weak_visitor, invoke_api_callbacks); 399 IterateWeakRoots(isolate, &weak_visitor, invoke_api_callbacks);
400 Epilogue(isolate, invoke_api_callbacks); 400 Epilogue(isolate, invoke_api_callbacks);
401 timer.Stop(); 401 timer.Stop();
402 if (FLAG_verbose_gc) { 402 if (FLAG_verbose_gc) {
403 OS::PrintErr("Scavenge[%d]: %dus\n", count_, timer.TotalElapsedTime()); 403 OS::PrintErr("Scavenge[%d]: %dus\n", count_, timer.TotalElapsedTime());
404 } 404 }
405 405
406 if (FLAG_verify_after_gc) { 406 if (FLAG_verify_after_gc) {
407 OS::PrintErr("Verifying after Scavenge... "); 407 OS::PrintErr("Verifying after Scavenge...");
408 heap_->Verify(); 408 heap_->Verify();
409 OS::PrintErr(" done.\n"); 409 OS::PrintErr(" done.\n");
410 } 410 }
411 411
412 count_++; 412 count_++;
413 // Done scavenging. Reset the marker. 413 // Done scavenging. Reset the marker.
414 ASSERT(scavenging_); 414 ASSERT(scavenging_);
415 scavenging_ = false; 415 scavenging_ = false;
416 } 416 }
417 417
418 } // namespace dart 418 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/scavenger.h ('k') | runtime/vm/verifier.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698