[heap] Allow background threads to expand the heap on tear down

Garbage collection requests from background threads are ignored if
the heap is tearing down. This fixes CanExpandOldGenerationBackground
to check for that case.

Bug: v8:10315
Change-Id: I79b6a4446bf3c9037dbca54849c87f022be76b49
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2387964
Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69666}
This commit is contained in:
Ulan Degenbaev 2020-09-02 12:00:08 +02:00 committed by Commit Bot
parent b22aa7865a
commit 1d53ad7ecc

View File

@ -404,7 +404,10 @@ bool Heap::CanExpandOldGeneration(size_t size) {
bool Heap::CanExpandOldGenerationBackground(size_t size) {
if (force_oom_) return false;
return memory_allocator()->Size() + size <= MaxReserved();
// When the heap is tearing down, then GC requests from background threads
// are not served and the threads are allowed to expand the heap to avoid OOM.
return gc_state() == TEAR_DOWN ||
memory_allocator()->Size() + size <= MaxReserved();
}
bool Heap::HasBeenSetUp() const {