| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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/gc_marker.h" | 5 #include "vm/gc_marker.h" |
| 6 | 6 |
| 7 #include "vm/allocation.h" | 7 #include "vm/allocation.h" |
| 8 #include "vm/dart_api_state.h" | 8 #include "vm/dart_api_state.h" |
| 9 #include "vm/isolate.h" | 9 #include "vm/isolate.h" |
| 10 #include "vm/pages.h" | 10 #include "vm/pages.h" |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 | 190 |
| 191 class MarkingWeakVisitor : public HandleVisitor { | 191 class MarkingWeakVisitor : public HandleVisitor { |
| 192 public: | 192 public: |
| 193 MarkingWeakVisitor() { | 193 MarkingWeakVisitor() { |
| 194 } | 194 } |
| 195 | 195 |
| 196 void VisitHandle(uword addr) { | 196 void VisitHandle(uword addr) { |
| 197 WeakPersistentHandle* handle = | 197 WeakPersistentHandle* handle = |
| 198 reinterpret_cast<WeakPersistentHandle*>(addr); | 198 reinterpret_cast<WeakPersistentHandle*>(addr); |
| 199 RawObject* raw_obj = handle->raw(); | 199 RawObject* raw_obj = handle->raw(); |
| 200 ASSERT(raw_obj->IsHeapObject()); | 200 if (!raw_obj->IsHeapObject()) return; |
| 201 if (!raw_obj->IsMarked() && raw_obj->IsOldObject()) { | 201 if (!raw_obj->IsMarked() && raw_obj->IsOldObject()) { |
| 202 WeakPersistentHandle::Finalize(handle); | 202 WeakPersistentHandle::Finalize(handle); |
| 203 } | 203 } |
| 204 } | 204 } |
| 205 | 205 |
| 206 private: | 206 private: |
| 207 DISALLOW_COPY_AND_ASSIGN(MarkingWeakVisitor); | 207 DISALLOW_COPY_AND_ASSIGN(MarkingWeakVisitor); |
| 208 }; | 208 }; |
| 209 | 209 |
| 210 | 210 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 239 MarkingStack marking_stack; | 239 MarkingStack marking_stack; |
| 240 Prologue(isolate); | 240 Prologue(isolate); |
| 241 MarkingVisitor mark(heap_, page_space, &marking_stack); | 241 MarkingVisitor mark(heap_, page_space, &marking_stack); |
| 242 IterateRoots(isolate, &mark); | 242 IterateRoots(isolate, &mark); |
| 243 DrainMarkingStack(isolate, &mark); | 243 DrainMarkingStack(isolate, &mark); |
| 244 MarkingWeakVisitor mark_weak; | 244 MarkingWeakVisitor mark_weak; |
| 245 IterateWeakRoots(isolate, &mark_weak); | 245 IterateWeakRoots(isolate, &mark_weak); |
| 246 } | 246 } |
| 247 | 247 |
| 248 } // namespace dart | 248 } // namespace dart |
| OLD | NEW |