[heap] Disable GC during isolate initialization

Bug: chromium:1188212
Change-Id: I2c01544e5ff114d4fbdb853a344eb2b6250ee7ab
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2763881
Reviewed-by: Dominik Inführ <dinfuehr@chromium.org>
Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#73437}
This commit is contained in:
Ulan Degenbaev 2021-03-16 13:49:29 +01:00 committed by Commit Bot
parent ab22d98c6c
commit 6ff9f24be7

View File

@ -1524,6 +1524,14 @@ Heap::DevToolsTraceEventScope::~DevToolsTraceEventScope() {
bool Heap::CollectGarbage(AllocationSpace space,
GarbageCollectionReason gc_reason,
const v8::GCCallbackFlags gc_callback_flags) {
if (V8_UNLIKELY(!deserialization_complete_)) {
// During isolate initialization heap always grows. GC is only requested
// if a new page allocation fails. In such a case we should crash with
// an out-of-memory instead of performing GC because the prologue/epilogue
// callbacks may see objects that are not yet deserialized.
CHECK(always_allocate());
FatalProcessOutOfMemory("GC during deserialization");
}
const char* collector_reason = nullptr;
GarbageCollector collector = SelectGarbageCollector(space, &collector_reason);
is_current_gc_forced_ = gc_callback_flags & v8::kGCCallbackFlagForced ||