From 0b4d88046013e2e848403663b7abe35dce4c4bab Mon Sep 17 00:00:00 2001 From: Andreas Haas Date: Thu, 30 Jan 2025 14:45:28 +0100 Subject: [PATCH] Initialize the CppHeap process before V8 cppgc::InitializeProcess should be called first, so that in V8::Initialize a default call to cppgc::InitializeProcess can be done if it has not happpened. --- src/node.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/node.cc b/src/node.cc index 44aedea74a3d3f..c98ffc3793eb0a 100644 --- a/src/node.cc +++ b/src/node.cc @@ -1177,10 +1177,6 @@ InitializeOncePerProcessInternal(const std::vector& args, result->platform_ = per_process::v8_platform.Platform(); } - if (!(flags & ProcessInitializationFlags::kNoInitializeV8)) { - V8::Initialize(); - } - if (!(flags & ProcessInitializationFlags::kNoInitializeCppgc)) { v8::PageAllocator* allocator = nullptr; if (result->platform_ != nullptr) { @@ -1189,6 +1185,10 @@ InitializeOncePerProcessInternal(const std::vector& args, cppgc::InitializeProcess(allocator); } + if (!(flags & ProcessInitializationFlags::kNoInitializeV8)) { + V8::Initialize(); + } + #if NODE_USE_V8_WASM_TRAP_HANDLER bool use_wasm_trap_handler = !per_process::cli_options->disable_wasm_trap_handler;