Commit b2faa84f authored by Dominik Inführ's avatar Dominik Inführ Committed by Commit Bot

[heap] Remove Heap::NotifyRefinedOldGenerationSize

Now that background threads participate in sweeping, this method
races because multiple threads now want to update that counter. We could
either make this counter atomic or remove it entirely. This CL removes
this counter since it isn't strictly necessary, it is only used when
sweeper finds more garbage than markers. This happens e.g. with
right-trimming but should be rare and is eventually fixed in the next
GC.

Bug: v8:10315
Change-Id: Iebae8937860160a3b49bedd03c2e21e41f7dfe76
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2349296Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69334}
parent f8f7c8b1
......@@ -1284,20 +1284,9 @@ class Heap {
size_t PromotedSinceLastGC() {
size_t old_generation_size = OldGenerationSizeOfObjects();
DCHECK_GE(old_generation_size, old_generation_size_at_last_gc_);
return old_generation_size - old_generation_size_at_last_gc_;
}
// This is called by the sweeper when it discovers more free space
// than expected at the end of the preceding GC.
void NotifyRefinedOldGenerationSize(size_t decreased_bytes) {
if (old_generation_size_at_last_gc_ != 0) {
// OldGenerationSizeOfObjects() is now smaller by |decreased_bytes|.
// Adjust old_generation_size_at_last_gc_ too, so that PromotedSinceLastGC
// continues to increase monotonically, rather than decreasing here.
DCHECK_GE(old_generation_size_at_last_gc_, decreased_bytes);
old_generation_size_at_last_gc_ -= decreased_bytes;
}
return old_generation_size > old_generation_size_at_last_gc_
? old_generation_size - old_generation_size_at_last_gc_
: 0;
}
int gc_count() const { return gc_count_; }
......@@ -2179,7 +2168,7 @@ class Heap {
size_t old_generation_allocation_counter_at_last_gc_ = 0;
// The size of objects in old generation after the last MarkCompact GC.
size_t old_generation_size_at_last_gc_ = 0;
size_t old_generation_size_at_last_gc_{0};
// The size of global memory after the last MarkCompact GC.
size_t global_memory_at_last_gc_ = 0;
......
......@@ -263,9 +263,6 @@ void PagedSpace::RefineAllocatedBytesAfterSweeping(Page* page) {
DCHECK_GE(old_counter, new_counter);
if (old_counter > new_counter) {
DecreaseAllocatedBytes(old_counter - new_counter, page);
// Give the heap a chance to adjust counters in response to the
// more precise and smaller old generation size.
heap()->NotifyRefinedOldGenerationSize(old_counter - new_counter);
}
marking_state->SetLiveBytes(page, 0);
}
......
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