[vm, gc] Update old allocation stats when scanning instead of pushing.

Avoids the incremental barrier needing to deal with allocation stats, and avoids a repeated size calculation.

Bug: https://github.com/dart-lang/sdk/issues/34002
Change-Id: I9104ffca30174a3e659c93d20b4888678e8e759a
Reviewed-on: https://dart-review.googlesource.com/68221
Reviewed-by: Zach Anderson <zra@google.com>
This commit is contained in:
Ryan Macnak 2018-08-07 17:49:03 +00:00
parent d933d4aa39
commit c439ebead0
2 changed files with 7 additions and 11 deletions

View file

@ -219,13 +219,18 @@ class MarkingVisitorBase : public ObjectPointerVisitor {
// First drain the marking stacks.
VisitingOldObject(raw_obj);
const intptr_t class_id = raw_obj->GetClassId();
intptr_t size;
if (class_id != kWeakPropertyCid) {
marked_bytes_ += raw_obj->VisitPointersNonvirtual(this);
size = raw_obj->VisitPointersNonvirtual(this);
} else {
RawWeakProperty* raw_weak =
reinterpret_cast<RawWeakProperty*>(raw_obj);
marked_bytes_ += ProcessWeakProperty(raw_weak);
size = ProcessWeakProperty(raw_weak);
}
marked_bytes_ += size;
NOT_IN_PRODUCT(UpdateLiveOld(class_id, size));
raw_obj = work_list_.Pop();
} while (raw_obj != NULL);
@ -354,14 +359,6 @@ class MarkingVisitorBase : public ObjectPointerVisitor {
return;
}
#ifndef PRODUCT
if (RawObject::IsVariableSizeClassId(raw_obj->GetClassId())) {
UpdateLiveOld(raw_obj->GetClassId(), raw_obj->Size());
} else {
UpdateLiveOld(raw_obj->GetClassId(), 0);
}
#endif // !PRODUCT
PushMarked(raw_obj);
}

View file

@ -49,7 +49,6 @@ class GCMarker : public ValueObject {
Heap* heap_;
Mutex stats_mutex_;
// TODO(koda): Remove after verifying it's redundant w.r.t. ClassHeapStats.
uintptr_t marked_bytes_;
friend class MarkTask;