From 0ec50a19dd0168205b9f514593312c8a77254eeb 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/52293 Reviewed-By: Moshe Atlow Reviewed-By: Rafael Gonzaga Reviewed-By: Richard Lau --- 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 108788e98a3f2c..dbb8c0ff6085e6 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 93ef078548674b..ef0153c6697d8f 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