| 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 bool visit_function_code) | 127 bool visit_function_code) |
| 128 : ObjectPointerVisitor(isolate), | 128 : ObjectPointerVisitor(isolate), |
| 129 heap_(heap), | 129 heap_(heap), |
| 130 vm_heap_(Dart::vm_isolate()->heap()), | 130 vm_heap_(Dart::vm_isolate()->heap()), |
| 131 class_table_(isolate->class_table()), |
| 131 page_space_(page_space), | 132 page_space_(page_space), |
| 132 marking_stack_(marking_stack), | 133 marking_stack_(marking_stack), |
| 133 visiting_old_object_(NULL), | 134 visiting_old_object_(NULL), |
| 134 visit_function_code_(visit_function_code) { | 135 visit_function_code_(visit_function_code) { |
| 135 ASSERT(heap_ != vm_heap_); | 136 ASSERT(heap_ != vm_heap_); |
| 136 } | 137 } |
| 137 | 138 |
| 138 MarkingStack* marking_stack() const { return marking_stack_; } | 139 MarkingStack* marking_stack() const { return marking_stack_; } |
| 139 | 140 |
| 140 void VisitPointers(RawObject** first, RawObject** last) { | 141 void VisitPointers(RawObject** first, RawObject** last) { |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 if (raw_obj->IsNewObject()) { | 220 if (raw_obj->IsNewObject()) { |
| 220 // TODO(iposva): Add consistency check. | 221 // TODO(iposva): Add consistency check. |
| 221 if ((visiting_old_object_ != NULL) && | 222 if ((visiting_old_object_ != NULL) && |
| 222 !visiting_old_object_->IsRemembered()) { | 223 !visiting_old_object_->IsRemembered()) { |
| 223 ASSERT(p != NULL); | 224 ASSERT(p != NULL); |
| 224 visiting_old_object_->SetRememberedBit(); | 225 visiting_old_object_->SetRememberedBit(); |
| 225 isolate()->store_buffer()->AddObjectGC(visiting_old_object_); | 226 isolate()->store_buffer()->AddObjectGC(visiting_old_object_); |
| 226 } | 227 } |
| 227 return; | 228 return; |
| 228 } | 229 } |
| 230 if (RawObject::IsVariableSizeClassId(raw_obj->GetClassId())) { |
| 231 class_table_->UpdateLiveOld(raw_obj->GetClassId(), raw_obj->Size()); |
| 232 } else { |
| 233 class_table_->UpdateLiveOld(raw_obj->GetClassId(), 0); |
| 234 } |
| 229 | 235 |
| 230 MarkAndPush(raw_obj); | 236 MarkAndPush(raw_obj); |
| 231 } | 237 } |
| 232 | 238 |
| 233 void DetachCode() { | 239 void DetachCode() { |
| 234 for (int i = 0; i < skipped_code_functions_.length(); i++) { | 240 for (int i = 0; i < skipped_code_functions_.length(); i++) { |
| 235 RawFunction* func = skipped_code_functions_[i]; | 241 RawFunction* func = skipped_code_functions_[i]; |
| 236 RawCode* code = func->ptr()->code_; | 242 RawCode* code = func->ptr()->code_; |
| 237 if (!code->IsMarked()) { | 243 if (!code->IsMarked()) { |
| 238 // If the code wasn't strongly visited through other references | 244 // If the code wasn't strongly visited through other references |
| (...skipping 11 matching lines...) Expand all Loading... |
| 250 String name; | 256 String name; |
| 251 name = func->ptr()->name_; | 257 name = func->ptr()->name_; |
| 252 OS::Print("Detaching code: %s\n", name.ToCString()); | 258 OS::Print("Detaching code: %s\n", name.ToCString()); |
| 253 } | 259 } |
| 254 } | 260 } |
| 255 } | 261 } |
| 256 } | 262 } |
| 257 | 263 |
| 258 Heap* heap_; | 264 Heap* heap_; |
| 259 Heap* vm_heap_; | 265 Heap* vm_heap_; |
| 266 ClassTable* class_table_; |
| 260 PageSpace* page_space_; | 267 PageSpace* page_space_; |
| 261 MarkingStack* marking_stack_; | 268 MarkingStack* marking_stack_; |
| 262 RawObject* visiting_old_object_; | 269 RawObject* visiting_old_object_; |
| 263 typedef std::multimap<RawObject*, RawWeakProperty*> DelaySet; | 270 typedef std::multimap<RawObject*, RawWeakProperty*> DelaySet; |
| 264 DelaySet delay_set_; | 271 DelaySet delay_set_; |
| 265 const bool visit_function_code_; | 272 const bool visit_function_code_; |
| 266 GrowableArray<RawFunction*> skipped_code_functions_; | 273 GrowableArray<RawFunction*> skipped_code_functions_; |
| 267 | 274 |
| 268 DISALLOW_IMPLICIT_CONSTRUCTORS(MarkingVisitor); | 275 DISALLOW_IMPLICIT_CONSTRUCTORS(MarkingVisitor); |
| 269 }; | 276 }; |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 MarkingWeakVisitor mark_weak; | 491 MarkingWeakVisitor mark_weak; |
| 485 IterateWeakRoots(isolate, &mark_weak, invoke_api_callbacks); | 492 IterateWeakRoots(isolate, &mark_weak, invoke_api_callbacks); |
| 486 mark.Finalize(); | 493 mark.Finalize(); |
| 487 ProcessWeakTables(page_space); | 494 ProcessWeakTables(page_space); |
| 488 ProcessObjectIdTable(isolate); | 495 ProcessObjectIdTable(isolate); |
| 489 | 496 |
| 490 Epilogue(isolate, invoke_api_callbacks); | 497 Epilogue(isolate, invoke_api_callbacks); |
| 491 } | 498 } |
| 492 | 499 |
| 493 } // namespace dart | 500 } // namespace dart |
| OLD | NEW |