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 <map> | 7 #include <map> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "vm/allocation.h" | 10 #include "vm/allocation.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 | 120 |
121 class MarkingVisitor : public ObjectPointerVisitor { | 121 class MarkingVisitor : public ObjectPointerVisitor { |
122 public: | 122 public: |
123 MarkingVisitor(Isolate* isolate, | 123 MarkingVisitor(Isolate* isolate, |
124 Heap* heap, | 124 Heap* heap, |
125 PageSpace* page_space, | 125 PageSpace* page_space, |
126 MarkingStack* marking_stack) | 126 MarkingStack* marking_stack) |
127 : ObjectPointerVisitor(isolate), | 127 : ObjectPointerVisitor(isolate), |
128 heap_(heap), | 128 heap_(heap), |
129 vm_heap_(Dart::vm_isolate()->heap()), | 129 vm_heap_(Dart::vm_isolate()->heap()), |
| 130 class_table_(isolate->class_table()), |
130 page_space_(page_space), | 131 page_space_(page_space), |
131 marking_stack_(marking_stack), | 132 marking_stack_(marking_stack), |
132 visiting_old_object_(NULL) { | 133 visiting_old_object_(NULL) { |
133 ASSERT(heap_ != vm_heap_); | 134 ASSERT(heap_ != vm_heap_); |
134 } | 135 } |
135 | 136 |
136 MarkingStack* marking_stack() const { return marking_stack_; } | 137 MarkingStack* marking_stack() const { return marking_stack_; } |
137 | 138 |
138 void VisitPointers(RawObject** first, RawObject** last) { | 139 void VisitPointers(RawObject** first, RawObject** last) { |
139 for (RawObject** current = first; current <= last; current++) { | 140 for (RawObject** current = first; current <= last; current++) { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 | 203 |
203 // Skip over new objects, but verify consistency of heap while at it. | 204 // Skip over new objects, but verify consistency of heap while at it. |
204 if (raw_obj->IsNewObject()) { | 205 if (raw_obj->IsNewObject()) { |
205 // TODO(iposva): Add consistency check. | 206 // TODO(iposva): Add consistency check. |
206 if ((visiting_old_object_ != NULL) && | 207 if ((visiting_old_object_ != NULL) && |
207 !visiting_old_object_->IsRemembered()) { | 208 !visiting_old_object_->IsRemembered()) { |
208 ASSERT(p != NULL); | 209 ASSERT(p != NULL); |
209 visiting_old_object_->SetRememberedBit(); | 210 visiting_old_object_->SetRememberedBit(); |
210 isolate()->store_buffer()->AddObjectGC(visiting_old_object_); | 211 isolate()->store_buffer()->AddObjectGC(visiting_old_object_); |
211 } | 212 } |
| 213 class_table_->ReportLiveNewSpace(raw_obj->GetClassId(), raw_obj->Size()); |
212 return; | 214 return; |
213 } | 215 } |
214 | 216 class_table_->ReportLiveOldSpace(raw_obj->GetClassId(), raw_obj->Size()); |
215 MarkAndPush(raw_obj); | 217 MarkAndPush(raw_obj); |
216 } | 218 } |
217 | 219 |
218 Heap* heap_; | 220 Heap* heap_; |
219 Heap* vm_heap_; | 221 Heap* vm_heap_; |
| 222 ClassTable* class_table_; |
220 PageSpace* page_space_; | 223 PageSpace* page_space_; |
221 MarkingStack* marking_stack_; | 224 MarkingStack* marking_stack_; |
222 RawObject* visiting_old_object_; | 225 RawObject* visiting_old_object_; |
223 typedef std::multimap<RawObject*, RawWeakProperty*> DelaySet; | 226 typedef std::multimap<RawObject*, RawWeakProperty*> DelaySet; |
224 DelaySet delay_set_; | 227 DelaySet delay_set_; |
225 | 228 |
226 DISALLOW_IMPLICIT_CONSTRUCTORS(MarkingVisitor); | 229 DISALLOW_IMPLICIT_CONSTRUCTORS(MarkingVisitor); |
227 }; | 230 }; |
228 | 231 |
229 | 232 |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 IterateWeakRoots(isolate, &mark_weak, invoke_api_callbacks); | 443 IterateWeakRoots(isolate, &mark_weak, invoke_api_callbacks); |
441 mark.Finalize(); | 444 mark.Finalize(); |
442 ProcessWeakTables(page_space); | 445 ProcessWeakTables(page_space); |
443 ProcessObjectIdTable(isolate); | 446 ProcessObjectIdTable(isolate); |
444 | 447 |
445 | 448 |
446 Epilogue(isolate, invoke_api_callbacks); | 449 Epilogue(isolate, invoke_api_callbacks); |
447 } | 450 } |
448 | 451 |
449 } // namespace dart | 452 } // namespace dart |
OLD | NEW |