Chromium Code Reviews| Index: runtime/vm/gc_marker.cc |
| diff --git a/runtime/vm/gc_marker.cc b/runtime/vm/gc_marker.cc |
| index b7ae253b911a5eccc7bdf976d9632b9e8b6e38e3..aa4396ed4b4046c27357536535bf0a8535af451a 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,36 @@ void GCMarker::ProcessWeakTables(PageSpace* page_space) { |
| } |
| +class ObjectIdRingClearPointerVisitor : public ObjectPointerVisitor { |
| + public: |
| + explicit ObjectIdRingClearPointerVisitor(Isolate* isolate) : |
| + ObjectPointerVisitor(isolate) {} |
| + |
| + void Clear(RawObject** current) { |
| + RawObject* raw_obj = *current; |
| + ASSERT(raw_obj->IsHeapObject()); |
| + if (!raw_obj->IsMarked()) { |
|
Ivan Posva
2013/07/11 17:01:42
You need to be checking the mark bits on old objec
Cutch
2013/07/11 21:31:47
Done.
|
| + // Object has become garbage. Replace it will null. |
| + *current = Object::null(); |
| + } |
| + } |
| + |
| + void VisitPointers(RawObject** first, RawObject** last) { |
| + for (RawObject** current = first; current <= last; current++) { |
| + Clear(current); |
|
Ivan Posva
2013/07/11 17:01:42
You can move the logic from Clear in here. The nam
Cutch
2013/07/11 21:31:47
Done.
|
| + } |
| + } |
| +}; |
| + |
| + |
| +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 +443,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); |
| } |