| 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 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 // TODO(iposva): Add consistency check. | 223 // TODO(iposva): Add consistency check. |
| 224 if ((visiting_old_object_ != NULL) && | 224 if ((visiting_old_object_ != NULL) && |
| 225 !visiting_old_object_->IsRemembered()) { | 225 !visiting_old_object_->IsRemembered()) { |
| 226 ASSERT(p != NULL); | 226 ASSERT(p != NULL); |
| 227 visiting_old_object_->SetRememberedBitUnsynchronized(); | 227 visiting_old_object_->SetRememberedBitUnsynchronized(); |
| 228 isolate()->store_buffer()->AddObjectGC(visiting_old_object_); | 228 isolate()->store_buffer()->AddObjectGC(visiting_old_object_); |
| 229 } | 229 } |
| 230 return; | 230 return; |
| 231 } | 231 } |
| 232 if (RawObject::IsVariableSizeClassId(raw_obj->GetClassId())) { | 232 if (RawObject::IsVariableSizeClassId(raw_obj->GetClassId())) { |
| 233 class_table_->UpdateLiveOld(raw_obj->GetClassId(), | 233 class_table_->UpdateLiveOld(raw_obj->GetClassId(), raw_obj->Size()); |
| 234 raw_obj->Size(class_table_)); | |
| 235 } else { | 234 } else { |
| 236 class_table_->UpdateLiveOld(raw_obj->GetClassId(), 0); | 235 class_table_->UpdateLiveOld(raw_obj->GetClassId(), 0); |
| 237 } | 236 } |
| 238 | 237 |
| 239 MarkAndPush(raw_obj); | 238 MarkAndPush(raw_obj); |
| 240 } | 239 } |
| 241 | 240 |
| 242 void DetachCode() { | 241 void DetachCode() { |
| 243 for (int i = 0; i < skipped_code_functions_.length(); i++) { | 242 for (int i = 0; i < skipped_code_functions_.length(); i++) { |
| 244 RawFunction* func = skipped_code_functions_[i]; | 243 RawFunction* func = skipped_code_functions_[i]; |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 RawObject* raw_obj = visitor->marking_stack()->Pop(); | 418 RawObject* raw_obj = visitor->marking_stack()->Pop(); |
| 420 visitor->VisitingOldObject(raw_obj); | 419 visitor->VisitingOldObject(raw_obj); |
| 421 const intptr_t class_id = raw_obj->GetClassId(); | 420 const intptr_t class_id = raw_obj->GetClassId(); |
| 422 // Currently, classes are considered roots (see issue 18284), so at this | 421 // Currently, classes are considered roots (see issue 18284), so at this |
| 423 // point, they should all be marked. | 422 // point, they should all be marked. |
| 424 ASSERT(isolate->class_table()->At(class_id)->IsMarked()); | 423 ASSERT(isolate->class_table()->At(class_id)->IsMarked()); |
| 425 if (class_id != kWeakPropertyCid) { | 424 if (class_id != kWeakPropertyCid) { |
| 426 marked_bytes_ += raw_obj->VisitPointers(visitor); | 425 marked_bytes_ += raw_obj->VisitPointers(visitor); |
| 427 } else { | 426 } else { |
| 428 RawWeakProperty* raw_weak = reinterpret_cast<RawWeakProperty*>(raw_obj); | 427 RawWeakProperty* raw_weak = reinterpret_cast<RawWeakProperty*>(raw_obj); |
| 429 marked_bytes_ += raw_weak->Size(isolate->class_table()); | 428 marked_bytes_ += raw_weak->Size(); |
| 430 ProcessWeakProperty(raw_weak, visitor); | 429 ProcessWeakProperty(raw_weak, visitor); |
| 431 } | 430 } |
| 432 } | 431 } |
| 433 visitor->VisitingOldObject(NULL); | 432 visitor->VisitingOldObject(NULL); |
| 434 } | 433 } |
| 435 | 434 |
| 436 | 435 |
| 437 void GCMarker::ProcessWeakProperty(RawWeakProperty* raw_weak, | 436 void GCMarker::ProcessWeakProperty(RawWeakProperty* raw_weak, |
| 438 MarkingVisitor* visitor) { | 437 MarkingVisitor* visitor) { |
| 439 // The fate of the weak property is determined by its key. | 438 // The fate of the weak property is determined by its key. |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 MarkingWeakVisitor mark_weak; | 515 MarkingWeakVisitor mark_weak; |
| 517 IterateWeakRoots(isolate, &mark_weak, invoke_api_callbacks); | 516 IterateWeakRoots(isolate, &mark_weak, invoke_api_callbacks); |
| 518 mark.Finalize(); | 517 mark.Finalize(); |
| 519 ProcessWeakTables(page_space); | 518 ProcessWeakTables(page_space); |
| 520 ProcessObjectIdTable(isolate); | 519 ProcessObjectIdTable(isolate); |
| 521 } | 520 } |
| 522 Epilogue(isolate, invoke_api_callbacks); | 521 Epilogue(isolate, invoke_api_callbacks); |
| 523 } | 522 } |
| 524 | 523 |
| 525 } // namespace dart | 524 } // namespace dart |
| OLD | NEW |