From ff3b7d228e5decb3f3bd885b3cd39dd2ac6a8850 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Mon, 11 Oct 2021 12:49:40 +0200 Subject: [PATCH] src: ensure V8 initialized before marking milestone PR-URL: https://github.com/nodejs/node/pull/40405 Refs: https://github.com/electron/electron/pull/31349 Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: Joyee Cheung --- src/env.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/env.cc b/src/env.cc index 1cc7da1ce15f43..2cb2dccdf32ba4 100644 --- a/src/env.cc +++ b/src/env.cc @@ -458,8 +458,11 @@ void Environment::InitializeMainContext(Local context, environment_start_time_); performance_state_->Mark(performance::NODE_PERFORMANCE_MILESTONE_NODE_START, per_process::node_start_time); - performance_state_->Mark(performance::NODE_PERFORMANCE_MILESTONE_V8_START, - performance::performance_v8_start); + + if (per_process::v8_initialized) { + performance_state_->Mark(performance::NODE_PERFORMANCE_MILESTONE_V8_START, + performance::performance_v8_start); + } } Environment::~Environment() {