| 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 MarkingStackChunk* empty_chunks_; | 109 MarkingStackChunk* empty_chunks_; |
| 110 RawObject** marking_stack_; | 110 RawObject** marking_stack_; |
| 111 uint32_t top_; | 111 uint32_t top_; |
| 112 | 112 |
| 113 DISALLOW_COPY_AND_ASSIGN(MarkingStack); | 113 DISALLOW_COPY_AND_ASSIGN(MarkingStack); |
| 114 }; | 114 }; |
| 115 | 115 |
| 116 | 116 |
| 117 class MarkingVisitor : public ObjectPointerVisitor { | 117 class MarkingVisitor : public ObjectPointerVisitor { |
| 118 public: | 118 public: |
| 119 MarkingVisitor(Heap* heap, PageSpace* page_space, MarkingStack* marking_stack) | 119 MarkingVisitor(Isolate* isolate, |
| 120 : heap_(heap), | 120 Heap* heap, |
| 121 PageSpace* page_space, |
| 122 MarkingStack* marking_stack) |
| 123 : ObjectPointerVisitor(isolate), |
| 124 heap_(heap), |
| 121 vm_heap_(Dart::vm_isolate()->heap()), | 125 vm_heap_(Dart::vm_isolate()->heap()), |
| 122 page_space_(page_space), | 126 page_space_(page_space), |
| 123 marking_stack_(marking_stack) { | 127 marking_stack_(marking_stack) { |
| 124 ASSERT(heap_ != vm_heap_); | 128 ASSERT(heap_ != vm_heap_); |
| 125 } | 129 } |
| 126 | 130 |
| 127 MarkingStack* marking_stack() const { return marking_stack_; } | 131 MarkingStack* marking_stack() const { return marking_stack_; } |
| 128 | 132 |
| 129 void VisitPointers(RawObject** first, RawObject** last) { | 133 void VisitPointers(RawObject** first, RawObject** last) { |
| 130 for (RawObject** current = first; current <= last; current++) { | 134 for (RawObject** current = first; current <= last; current++) { |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 raw_obj->VisitPointers(visitor); | 311 raw_obj->VisitPointers(visitor); |
| 308 } | 312 } |
| 309 } | 313 } |
| 310 | 314 |
| 311 | 315 |
| 312 void GCMarker::MarkObjects(Isolate* isolate, | 316 void GCMarker::MarkObjects(Isolate* isolate, |
| 313 PageSpace* page_space, | 317 PageSpace* page_space, |
| 314 bool invoke_api_callbacks) { | 318 bool invoke_api_callbacks) { |
| 315 MarkingStack marking_stack; | 319 MarkingStack marking_stack; |
| 316 Prologue(isolate, invoke_api_callbacks); | 320 Prologue(isolate, invoke_api_callbacks); |
| 317 MarkingVisitor mark(heap_, page_space, &marking_stack); | 321 MarkingVisitor mark(isolate, heap_, page_space, &marking_stack); |
| 318 IterateRoots(isolate, &mark, !invoke_api_callbacks); | 322 IterateRoots(isolate, &mark, !invoke_api_callbacks); |
| 319 DrainMarkingStack(isolate, &mark); | 323 DrainMarkingStack(isolate, &mark); |
| 320 IterateWeakReferences(isolate, &mark); | 324 IterateWeakReferences(isolate, &mark); |
| 321 MarkingWeakVisitor mark_weak; | 325 MarkingWeakVisitor mark_weak; |
| 322 IterateWeakRoots(isolate, &mark_weak, invoke_api_callbacks); | 326 IterateWeakRoots(isolate, &mark_weak, invoke_api_callbacks); |
| 323 Epilogue(isolate, invoke_api_callbacks); | 327 Epilogue(isolate, invoke_api_callbacks); |
| 324 } | 328 } |
| 325 | 329 |
| 326 } // namespace dart | 330 } // namespace dart |
| OLD | NEW |