Commit 87d9f757 authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

[heap] MinorMC: Avoid unecessarily updating allocation sites

AllocationSite objects survive if a page moves within new space. The
intended behavior was to update the count only when they are visited by
the Scavenger the first time, as they would die afterwards.

This fixes that case where we would move a page within new space where
most objects survive. We would unnecessarily update the AllocationSite
in this case.

Bug: chromium:651354
Change-Id: Ife4dd3e7f60320e0050e7c83dfc5457f66e2287c
Reviewed-on: https://chromium-review.googlesource.com/541302Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46052}
parent 21cbc914
...@@ -1781,8 +1781,6 @@ class EvacuateNewSpaceVisitor final : public EvacuateVisitorBase { ...@@ -1781,8 +1781,6 @@ class EvacuateNewSpaceVisitor final : public EvacuateVisitorBase {
local_pretenuring_feedback_(local_pretenuring_feedback) {} local_pretenuring_feedback_(local_pretenuring_feedback) {}
inline bool Visit(HeapObject* object) override { inline bool Visit(HeapObject* object) override {
heap_->UpdateAllocationSite<Heap::kCached>(object,
local_pretenuring_feedback_);
int size = object->Size(); int size = object->Size();
HeapObject* target_object = nullptr; HeapObject* target_object = nullptr;
if (heap_->ShouldBePromoted(object->address(), size) && if (heap_->ShouldBePromoted(object->address(), size) &&
...@@ -1791,6 +1789,8 @@ class EvacuateNewSpaceVisitor final : public EvacuateVisitorBase { ...@@ -1791,6 +1789,8 @@ class EvacuateNewSpaceVisitor final : public EvacuateVisitorBase {
promoted_size_ += size; promoted_size_ += size;
return true; return true;
} }
heap_->UpdateAllocationSite<Heap::kCached>(object,
local_pretenuring_feedback_);
HeapObject* target = nullptr; HeapObject* target = nullptr;
AllocationSpace space = AllocateTargetObject(object, &target); AllocationSpace space = AllocateTargetObject(object, &target);
MigrateObject(HeapObject::cast(target), object, size, space); MigrateObject(HeapObject::cast(target), object, size, space);
...@@ -1935,9 +1935,10 @@ class EvacuateNewSpacePageVisitor final : public HeapObjectVisitor { ...@@ -1935,9 +1935,10 @@ class EvacuateNewSpacePageVisitor final : public HeapObjectVisitor {
} }
inline bool Visit(HeapObject* object) { inline bool Visit(HeapObject* object) {
heap_->UpdateAllocationSite<Heap::kCached>(object, if (mode == NEW_TO_NEW) {
local_pretenuring_feedback_); heap_->UpdateAllocationSite<Heap::kCached>(object,
if (mode == NEW_TO_OLD) { local_pretenuring_feedback_);
} else if (mode == NEW_TO_OLD) {
object->IterateBodyFast(record_visitor_); object->IterateBodyFast(record_visitor_);
} }
return true; return true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment