Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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(isolate(), allocated_set, |
| 473 this->IterateObjects(&object_visitor); | 474 mark_expectation); |
|
Ivan Posva
2014/10/06 18:38:08
How about?
... object_visitor(
isolate(), allo
koda
2014/10/06 19:24:30
Done.
| |
| 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(isolate(), allocated_set, | |
| 480 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 Loading... | |
| 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 |
| OLD | NEW |