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

Unified Diff: runtime/vm/gc_marker.cc

Issue 18259014: Object ID Ring with tests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/gc_marker.h ('k') | runtime/vm/heap.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/gc_marker.cc
diff --git a/runtime/vm/gc_marker.cc b/runtime/vm/gc_marker.cc
index b7ae253b911a5eccc7bdf976d9632b9e8b6e38e3..c5b5dc80cb069f8aada8a593c875f5d3c89bf201 100644
--- a/runtime/vm/gc_marker.cc
+++ b/runtime/vm/gc_marker.cc
@@ -14,6 +14,7 @@
#include "vm/raw_object.h"
#include "vm/stack_frame.h"
#include "vm/visitor.h"
+#include "vm/object_id_ring.h"
namespace dart {
@@ -399,6 +400,33 @@ void GCMarker::ProcessWeakTables(PageSpace* page_space) {
}
+class ObjectIdRingClearPointerVisitor : public ObjectPointerVisitor {
+ public:
+ explicit ObjectIdRingClearPointerVisitor(Isolate* isolate) :
+ ObjectPointerVisitor(isolate) {}
+
+
+ void VisitPointers(RawObject** first, RawObject** last) {
+ for (RawObject** current = first; current <= last; current++) {
+ RawObject* raw_obj = *current;
+ ASSERT(raw_obj->IsHeapObject());
+ if (raw_obj->IsOldObject() && !raw_obj->IsMarked()) {
+ // Object has become garbage. Replace it will null.
+ *current = Object::null();
+ }
+ }
+ }
+};
+
+
+void GCMarker::ProcessObjectIdTable(Isolate* isolate) {
+ ObjectIdRingClearPointerVisitor visitor(isolate);
+ ObjectIdRing* ring = isolate->object_id_ring();
+ ASSERT(ring != NULL);
+ ring->VisitPointers(&visitor);
+}
+
+
void GCMarker::MarkObjects(Isolate* isolate,
PageSpace* page_space,
bool invoke_api_callbacks) {
@@ -412,6 +440,9 @@ void GCMarker::MarkObjects(Isolate* isolate,
IterateWeakRoots(isolate, &mark_weak, invoke_api_callbacks);
mark.Finalize();
ProcessWeakTables(page_space);
+ ProcessObjectIdTable(isolate);
+
+
Epilogue(isolate, invoke_api_callbacks);
}
« no previous file with comments | « runtime/vm/gc_marker.h ('k') | runtime/vm/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698