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

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

Issue 630933002: Check mark bit when verifying heap. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 2 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/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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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/heap.h" 5 #include "vm/heap.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "platform/utils.h" 8 #include "platform/utils.h"
9 #include "vm/flags.h" 9 #include "vm/flags.h"
10 #include "vm/isolate.h" 10 #include "vm/isolate.h"
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 uword old_start; 453 uword old_start;
454 uword old_end; 454 uword old_end;
455 old_space_->StartEndAddress(&old_start, &old_end); 455 old_space_->StartEndAddress(&old_start, &old_end);
456 *start = Utils::Minimum(old_start, *start); 456 *start = Utils::Minimum(old_start, *start);
457 *end = Utils::Maximum(old_end, *end); 457 *end = Utils::Maximum(old_end, *end);
458 } 458 }
459 ASSERT(*start <= *end); 459 ASSERT(*start <= *end);
460 } 460 }
461 461
462 462
463 ObjectSet* Heap::CreateAllocatedObjectSet() const { 463 ObjectSet* Heap::CreateAllocatedObjectSet(
464 MarkExpectation mark_expectation) const {
464 uword start = static_cast<uword>(-1); 465 uword start = static_cast<uword>(-1);
465 uword end = 0; 466 uword end = 0;
466 Isolate* vm_isolate = Dart::vm_isolate(); 467 Isolate* vm_isolate = Dart::vm_isolate();
467 vm_isolate->heap()->GetMergedAddressRange(&start, &end); 468 vm_isolate->heap()->GetMergedAddressRange(&start, &end);
468 this->GetMergedAddressRange(&start, &end); 469 this->GetMergedAddressRange(&start, &end);
469 470
470 ObjectSet* allocated_set = new ObjectSet(start, end); 471 ObjectSet* allocated_set = new ObjectSet(start, end);
471 472 {
472 VerifyObjectVisitor object_visitor(isolate(), allocated_set); 473 VerifyObjectVisitor object_visitor(
473 this->IterateObjects(&object_visitor); 474 isolate(), allocated_set, mark_expectation);
474 vm_isolate->heap()->IterateObjects(&object_visitor); 475 this->IterateObjects(&object_visitor);
475 476 }
477 {
478 // VM isolate heap is premarked.
479 VerifyObjectVisitor vm_object_visitor(
480 isolate(), allocated_set, kRequireMarked);
481 vm_isolate->heap()->IterateObjects(&vm_object_visitor);
482 }
476 return allocated_set; 483 return allocated_set;
477 } 484 }
478 485
479 486
480 bool Heap::Verify() const { 487 bool Heap::Verify(MarkExpectation mark_expectation) const {
481 ObjectSet* allocated_set = CreateAllocatedObjectSet(); 488 ObjectSet* allocated_set = CreateAllocatedObjectSet(mark_expectation);
482 VerifyPointersVisitor visitor(isolate(), allocated_set); 489 VerifyPointersVisitor visitor(isolate(), allocated_set);
483 IteratePointers(&visitor); 490 IteratePointers(&visitor);
484 delete allocated_set; 491 delete allocated_set;
485 // Only returning a value so that Heap::Validate can be called from an ASSERT. 492 // Only returning a value so that Heap::Validate can be called from an ASSERT.
486 return true; 493 return true;
487 } 494 }
488 495
489 496
490 void Heap::PrintSizes() const { 497 void Heap::PrintSizes() const {
491 OS::PrintErr("New space (%" Pd "k of %" Pd "k) " 498 OS::PrintErr("New space (%" Pd "k of %" Pd "k) "
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 heap->DisableGrowthControl(); 724 heap->DisableGrowthControl();
718 } 725 }
719 726
720 727
721 NoHeapGrowthControlScope::~NoHeapGrowthControlScope() { 728 NoHeapGrowthControlScope::~NoHeapGrowthControlScope() {
722 Heap* heap = reinterpret_cast<Isolate*>(isolate())->heap(); 729 Heap* heap = reinterpret_cast<Isolate*>(isolate())->heap();
723 heap->SetGrowthControlState(current_growth_controller_state_); 730 heap->SetGrowthControlState(current_growth_controller_state_);
724 } 731 }
725 732
726 } // namespace dart 733 } // 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