From 2b7a7f5d719d3539c9032d5ca1204ba4b16f6116 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 --- 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 18f60c1435c6ef..0e028e3bf97d97 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.7', + 'v8_embedder_string': '-node.8', ##### V8 defaults for Node.js ##### diff --git a/deps/v8/src/codegen/compiler.cc b/deps/v8/src/codegen/compiler.cc index a2984d393169a3..49afab11b6c6e4 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