[heap] Expand new space in safepoint

Move expansion of the new space into the safepoint. Otherwise background
threads race with the main thread when accessing the new space capacity.
This will most likely also be required to allow the allocation of new
space objects from background threads.

Reland of https://crrev.com/c/2235539, the timeouts were unrelated to this CL.

Bug: v8:10315
Change-Id: I134b4f27ec666cf036c346b847d164255e0fe7d7
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2237626
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68284}
This commit is contained in:
Dominik Inführ 2020-06-09 15:01:33 +02:00 committed by Commit Bot
parent e512da1e39
commit 80989b9246
2 changed files with 7 additions and 1 deletions

View File

@ -862,7 +862,6 @@ void Heap::GarbageCollectionPrologue() {
} else {
maximum_size_scavenges_ = 0;
}
CheckNewSpaceExpansionCriteria();
UpdateNewSpaceAllocationCounter();
if (FLAG_track_retaining_path) {
retainer_.clear();
@ -872,6 +871,10 @@ void Heap::GarbageCollectionPrologue() {
memory_allocator()->unmapper()->PrepareForGC();
}
void Heap::GarbageCollectionPrologueInSafepoint() {
CheckNewSpaceExpansionCriteria();
}
size_t Heap::SizeOfObjects() {
size_t total = 0;
@ -2097,6 +2100,8 @@ size_t Heap::PerformGarbageCollection(
#endif
tracer()->StartInSafepoint();
GarbageCollectionPrologueInSafepoint();
EnsureFromSpaceIsCommitted();
size_t start_young_generation_size =

View File

@ -1786,6 +1786,7 @@ class Heap {
// Code that should be run before and after each GC. Includes some
// reporting/verification activities when compiled with DEBUG set.
void GarbageCollectionPrologue();
void GarbageCollectionPrologueInSafepoint();
void GarbageCollectionEpilogue();
void GarbageCollectionEpilogueInSafepoint();