Commit 0b3b2cb3 authored by Hannes Payer's avatar Hannes Payer Committed by V8 LUCI CQ

[heap] InvokeSecondPassPhantomCallbacks() before selecting garbage collector.

InvokeSecondPassPhantomCallbacks() may allocate which may result in a different GC selection.

Bug: v8:12503
Change-Id: I936634f9b819bc160749e058cbee8fb1c555f376
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3386800Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Commit-Queue: Hannes Payer <hpayer@chromium.org>
Cr-Commit-Position: refs/heads/main@{#78619}
parent 2984052a
......@@ -1672,6 +1672,10 @@ bool Heap::CollectGarbage(AllocationSpace space,
CHECK(always_allocate());
FatalProcessOutOfMemory("GC during deserialization");
}
// Ensure that all pending phantom callbacks are invoked.
isolate()->global_handles()->InvokeSecondPassPhantomCallbacks();
const char* collector_reason = nullptr;
GarbageCollector collector = SelectGarbageCollector(space, &collector_reason);
is_current_gc_forced_ = gc_callback_flags & v8::kGCCallbackFlagForced ||
......@@ -1690,9 +1694,6 @@ bool Heap::CollectGarbage(AllocationSpace space,
->global_handles()
->CleanupOnStackReferencesBelowCurrentStackPosition();
// Ensure that all pending phantom callbacks are invoked.
isolate()->global_handles()->InvokeSecondPassPhantomCallbacks();
// The VM is in the GC state until exiting this function.
VMState<GC> state(isolate());
......
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