[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: Ulan Degenbaev <ulan@chromium.org> Cr-Commit-Position: refs/heads/master@{#68250}
This commit is contained in:
parent
60f38070d7
commit
8bdd4e86ad
@ -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_);
|
||||
|
Loading…
Reference in New Issue
Block a user