From 30801b8aafb9fe7a560d668e3a9212fbdb6ea2db Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Sun, 14 Apr 2024 22:59:45 +0200 Subject: [PATCH] deps: V8: cherry-pick cd10ad7cdbe5 Original commit message: [compiler] reset script details in functions deserialized from code cache During the serialization of the code cache, V8 would wipe out the host-defined options, so after a script id deserialized from the code cache, the host-defined options need to be reset on the script using what's provided by the embedder when doing the deserializing compilation, otherwise the HostImportModuleDynamically callbacks can't get the data it needs to implement dynamic import(). Change-Id: I33cc6a5e43b6469d3527242e083f7ae6d8ed0c6a Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5401780 Reviewed-by: Leszek Swirski Commit-Queue: Joyee Cheung Cr-Commit-Position: refs/heads/main@{#93323} Refs: https://github.com/v8/v8/commit/cd10ad7cdbe558e06dd0e8a8923834be8efdf245 PR-URL: https://github.com/nodejs/node/pull/52535 Refs: https://github.com/nodejs/node/issues/47472 Reviewed-By: Benjamin Gruenbaum Reviewed-By: Yagiz Nizipli Reviewed-By: Mohammed Keyvanzadeh PR-URL: https://github.com/nodejs/node/pull/52465 Reviewed-By: Matteo Collina Reviewed-By: Rafael Gonzaga Reviewed-By: Michael Dawson --- common.gypi | 2 +- deps/v8/src/codegen/compiler.cc | 19 +-- deps/v8/src/codegen/compiler.h | 2 +- deps/v8/src/codegen/script-details.h | 3 + deps/v8/src/snapshot/code-serializer.cc | 34 ++-- deps/v8/src/snapshot/code-serializer.h | 5 +- deps/v8/test/cctest/test-serialize.cc | 209 ++++++++++++++++++++++++ 7 files changed, 247 insertions(+), 27 deletions(-) diff --git a/common.gypi b/common.gypi index de019fdd6d7..e2b8476f332 100644 --- a/common.gypi +++ b/common.gypi @@ -37,7 +37,7 @@ # Reset this number to 0 on major V8 upgrades. # Increment by one for each non-official patch applied to deps/v8. - 'v8_embedder_string': '-node.9', + 'v8_embedder_string': '-node.10', ##### V8 defaults for Node.js ##### diff --git a/deps/v8/src/codegen/compiler.cc b/deps/v8/src/codegen/compiler.cc index a2984d39316..49afab11b6c 100644 --- a/deps/v8/src/codegen/compiler.cc +++ b/deps/v8/src/codegen/compiler.cc @@ -1720,10 +1720,8 @@ BackgroundCompileTask::BackgroundCompileTask( BackgroundCompileTask::~BackgroundCompileTask() = default; -namespace { - void SetScriptFieldsFromDetails(Isolate* isolate, Tagged