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

[heap] Invoke OldGenerationAllocationCounter in Safepoint

OldGenerationAllocationCounter() needs to be invoked in safepoint,
otherwise invocation races with background threads incrementing the
counter.

Bug: v8:10315
Change-Id: Iab005582bab7ebf63e7a5a796b25690f499a99eb
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2235544
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68250}
parent 60f38070
......@@ -228,10 +228,6 @@ void GCTracer::Start(GarbageCollector collector,
if (start_counter_ != 1) return;
previous_ = current_;
double start_time = heap_->MonotonicallyIncreasingTimeInMs();
SampleAllocation(start_time, heap_->NewSpaceAllocationCounter(),
heap_->OldGenerationAllocationCounter(),
heap_->EmbedderAllocationCounter());
switch (collector) {
case SCAVENGER:
......@@ -252,7 +248,7 @@ void GCTracer::Start(GarbageCollector collector,
}
current_.reduce_memory = heap_->ShouldReduceMemory();
current_.start_time = start_time;
current_.start_time = heap_->MonotonicallyIncreasingTimeInMs();
current_.start_object_size = 0;
current_.start_memory_size = 0;
current_.start_holes_size = 0;
......@@ -281,6 +277,10 @@ void GCTracer::Start(GarbageCollector collector,
}
void GCTracer::StartInSafepoint() {
SampleAllocation(current_.start_time, heap_->NewSpaceAllocationCounter(),
heap_->OldGenerationAllocationCounter(),
heap_->EmbedderAllocationCounter());
current_.start_object_size = heap_->SizeOfObjects();
current_.start_memory_size = heap_->memory_allocator()->Size();
current_.start_holes_size = CountTotalHolesSize(heap_);
......
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