| Index: vm/heap.cc
|
| ===================================================================
|
| --- vm/heap.cc (revision 1929)
|
| +++ vm/heap.cc (working copy)
|
| @@ -103,29 +103,43 @@
|
| }
|
|
|
|
|
| -void Heap::Init(Isolate* isolate) {
|
| - ASSERT(isolate->heap() == NULL);
|
| - Heap* heap = new Heap();
|
| - isolate->set_heap(heap);
|
| +void Heap::IterateNewPointers(ObjectPointerVisitor* visitor) {
|
| + new_space_->VisitObjectPointers(visitor);
|
| }
|
|
|
|
|
| -bool Heap::Verify() const {
|
| - VerifyPointersVisitor visitor;
|
| - new_space_->VisitObjectPointers(&visitor);
|
| - old_space_->VisitObjectPointers(&visitor);
|
| - code_space_->VisitObjectPointers(&visitor);
|
| - // Only returning a value so that Heap::Validate can be called from an ASSERT.
|
| - return true;
|
| -}
|
| -
|
| -
|
| void Heap::IterateOldPointers(ObjectPointerVisitor* visitor) {
|
| old_space_->VisitObjectPointers(visitor);
|
| code_space_->VisitObjectPointers(visitor);
|
| }
|
|
|
|
|
| +void Heap::CollectGarbage(Space space) {
|
| + switch (space) {
|
| + case kNew:
|
| + new_space_->Scavenge();
|
| + break;
|
| + case kOld:
|
| + old_space_->MarkSweep();
|
| + break;
|
| + case kExecutable:
|
| + UNIMPLEMENTED();
|
| + code_space_->MarkSweep();
|
| + break;
|
| + default:
|
| + UNREACHABLE();
|
| + }
|
| +}
|
| +
|
| +
|
| +void Heap::CollectAllGarbage() {
|
| + new_space_->Scavenge();
|
| + old_space_->MarkSweep();
|
| + // TODO(iposva): Merge old and code space.
|
| + // code_space_->MarkSweep();
|
| +}
|
| +
|
| +
|
| uword Heap::TopAddress() {
|
| return reinterpret_cast<uword>(new_space_->TopAddress());
|
| }
|
| @@ -136,6 +150,23 @@
|
| }
|
|
|
|
|
| +void Heap::Init(Isolate* isolate) {
|
| + ASSERT(isolate->heap() == NULL);
|
| + Heap* heap = new Heap();
|
| + isolate->set_heap(heap);
|
| +}
|
| +
|
| +
|
| +bool Heap::Verify() const {
|
| + VerifyPointersVisitor visitor;
|
| + new_space_->VisitObjectPointers(&visitor);
|
| + old_space_->VisitObjectPointers(&visitor);
|
| + code_space_->VisitObjectPointers(&visitor);
|
| + // Only returning a value so that Heap::Validate can be called from an ASSERT.
|
| + return true;
|
| +}
|
| +
|
| +
|
| #if defined(DEBUG)
|
| NoGCScope::NoGCScope() : StackResource(Isolate::Current()) {
|
| isolate()->IncrementNoGCScopeDepth();
|
|
|