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

Unified Diff: vm/heap.cc

Issue 8761006: - Implement a simple old-generation marker. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: '' Created 9 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « vm/heap.h ('k') | vm/heap_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « vm/heap.h ('k') | vm/heap_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698