From 234d0cd7f2bb7e4f2b1314487d98a5156e1446e3 Mon Sep 17 00:00:00 2001 From: Erik Corry Date: Tue, 10 Sep 2024 22:29:58 +0200 Subject: [PATCH] Roll V8 to 12.9 (#2684) Roll V8 to 12.9 This release adds Intl.DurationFormat. --- WORKSPACE | 15 +- docs/v8-updates.md | 2 +- ...etting-ValueDeserializer-format-vers.patch | 8 +- ...etting-ValueSerializer-format-versio.patch | 10 +- .../v8/0003-Add-ArrayBuffer-MaybeNew.patch | 2 +- ...004-Allow-Windows-builds-under-Bazel.patch | 26 ++-- ...05-Disable-bazel-whole-archive-build.patch | 2 +- ...zel-build-by-always-using-target-cfg.patch | 12 +- ...07-Implement-Promise-Context-Tagging.patch | 66 ++++----- .../v8/0008-Enable-V8-shared-linkage.patch | 12 +- ...itial-ExecutionContextId-used-by-the.patch | 2 +- ...ncrease-visibility-of-virtual-method.patch | 6 +- ...lizer-SetTreatFunctionsAsHostObjects.patch | 10 +- ...ator-path-to-external-v8.-This-allow.patch | 4 +- ...look-for-fp16-dependency.-This-depen.patch | 6 +- .../v8/0014-Expose-v8-Symbol-GetDispose.patch | 10 +- ...SS_POINTERS_IN_ISOLATE_CAGE-V8_COMPR.patch | 8 +- ...rt-TracedReference-deref-API-removal.patch | 2 +- ...masm-specific-unwinding-annotations-.patch | 8 +- ...legal-invocation-error-message-in-v8.patch | 4 +- ...019-wasm-Fix-more-code-logging-races.patch | 72 ---------- ...sm-Remove-destructor-of-LogCodesTask.patch | 130 ------------------ 22 files changed, 105 insertions(+), 312 deletions(-) delete mode 100644 patches/v8/0019-wasm-Fix-more-code-logging-races.patch delete mode 100644 patches/v8/0020-wasm-Remove-destructor-of-LogCodesTask.patch diff --git a/WORKSPACE b/WORKSPACE index 53afe8b45fd..db8247e5ad1 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -216,7 +216,7 @@ http_archive( # to confusing compiler errors in tcmalloc in the past. git_repository( name = "com_google_absl", - commit = "9d1552f25c3d9e9114b7d7aed55790570a99bc4d", + commit = "ed3733b91e472a1e7a641c1f0c1e6c0ea698e958", remote = "https://chromium.googlesource.com/chromium/src/third_party/abseil-cpp.git", ) @@ -286,7 +286,7 @@ git_repository( name = "zlib", build_file = "//:build/BUILD.zlib", # Must match the version used by v8 - commit = "c2469fdd73f192383d2d94288da0ff5b9a3869f5", + commit = "d3aea2341cdeaf7e717bc257a59aa7a9407d318a", remote = "https://chromium.googlesource.com/chromium/src/third_party/zlib.git", ) @@ -444,7 +444,7 @@ npm_repositories() http_archive( name = "v8", - integrity = "sha256-yoLczQj1XEZL4EHVRjAwpVjgr9/q0YlRGnNX47Ke2ws=", + integrity = "sha256-oOgRa4akl02v8tcMbpmbHu21VL1qOYBjerq1CzekLxc=", patch_args = ["-p1"], patches = [ "//:patches/v8/0001-Allow-manually-setting-ValueDeserializer-format-vers.patch", @@ -465,14 +465,9 @@ http_archive( "//:patches/v8/0016-Revert-TracedReference-deref-API-removal.patch", "//:patches/v8/0017-Revert-heap-Add-masm-specific-unwinding-annotations-.patch", "//:patches/v8/0018-Update-illegal-invocation-error-message-in-v8.patch", - # TODO(cleanup): Patches backported from V8 12.9 – adding these fixes a race condition - # leading to a segfault in several wasm-related tests under ASan. These are already included - # in 12.9 so remove the patches when updating to that version. - "//:patches/v8/0019-wasm-Fix-more-code-logging-races.patch", - "//:patches/v8/0020-wasm-Remove-destructor-of-LogCodesTask.patch", ], - strip_prefix = "v8-12.8.374.10", - url = "https://github.com/v8/v8/archive/refs/tags/12.8.374.10.tar.gz", + strip_prefix = "v8-12.9.202.13", + url = "https://github.com/v8/v8/archive/refs/tags/12.9.202.13.tar.gz", ) git_repository( diff --git a/docs/v8-updates.md b/docs/v8-updates.md index aa12faf06ba..4b44a076ba7 100644 --- a/docs/v8-updates.md +++ b/docs/v8-updates.md @@ -81,7 +81,7 @@ from the V8 directory. You can find the commit versions for V8's dependencies under `v8/DEPS` and the ones that are carried through to workerd in the `workerd/WORKSPACE` file. - These currently include `abseil` and `com_googlesource_chromium_icu`. + These currently include `zlib` and `com_googlesource_chromium_icu`. Typically you'll get a build failure if the projects are out of sync. Copy the commit versions from `v8/DEPS` to the `WORKSPACE` file. diff --git a/patches/v8/0001-Allow-manually-setting-ValueDeserializer-format-vers.patch b/patches/v8/0001-Allow-manually-setting-ValueDeserializer-format-vers.patch index 3de1ee8b3f5..d49b58fe7af 100644 --- a/patches/v8/0001-Allow-manually-setting-ValueDeserializer-format-vers.patch +++ b/patches/v8/0001-Allow-manually-setting-ValueDeserializer-format-vers.patch @@ -1,4 +1,4 @@ -From 2a878e3f5a956e375cb59e4bccd0f2fa6591d66a Mon Sep 17 00:00:00 2001 +From 7f2b87c02eeef64b1d15ec78b45a128e6a8b9254 Mon Sep 17 00:00:00 2001 From: Alex Robinson Date: Wed, 2 Mar 2022 15:58:04 -0600 Subject: Allow manually setting ValueDeserializer format version @@ -35,10 +35,10 @@ index 0cb3e045bc46ec732956318b980e749d1847d06d..40ad805c7970cc9379e69f046205836d * Reads raw data in various common formats to the buffer. * Note that integer types are read in base-128 varint format, not with a diff --git a/src/api/api.cc b/src/api/api.cc -index f8d3c5aa1231f4b62a614bc0c705366d922b4c75..20f02c0eee7a8f921d8e4c0ae2f06df34c22bf6f 100644 +index 5ab671c8c4168ac7ccd9d18ea4b9fda16734e4ad..eb880d8e77b80f941c6920c8f5b85896b6334cf0 100644 --- a/src/api/api.cc +++ b/src/api/api.cc -@@ -3599,6 +3599,10 @@ uint32_t ValueDeserializer::GetWireFormatVersion() const { +@@ -3603,6 +3603,10 @@ uint32_t ValueDeserializer::GetWireFormatVersion() const { return private_->deserializer.GetWireFormatVersion(); } @@ -50,7 +50,7 @@ index f8d3c5aa1231f4b62a614bc0c705366d922b4c75..20f02c0eee7a8f921d8e4c0ae2f06df3 PREPARE_FOR_EXECUTION(context, ValueDeserializer, ReadValue); i::MaybeHandle result; diff --git a/src/objects/value-serializer.h b/src/objects/value-serializer.h -index 094210f286ab107f93b4a0e1529210a5328e0df0..8ec0a77210dda063a8c64d3c52b3209a8194827b 100644 +index 342c58be184d098499b04e656a4b7729e6953d3d..fd9ff05f3f5455a84b76246b5e9996cf7bcbf8db 100644 --- a/src/objects/value-serializer.h +++ b/src/objects/value-serializer.h @@ -218,6 +218,13 @@ class ValueDeserializer { diff --git a/patches/v8/0002-Allow-manually-setting-ValueSerializer-format-versio.patch b/patches/v8/0002-Allow-manually-setting-ValueSerializer-format-versio.patch index 2df37b5e6ba..f3b9dd70316 100644 --- a/patches/v8/0002-Allow-manually-setting-ValueSerializer-format-versio.patch +++ b/patches/v8/0002-Allow-manually-setting-ValueSerializer-format-versio.patch @@ -1,4 +1,4 @@ -From 89b24ba580034518e735c60838819c062b985c11 Mon Sep 17 00:00:00 2001 +From 904f424662a91a0d3942f31fb8fbc72516efc8b8 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Wed, 16 Mar 2022 08:59:21 -0700 Subject: Allow manually setting ValueSerializer format version @@ -22,10 +22,10 @@ index 40ad805c7970cc9379e69f046205836dbd760373..596be18adeb3a5a81794aaa44b1d347d * Writes out a header, which includes the format version. */ diff --git a/src/api/api.cc b/src/api/api.cc -index 20f02c0eee7a8f921d8e4c0ae2f06df34c22bf6f..404d19e8c5cf4b4505fb9106f0b649b44708e729 100644 +index eb880d8e77b80f941c6920c8f5b85896b6334cf0..6e2191ef66d5c04b99f7d314df6fb4b75de3fd7a 100644 --- a/src/api/api.cc +++ b/src/api/api.cc -@@ -3467,6 +3467,10 @@ ValueSerializer::ValueSerializer(Isolate* v8_isolate, Delegate* delegate) +@@ -3471,6 +3471,10 @@ ValueSerializer::ValueSerializer(Isolate* v8_isolate, Delegate* delegate) ValueSerializer::~ValueSerializer() { delete private_; } @@ -37,7 +37,7 @@ index 20f02c0eee7a8f921d8e4c0ae2f06df34c22bf6f..404d19e8c5cf4b4505fb9106f0b649b4 void ValueSerializer::SetTreatArrayBufferViewsAsHostObjects(bool mode) { diff --git a/src/objects/value-serializer.cc b/src/objects/value-serializer.cc -index e606ad4f8da446c0edb1b2696eec9701b166719a..96ad656a42173b66974539472467c497b89dc587 100644 +index 89c0d96baff05ce3b2cf506386149c14ed81779e..f7da4eefa361807dec4a76bfaf0025299cfb6b86 100644 --- a/src/objects/value-serializer.cc +++ b/src/objects/value-serializer.cc @@ -291,6 +291,7 @@ ValueSerializer::ValueSerializer(Isolate* isolate, @@ -83,7 +83,7 @@ index e606ad4f8da446c0edb1b2696eec9701b166719a..96ad656a42173b66974539472467c497 } diff --git a/src/objects/value-serializer.h b/src/objects/value-serializer.h -index 8ec0a77210dda063a8c64d3c52b3209a8194827b..27d5d03518e7bfecde240b658f63456c899f378c 100644 +index fd9ff05f3f5455a84b76246b5e9996cf7bcbf8db..cb9f1f3d9750da8914d5bd73c6742d6459c48e06 100644 --- a/src/objects/value-serializer.h +++ b/src/objects/value-serializer.h @@ -54,6 +54,11 @@ class ValueSerializer { diff --git a/patches/v8/0003-Add-ArrayBuffer-MaybeNew.patch b/patches/v8/0003-Add-ArrayBuffer-MaybeNew.patch index 5d367fada53..94612f9fd7a 100644 --- a/patches/v8/0003-Add-ArrayBuffer-MaybeNew.patch +++ b/patches/v8/0003-Add-ArrayBuffer-MaybeNew.patch @@ -1,4 +1,4 @@ -From 66ed20eae671ff611f2367ed894340cac7543236 Mon Sep 17 00:00:00 2001 +From aefb9a35747b3d42287a8a5f503d2ad7410b9b0c Mon Sep 17 00:00:00 2001 From: Kenton Varda Date: Fri, 16 Sep 2022 21:41:45 -0500 Subject: Add `ArrayBuffer::MaybeNew()`. diff --git a/patches/v8/0004-Allow-Windows-builds-under-Bazel.patch b/patches/v8/0004-Allow-Windows-builds-under-Bazel.patch index 9f846dc9afd..e1bcf4b4479 100644 --- a/patches/v8/0004-Allow-Windows-builds-under-Bazel.patch +++ b/patches/v8/0004-Allow-Windows-builds-under-Bazel.patch @@ -1,14 +1,14 @@ -From ba70d45d8258bd31100a63db615a82cb58d95664 Mon Sep 17 00:00:00 2001 +From 10c8b0b828769d8a0dd3cf454704785a270fb2a6 Mon Sep 17 00:00:00 2001 From: Brendan Coll Date: Thu, 16 Mar 2023 11:56:10 +0000 Subject: Allow Windows builds under Bazel diff --git a/BUILD.bazel b/BUILD.bazel -index 0718b28b05294698a38de1e13d34fe7a585038ac..e805a5174b9cfe1578c9423b5bbba4004614f0f7 100644 +index f2b2f4da0f8164ef29e36a3d1e9489b8e9c7b86e..84a281458aaa18525fa3640b3710414153e008b1 100644 --- a/BUILD.bazel +++ b/BUILD.bazel -@@ -771,6 +771,7 @@ filegroup( +@@ -820,6 +820,7 @@ filegroup( "src/base/platform/mutex.h", "src/base/platform/platform.cc", "src/base/platform/platform.h", @@ -16,7 +16,7 @@ index 0718b28b05294698a38de1e13d34fe7a585038ac..e805a5174b9cfe1578c9423b5bbba400 "src/base/platform/semaphore.cc", "src/base/platform/semaphore.h", "src/base/platform/time.cc", -@@ -814,7 +815,6 @@ filegroup( +@@ -863,7 +864,6 @@ filegroup( ] + select({ "@v8//bazel/config:is_posix": [ "src/base/platform/platform-posix.cc", @@ -24,7 +24,7 @@ index 0718b28b05294698a38de1e13d34fe7a585038ac..e805a5174b9cfe1578c9423b5bbba400 "src/base/platform/platform-posix-time.cc", "src/base/platform/platform-posix-time.h", ], -@@ -837,6 +837,7 @@ filegroup( +@@ -886,6 +886,7 @@ filegroup( "@v8//bazel/config:is_windows": [ "src/base/debug/stack_trace_win.cc", "src/base/platform/platform-win32.cc", @@ -32,7 +32,7 @@ index 0718b28b05294698a38de1e13d34fe7a585038ac..e805a5174b9cfe1578c9423b5bbba400 "src/base/win32-headers.h", ], }), -@@ -1219,6 +1220,7 @@ filegroup( +@@ -1268,6 +1269,7 @@ filegroup( "include/v8-wasm-trap-handler-posix.h", "src/api/api.cc", "src/api/api.h", @@ -40,7 +40,7 @@ index 0718b28b05294698a38de1e13d34fe7a585038ac..e805a5174b9cfe1578c9423b5bbba400 "src/api/api-arguments.cc", "src/api/api-arguments.h", "src/api/api-arguments-inl.h", -@@ -2689,6 +2691,11 @@ filegroup( +@@ -2741,6 +2743,11 @@ filegroup( "src/trap-handler/handler-inside-posix.cc", "src/trap-handler/handler-outside-posix.cc", ], @@ -52,7 +52,7 @@ index 0718b28b05294698a38de1e13d34fe7a585038ac..e805a5174b9cfe1578c9423b5bbba400 "//conditions:default": [], }) + select({ "@v8//bazel/config:v8_arm64_simulator": [ -@@ -2696,13 +2703,6 @@ filegroup( +@@ -2748,13 +2755,6 @@ filegroup( "src/trap-handler/trap-handler-simulator.h", ], "//conditions:default": [], @@ -66,7 +66,7 @@ index 0718b28b05294698a38de1e13d34fe7a585038ac..e805a5174b9cfe1578c9423b5bbba400 }) + select({ "@v8//bazel/config:is_windows_64bit": [ "src/diagnostics/unwinding-info-win64.cc", -@@ -3717,6 +3717,9 @@ filegroup( +@@ -3793,6 +3793,9 @@ filegroup( "@v8//bazel/config:is_msvc_asm_ia32": ["src/heap/base/asm/ia32/push_registers_masm.asm"], "@v8//bazel/config:is_msvc_asm_x64": ["src/heap/base/asm/x64/push_registers_masm.asm"], "@v8//bazel/config:is_msvc_asm_arm64": ["src/heap/base/asm/arm64/push_registers_masm.S"], @@ -76,7 +76,7 @@ index 0718b28b05294698a38de1e13d34fe7a585038ac..e805a5174b9cfe1578c9423b5bbba400 }), ) -@@ -4094,9 +4097,11 @@ filegroup( +@@ -4170,9 +4173,11 @@ filegroup( "src/d8/d8-js.cc", "src/d8/d8-platforms.cc", "src/d8/d8-platforms.h", @@ -90,7 +90,7 @@ index 0718b28b05294698a38de1e13d34fe7a585038ac..e805a5174b9cfe1578c9423b5bbba400 ) genrule( -@@ -4446,7 +4451,7 @@ py_test( +@@ -4522,7 +4527,7 @@ py_test( ":noicu/d8", ":noicu/v8_build_config", "//testing/pybase", @@ -99,7 +99,7 @@ index 0718b28b05294698a38de1e13d34fe7a585038ac..e805a5174b9cfe1578c9423b5bbba400 main = "tools/run-tests.py", python_version = "PY3", tags = [ -@@ -4485,7 +4490,7 @@ py_test( +@@ -4561,7 +4566,7 @@ py_test( ":icu/d8", ":icu/v8_build_config", "//testing/pybase", @@ -178,7 +178,7 @@ index c81f278203126913c3bad74d31348706678ccf06..96e0f9cdb61d0d8f6597d337c2dd965b name = "is_clang", match_any = [ diff --git a/bazel/defs.bzl b/bazel/defs.bzl -index 520a311595e488f39445bf9500f24971eecf0091..a81ec956ddd4e985cc6257fc015983baf593f19d 100644 +index 6a3c868b002142754cbfa671e1d30a1459d32f92..7ab09f062fd0d9bad3785836cdaa2c8be789e0f2 100644 --- a/bazel/defs.bzl +++ b/bazel/defs.bzl @@ -119,6 +119,24 @@ def _default_args(): diff --git a/patches/v8/0005-Disable-bazel-whole-archive-build.patch b/patches/v8/0005-Disable-bazel-whole-archive-build.patch index e5511fafc85..76a3838d1f9 100644 --- a/patches/v8/0005-Disable-bazel-whole-archive-build.patch +++ b/patches/v8/0005-Disable-bazel-whole-archive-build.patch @@ -1,4 +1,4 @@ -From 8d00e3a1c7ada125c05ef95e0109125e9ae64f23 Mon Sep 17 00:00:00 2001 +From 847bacce9b981c36c973192aeedaba7d2abb1ec4 Mon Sep 17 00:00:00 2001 From: Felix Hanau Date: Tue, 11 Apr 2023 14:41:31 -0400 Subject: Disable bazel whole-archive build diff --git a/patches/v8/0006-Speed-up-V8-bazel-build-by-always-using-target-cfg.patch b/patches/v8/0006-Speed-up-V8-bazel-build-by-always-using-target-cfg.patch index 21e2f5ca0bc..14765917af3 100644 --- a/patches/v8/0006-Speed-up-V8-bazel-build-by-always-using-target-cfg.patch +++ b/patches/v8/0006-Speed-up-V8-bazel-build-by-always-using-target-cfg.patch @@ -1,4 +1,4 @@ -From 1ce25051dcd85c5782012ba42929329ff491bb1a Mon Sep 17 00:00:00 2001 +From 9b8c6cdd0a183a34d4516ff924af9fd9fa0477fe Mon Sep 17 00:00:00 2001 From: Felix Hanau Date: Wed, 7 Jun 2023 21:40:54 -0400 Subject: Speed up V8 bazel build by always using target cfg @@ -12,7 +12,7 @@ generated files as the output set. While unrelated to the build cfg change, this also improves build times. diff --git a/BUILD.bazel b/BUILD.bazel -index e805a5174b9cfe1578c9423b5bbba4004614f0f7..e1779cc185fb6c2614b3a7d5b39305baea9a5efa 100644 +index 84a281458aaa18525fa3640b3710414153e008b1..55eaca3189c6b9464c2a0a795efea9bdc83ab8da 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -17,6 +17,7 @@ load( @@ -23,7 +23,7 @@ index e805a5174b9cfe1578c9423b5bbba4004614f0f7..e1779cc185fb6c2614b3a7d5b39305ba ) load(":bazel/v8-non-pointer-compression.bzl", "v8_binary_non_pointer_compression") -@@ -4104,22 +4105,20 @@ filegroup( +@@ -4180,22 +4181,20 @@ filegroup( }), ) @@ -52,7 +52,7 @@ index e805a5174b9cfe1578c9423b5bbba4004614f0f7..e1779cc185fb6c2614b3a7d5b39305ba ) v8_mksnapshot( -@@ -4319,8 +4318,6 @@ v8_binary( +@@ -4395,8 +4394,6 @@ v8_binary( srcs = [ "src/regexp/gen-regexp-special-case.cc", "src/regexp/special-case.h", @@ -61,7 +61,7 @@ index e805a5174b9cfe1578c9423b5bbba4004614f0f7..e1779cc185fb6c2614b3a7d5b39305ba ], copts = ["-Wno-implicit-fallthrough"], defines = [ -@@ -4332,6 +4329,7 @@ v8_binary( +@@ -4408,6 +4405,7 @@ v8_binary( ], deps = [ "//external:absl_optional", @@ -70,7 +70,7 @@ index e805a5174b9cfe1578c9423b5bbba4004614f0f7..e1779cc185fb6c2614b3a7d5b39305ba ], ) diff --git a/bazel/defs.bzl b/bazel/defs.bzl -index a81ec956ddd4e985cc6257fc015983baf593f19d..f8dfd9b5eb9c65547db3b17814c84e4fbc312d07 100644 +index 7ab09f062fd0d9bad3785836cdaa2c8be789e0f2..bb75ea080ed4a4e441e212b067c27b6d9316f81c 100644 --- a/bazel/defs.bzl +++ b/bazel/defs.bzl @@ -340,6 +340,15 @@ def v8_library( diff --git a/patches/v8/0007-Implement-Promise-Context-Tagging.patch b/patches/v8/0007-Implement-Promise-Context-Tagging.patch index a42aeffce56..158e6820a31 100644 --- a/patches/v8/0007-Implement-Promise-Context-Tagging.patch +++ b/patches/v8/0007-Implement-Promise-Context-Tagging.patch @@ -1,11 +1,11 @@ -From 038e2c4a3e1072aafae2088b591d1f2318f4868a Mon Sep 17 00:00:00 2001 -From: James M Snell -Date: Thu, 22 Jun 2023 15:29:26 -0700 +From 82285442872541dd260bca65115158d971ec9cf2 Mon Sep 17 00:00:00 2001 +From: Erik Corry +Date: Wed, 21 Aug 2024 16:29:43 +0200 Subject: Implement Promise Context Tagging diff --git a/include/v8-callbacks.h b/include/v8-callbacks.h -index 6096301258719eb2713d8d6c08b7d4d926b6cd9a..2e5d3909dd2dae88d2146cbaab534c43a1460b38 100644 +index 7a8f8abeb402d93f0089e1e54b0e211096f1c2dd..25f0c8189e5c0102b26bfd0827f375d9910849cd 100644 --- a/include/v8-callbacks.h +++ b/include/v8-callbacks.h @@ -462,6 +462,15 @@ using FilterETWSessionByURLCallback = @@ -25,12 +25,12 @@ index 6096301258719eb2713d8d6c08b7d4d926b6cd9a..2e5d3909dd2dae88d2146cbaab534c43 #endif // INCLUDE_V8_ISOLATE_CALLBACKS_H_ diff --git a/include/v8-isolate.h b/include/v8-isolate.h -index 17c107766b90454c2c25f9c4174cea6de42e0285..7a4586fefbf3d0a029eea3e6c98b9edc7a4c32af 100644 +index 08fcfc40f1f46e5867a7d9a1384d246d9422ddce..8112231319b309cdb96c59896fc0f48bcf920e96 100644 --- a/include/v8-isolate.h +++ b/include/v8-isolate.h -@@ -1717,6 +1717,9 @@ class V8_EXPORT Isolate { +@@ -1730,6 +1730,9 @@ class V8_EXPORT Isolate { */ - void LocaleConfigurationChangeNotification(); + std::string GetDefaultLocale(); + class PromiseContextScope; + void SetPromiseCrossContextCallback(PromiseCrossContextCallback callback); @@ -38,7 +38,7 @@ index 17c107766b90454c2c25f9c4174cea6de42e0285..7a4586fefbf3d0a029eea3e6c98b9edc Isolate() = delete; ~Isolate() = delete; Isolate(const Isolate&) = delete; -@@ -1761,6 +1764,19 @@ MaybeLocal Isolate::GetDataFromSnapshotOnce(size_t index) { +@@ -1774,6 +1777,19 @@ MaybeLocal Isolate::GetDataFromSnapshotOnce(size_t index) { return {}; } @@ -59,10 +59,10 @@ index 17c107766b90454c2c25f9c4174cea6de42e0285..7a4586fefbf3d0a029eea3e6c98b9edc #endif // INCLUDE_V8_ISOLATE_H_ diff --git a/src/api/api.cc b/src/api/api.cc -index 404d19e8c5cf4b4505fb9106f0b649b44708e729..8b8633b5e35ddc1a3c6eab202116c68bdf4cb56b 100644 +index 6e2191ef66d5c04b99f7d314df6fb4b75de3fd7a..8d4e6dee69b355baaadd3e144c7514e55dd88907 100644 --- a/src/api/api.cc +++ b/src/api/api.cc -@@ -12213,6 +12213,23 @@ std::string SourceLocation::ToString() const { +@@ -12235,6 +12235,23 @@ std::string SourceLocation::ToString() const { return std::string(function_) + "@" + file_ + ":" + std::to_string(line_); } @@ -87,7 +87,7 @@ index 404d19e8c5cf4b4505fb9106f0b649b44708e729..8b8633b5e35ddc1a3c6eab202116c68b EXPORT_CONTEXTUAL_VARIABLE(v8::internal::StackAllocatedCheck) diff --git a/src/builtins/promise-abstract-operations.tq b/src/builtins/promise-abstract-operations.tq -index 834007399ffdec3d7edc9cf6607a1ab22a15a1e4..9e7d3512dd66c6d2c076031b4a4282de33065555 100644 +index 8866a39c8ab47eedee928aea48b853eb4076cd90..fdec3d268e4e3d181d6c092bbb19a40cdf8dde57 100644 --- a/src/builtins/promise-abstract-operations.tq +++ b/src/builtins/promise-abstract-operations.tq @@ -20,6 +20,9 @@ extern transitioning runtime PromiseResolveAfterResolved( @@ -100,7 +100,7 @@ index 834007399ffdec3d7edc9cf6607a1ab22a15a1e4..9e7d3512dd66c6d2c076031b4a4282de } // https://tc39.es/ecma262/#sec-promise-abstract-operations -@@ -458,12 +461,14 @@ transitioning macro PerformPromiseThenImpl( +@@ -456,12 +459,14 @@ transitioning macro PerformPromiseThenImpl( // PromiseReaction holding both the onFulfilled and onRejected callbacks. // Once the {promise} is resolved we decide on the concrete handler to // push onto the microtask queue. @@ -117,7 +117,7 @@ index 834007399ffdec3d7edc9cf6607a1ab22a15a1e4..9e7d3512dd66c6d2c076031b4a4282de } else { const reactionsOrResult = promise.reactions_or_result; let microtask: PromiseReactionJobTask; -@@ -485,8 +490,8 @@ transitioning macro PerformPromiseThenImpl( +@@ -483,8 +488,8 @@ transitioning macro PerformPromiseThenImpl( } } EnqueueMicrotask(handlerContext, microtask); @@ -186,10 +186,10 @@ index 8accbc33c6872bee1533897a8a846d0456ecf79f..6b409b806468ae0dd9007cb1ac82e546 return instance; } diff --git a/src/compiler/js-create-lowering.cc b/src/compiler/js-create-lowering.cc -index 07da2db2bb38d95636777c0d2ac7e7aa4993514f..b7ecbde6cae44ea61be58f05a370ac3e120fb4c4 100644 +index cb7613c4eed992a519e70e1501c88ecc43a230fe..780f4a1d3d9645a840bea156246d7259b04be78b 100644 --- a/src/compiler/js-create-lowering.cc +++ b/src/compiler/js-create-lowering.cc -@@ -1084,10 +1084,12 @@ Reduction JSCreateLowering::ReduceJSCreatePromise(Node* node) { +@@ -1108,10 +1108,12 @@ Reduction JSCreateLowering::ReduceJSCreatePromise(Node* node) { jsgraph()->EmptyFixedArrayConstant()); a.Store(AccessBuilder::ForJSObjectOffset(JSPromise::kReactionsOrResultOffset), jsgraph()->ZeroConstant()); @@ -204,7 +204,7 @@ index 07da2db2bb38d95636777c0d2ac7e7aa4993514f..b7ecbde6cae44ea61be58f05a370ac3e offset < JSPromise::kSizeWithEmbedderFields; offset += kTaggedSize) { a.Store(AccessBuilder::ForJSObjectOffset(offset), diff --git a/src/diagnostics/objects-printer.cc b/src/diagnostics/objects-printer.cc -index 0124198dd87e60c2054776e06f1384679da9f36a..4da8a5a5aeb051c16be082339f3998fbdd99ad9b 100644 +index 3fb40e6ea6a1112d86f4dfaf0182cfad5a9e27d4..b069293ad8acd9d6403a2bb6ad2016a774f56fd5 100644 --- a/src/diagnostics/objects-printer.cc +++ b/src/diagnostics/objects-printer.cc @@ -846,6 +846,7 @@ void JSPromise::JSPromisePrint(std::ostream& os) { @@ -247,10 +247,10 @@ index f81666ddd2f513a9a1f39b9e486b451bf3c7574d..9e0969460fd33d8cc893e04d3418e1cb Tagged Isolate::VerifyBuiltinsResult(Tagged result) { if (is_execution_terminating() && !v8_flags.strict_termination_checks) { diff --git a/src/execution/isolate.cc b/src/execution/isolate.cc -index 922d728161538461b55e731ed82904cdd224ed78..24e6b532164d3610a9273770038a4306769fdc09 100644 +index f3316f4083da22baa5f561c333ec5bb5bc69a261..94194d59bae04905139f6e37cd19cd9b5d0537ae 100644 --- a/src/execution/isolate.cc +++ b/src/execution/isolate.cc -@@ -588,6 +588,8 @@ void Isolate::Iterate(RootVisitor* v, ThreadLocalTop* thread) { +@@ -593,6 +593,8 @@ void Isolate::Iterate(RootVisitor* v, ThreadLocalTop* thread) { FullObjectSlot(&thread->pending_message_)); v->VisitRootPointer(Root::kStackRoots, nullptr, FullObjectSlot(&thread->context_)); @@ -259,7 +259,7 @@ index 922d728161538461b55e731ed82904cdd224ed78..24e6b532164d3610a9273770038a4306 for (v8::TryCatch* block = thread->try_catch_handler_; block != nullptr; block = block->next_) { -@@ -5401,6 +5403,7 @@ bool Isolate::Init(SnapshotData* startup_snapshot_data, +@@ -5550,6 +5552,7 @@ bool Isolate::Init(SnapshotData* startup_snapshot_data, shared_heap_object_cache_.push_back(ReadOnlyRoots(this).undefined_value()); } @@ -267,8 +267,8 @@ index 922d728161538461b55e731ed82904cdd224ed78..24e6b532164d3610a9273770038a4306 InitializeThreadLocal(); // Profiler has to be created after ThreadLocal is initialized -@@ -7240,5 +7243,39 @@ void DefaultWasmAsyncResolvePromiseCallback( - CHECK(ret.IsJust() ? ret.FromJust() : isolate->IsExecutionTerminating()); +@@ -7422,5 +7425,39 @@ void Isolate::InitializeBuiltinJSDispatchTable() { + #endif } +class Isolate::PromiseCrossContextCallbackScope { @@ -308,10 +308,10 @@ index 922d728161538461b55e731ed82904cdd224ed78..24e6b532164d3610a9273770038a4306 } // namespace internal } // namespace v8 diff --git a/src/execution/isolate.h b/src/execution/isolate.h -index db1afe3715e7ee032e1be54153a2588deb05f34d..4cca9257840fb7e71ddaac967f5a0515b830863d 100644 +index c573cf1076af066f529bc56591de18f8ed8be494..59926e68e97a459e7300492a9972b0c02af5b8fa 100644 --- a/src/execution/isolate.h +++ b/src/execution/isolate.h -@@ -2225,6 +2225,14 @@ class V8_EXPORT_PRIVATE Isolate final : private HiddenFactory { +@@ -2244,6 +2244,14 @@ class V8_EXPORT_PRIVATE Isolate final : private HiddenFactory { v8::ExceptionContext callback_kind); void SetExceptionPropagationCallback(ExceptionPropagationCallback callback); @@ -326,7 +326,7 @@ index db1afe3715e7ee032e1be54153a2588deb05f34d..4cca9257840fb7e71ddaac967f5a0515 #ifdef V8_ENABLE_WASM_SIMD256_REVEC void set_wasm_revec_verifier_for_test( compiler::turboshaft::WasmRevecVerifier* verifier) { -@@ -2737,12 +2745,19 @@ class V8_EXPORT_PRIVATE Isolate final : private HiddenFactory { +@@ -2755,12 +2763,19 @@ class V8_EXPORT_PRIVATE Isolate final : private HiddenFactory { int current_thread_counter_ = 0; #endif @@ -347,10 +347,10 @@ index db1afe3715e7ee032e1be54153a2588deb05f34d..4cca9257840fb7e71ddaac967f5a0515 // The current entered Isolate and its thread data. Do not access these diff --git a/src/heap/factory.cc b/src/heap/factory.cc -index 5aba656b043139cdafafb181dd81a852fd6c5487..45122eba3b04c25149900dc0e2a433b9285b8e44 100644 +index 4ef611e8d84ebf700d62bb9977b2aab3db9b2bfb..c0c46447c2f55325885ce33e7aa45cd011eac5ad 100644 --- a/src/heap/factory.cc +++ b/src/heap/factory.cc -@@ -4271,6 +4271,12 @@ Handle Factory::NewJSPromiseWithoutHook() { +@@ -4415,6 +4415,12 @@ Handle Factory::NewJSPromiseWithoutHook() { DisallowGarbageCollection no_gc; Tagged raw = *promise; raw->set_reactions_or_result(Smi::zero(), SKIP_WRITE_BARRIER); @@ -376,10 +376,10 @@ index 29acfa259048f1dae2dfcb02ef57ca4ef69e2d9a..1c137d27219afe1298326604a5d172b4 } diff --git a/src/profiler/heap-snapshot-generator.cc b/src/profiler/heap-snapshot-generator.cc -index 86b7b9a05eaa8a63e6649e39bdb7e8917a2aecfb..2b0b03facc2ce4bee9cba93caaad067a1c1a6c29 100644 +index 7e2089e1f1abbd34093427bfd995ab90acbf4d54..b7d753ee3bce2df2e8896eabbc64d837b12841ef 100644 --- a/src/profiler/heap-snapshot-generator.cc +++ b/src/profiler/heap-snapshot-generator.cc -@@ -1909,6 +1909,9 @@ void V8HeapExplorer::ExtractJSPromiseReferences(HeapEntry* entry, +@@ -1911,6 +1911,9 @@ void V8HeapExplorer::ExtractJSPromiseReferences(HeapEntry* entry, SetInternalReference(entry, "reactions_or_result", promise->reactions_or_result(), JSPromise::kReactionsOrResultOffset); @@ -390,10 +390,10 @@ index 86b7b9a05eaa8a63e6649e39bdb7e8917a2aecfb..2b0b03facc2ce4bee9cba93caaad067a void V8HeapExplorer::ExtractJSGeneratorObjectReferences( diff --git a/src/runtime/runtime-promise.cc b/src/runtime/runtime-promise.cc -index 5b4b9c2e9de41673105efe28b2e731550581ee7b..f51989cd466e3bcf1727ac65cb471903c00497f6 100644 +index 20ba437b34afd13bc0e43e87785544160b5c109b..4fbdf90319c5fc3b3e6f60aaf1b12a33c5f537ea 100644 --- a/src/runtime/runtime-promise.cc +++ b/src/runtime/runtime-promise.cc -@@ -197,5 +197,40 @@ RUNTIME_FUNCTION(Runtime_ConstructInternalAggregateErrorHelper) { +@@ -216,5 +216,40 @@ RUNTIME_FUNCTION(Runtime_ConstructSuppressedError) { return *result; } @@ -435,12 +435,12 @@ index 5b4b9c2e9de41673105efe28b2e731550581ee7b..f51989cd466e3bcf1727ac65cb471903 } // namespace internal } // namespace v8 diff --git a/src/runtime/runtime.h b/src/runtime/runtime.h -index 3fa07b54517f8097947ff3eead162b0f4c8031bd..75755ad5354f27fe068679513440dcdb257a3e56 100644 +index 56c685d3c2d4f18e8455ee8e84e4741aeff3d92c..9399509f6903e392175c2b14a1dd97feaad1c526 100644 --- a/src/runtime/runtime.h +++ b/src/runtime/runtime.h -@@ -400,7 +400,9 @@ namespace internal { - F(PromiseRejectAfterResolved, 2, 1) \ +@@ -401,7 +401,9 @@ namespace internal { F(PromiseResolveAfterResolved, 2, 1) \ + F(ConstructSuppressedError, 3, 1) \ F(ConstructAggregateErrorHelper, 4, 1) \ - F(ConstructInternalAggregateErrorHelper, -1 /* <= 5*/, 1) + F(ConstructInternalAggregateErrorHelper, -1 /* <= 5*/, 1) \ diff --git a/patches/v8/0008-Enable-V8-shared-linkage.patch b/patches/v8/0008-Enable-V8-shared-linkage.patch index 700e109dc50..0129eef2f3b 100644 --- a/patches/v8/0008-Enable-V8-shared-linkage.patch +++ b/patches/v8/0008-Enable-V8-shared-linkage.patch @@ -1,14 +1,14 @@ -From 5480b515df0bdf43042a29ff03e0e45f98755ba1 Mon Sep 17 00:00:00 2001 +From fa01326c1efc2c25d635619b163fb4fe65d57289 Mon Sep 17 00:00:00 2001 From: Felix Hanau Date: Sun, 9 Jul 2023 18:46:20 -0400 Subject: Enable V8 shared linkage diff --git a/BUILD.bazel b/BUILD.bazel -index e1779cc185fb6c2614b3a7d5b39305baea9a5efa..3f1a94c7bd2c31a1581ff3aaa215fb5a682c51b3 100644 +index 55eaca3189c6b9464c2a0a795efea9bdc83ab8da..4a831b0d190ea85eebb7796a1bc9bb5eae3a13ea 100644 --- a/BUILD.bazel +++ b/BUILD.bazel -@@ -1490,7 +1490,6 @@ filegroup( +@@ -1542,7 +1542,6 @@ filegroup( "src/execution/futex-emulation.h", "src/execution/interrupts-scope.cc", "src/execution/interrupts-scope.h", @@ -16,7 +16,7 @@ index e1779cc185fb6c2614b3a7d5b39305baea9a5efa..3f1a94c7bd2c31a1581ff3aaa215fb5a "src/execution/isolate.h", "src/execution/isolate-data.h", "src/execution/isolate-inl.h", -@@ -3784,6 +3783,10 @@ filegroup( +@@ -3860,6 +3859,10 @@ filegroup( "src/snapshot/snapshot-empty.cc", "src/snapshot/static-roots-gen.cc", "src/snapshot/static-roots-gen.h", @@ -27,7 +27,7 @@ index e1779cc185fb6c2614b3a7d5b39305baea9a5efa..3f1a94c7bd2c31a1581ff3aaa215fb5a ], ) -@@ -4239,6 +4242,8 @@ v8_library( +@@ -4315,6 +4318,8 @@ v8_library( name = "v8", srcs = [ ":v8_inspector_files", @@ -37,7 +37,7 @@ index e1779cc185fb6c2614b3a7d5b39305baea9a5efa..3f1a94c7bd2c31a1581ff3aaa215fb5a ":is_not_v8_enable_turbofan": [ # With Turbofan disabled, we only include the stubbed-out API. diff --git a/bazel/defs.bzl b/bazel/defs.bzl -index f8dfd9b5eb9c65547db3b17814c84e4fbc312d07..ad8bd53dcc19c50144a6e94ed899983e014e0033 100644 +index bb75ea080ed4a4e441e212b067c27b6d9316f81c..78079ecf921f9eb22dda8ce6c208e9a510e8a224 100644 --- a/bazel/defs.bzl +++ b/bazel/defs.bzl @@ -297,7 +297,6 @@ def v8_library( diff --git a/patches/v8/0009-Randomize-the-initial-ExecutionContextId-used-by-the.patch b/patches/v8/0009-Randomize-the-initial-ExecutionContextId-used-by-the.patch index ca36e2cd766..e3de6ba249a 100644 --- a/patches/v8/0009-Randomize-the-initial-ExecutionContextId-used-by-the.patch +++ b/patches/v8/0009-Randomize-the-initial-ExecutionContextId-used-by-the.patch @@ -1,4 +1,4 @@ -From deccc5595b446d97f5210ef36eafc5388e84c03a Mon Sep 17 00:00:00 2001 +From ce1ede1072f3ce3ee45648a768b63ce139fd9e30 Mon Sep 17 00:00:00 2001 From: Orion Hodson Date: Wed, 13 Sep 2023 15:38:15 +0100 Subject: Randomize the initial ExecutionContextId used by the inspector diff --git a/patches/v8/0010-increase-visibility-of-virtual-method.patch b/patches/v8/0010-increase-visibility-of-virtual-method.patch index 830ca38a9fb..1728df4f194 100644 --- a/patches/v8/0010-increase-visibility-of-virtual-method.patch +++ b/patches/v8/0010-increase-visibility-of-virtual-method.patch @@ -1,4 +1,4 @@ -From ffd7ab81f19f035d54621806aa68371604ab5f17 Mon Sep 17 00:00:00 2001 +From 805f4d7111b7a91004e0c66bb215390755ee7db5 Mon Sep 17 00:00:00 2001 From: Mike Aizatsky Date: Tue, 6 Feb 2024 12:55:07 -0800 Subject: increase visibility of virtual method @@ -7,10 +7,10 @@ Methods were marked as protected, which conflicts with v8-platform-wrapper.h implementation. diff --git a/include/v8-platform.h b/include/v8-platform.h -index 56bfd7274826c0f6c807a32a0a37cf2b959e4a96..1273585feaa28fd61cda2a318771449b254ff306 100644 +index 5110f432077dce9770319373aec4988be1eaff59..6fb67c8c77b0d6adcc6b294230d4488a0fef9bc5 100644 --- a/include/v8-platform.h +++ b/include/v8-platform.h -@@ -1328,7 +1328,7 @@ class Platform { +@@ -1308,7 +1308,7 @@ class Platform { return &default_observer; } diff --git a/patches/v8/0011-Add-ValueSerializer-SetTreatFunctionsAsHostObjects.patch b/patches/v8/0011-Add-ValueSerializer-SetTreatFunctionsAsHostObjects.patch index e8a39e30cb6..e588861df7c 100644 --- a/patches/v8/0011-Add-ValueSerializer-SetTreatFunctionsAsHostObjects.patch +++ b/patches/v8/0011-Add-ValueSerializer-SetTreatFunctionsAsHostObjects.patch @@ -1,4 +1,4 @@ -From 06de20cf51080e17afe7984ca98458a3653e18c9 Mon Sep 17 00:00:00 2001 +From 4e6144fe190189f10ac3eee21d5d0bb437ba3afb Mon Sep 17 00:00:00 2001 From: Kenton Varda Date: Sat, 2 Mar 2024 09:00:18 -0600 Subject: Add ValueSerializer::SetTreatFunctionsAsHostObjects(). @@ -28,10 +28,10 @@ index 596be18adeb3a5a81794aaa44b1d347dec6c0c7d..141f138e08de849e3e02b3b2b346e643 * Write raw data in various common formats to the buffer. * Note that integer types are written in base-128 varint format, not with a diff --git a/src/api/api.cc b/src/api/api.cc -index 8b8633b5e35ddc1a3c6eab202116c68bdf4cb56b..dc1044ba427c5bd2bd7ac995adccd2472afbcfe2 100644 +index 8d4e6dee69b355baaadd3e144c7514e55dd88907..8db94796eb44db416f38fb5488ea4c83eeec1bf0 100644 --- a/src/api/api.cc +++ b/src/api/api.cc -@@ -3477,6 +3477,10 @@ void ValueSerializer::SetTreatArrayBufferViewsAsHostObjects(bool mode) { +@@ -3481,6 +3481,10 @@ void ValueSerializer::SetTreatArrayBufferViewsAsHostObjects(bool mode) { private_->serializer.SetTreatArrayBufferViewsAsHostObjects(mode); } @@ -43,7 +43,7 @@ index 8b8633b5e35ddc1a3c6eab202116c68bdf4cb56b..dc1044ba427c5bd2bd7ac995adccd247 Local value) { auto i_isolate = reinterpret_cast(context->GetIsolate()); diff --git a/src/objects/value-serializer.cc b/src/objects/value-serializer.cc -index 96ad656a42173b66974539472467c497b89dc587..95ba1aa83f71dd34c63230899840081cf555042d 100644 +index f7da4eefa361807dec4a76bfaf0025299cfb6b86..32441451d4d5c05484dd0a68ff8baea2a9283140 100644 --- a/src/objects/value-serializer.cc +++ b/src/objects/value-serializer.cc @@ -328,6 +328,10 @@ void ValueSerializer::SetTreatArrayBufferViewsAsHostObjects(bool mode) { @@ -74,7 +74,7 @@ index 96ad656a42173b66974539472467c497b89dc587..95ba1aa83f71dd34c63230899840081c } diff --git a/src/objects/value-serializer.h b/src/objects/value-serializer.h -index 27d5d03518e7bfecde240b658f63456c899f378c..faeb7879130b3d32feeb3a0435b3c21e9be44a14 100644 +index cb9f1f3d9750da8914d5bd73c6742d6459c48e06..a657bb7f6def9d795d6504eb62f49b5b34c46406 100644 --- a/src/objects/value-serializer.h +++ b/src/objects/value-serializer.h @@ -102,6 +102,15 @@ class ValueSerializer { diff --git a/patches/v8/0012-Set-torque-generator-path-to-external-v8.-This-allow.patch b/patches/v8/0012-Set-torque-generator-path-to-external-v8.-This-allow.patch index a3ec87a022f..15e6a77fc1d 100644 --- a/patches/v8/0012-Set-torque-generator-path-to-external-v8.-This-allow.patch +++ b/patches/v8/0012-Set-torque-generator-path-to-external-v8.-This-allow.patch @@ -1,4 +1,4 @@ -From 541e832ea27e547eb7a648f07153dcd9a9e92357 Mon Sep 17 00:00:00 2001 +From c29d6c7d0b23dd9cbdea7c8b2d8269a9bf5fd409 Mon Sep 17 00:00:00 2001 From: Garrett Gu Date: Wed, 10 Apr 2024 14:31:33 -0500 Subject: Set torque generator path to external/v8. This allows bazel to find @@ -8,7 +8,7 @@ Subject: Set torque generator path to external/v8. This allows bazel to find See https://chromium-review.googlesource.com/c/v8/v8/+/5339896 diff --git a/bazel/defs.bzl b/bazel/defs.bzl -index ad8bd53dcc19c50144a6e94ed899983e014e0033..ff95ab431effc3ed5ebfe0985aff3341997204bb 100644 +index 78079ecf921f9eb22dda8ce6c208e9a510e8a224..5da50d5b863f96b77add82b3e50a1492f0516a66 100644 --- a/bazel/defs.bzl +++ b/bazel/defs.bzl @@ -350,7 +350,7 @@ def get_cfg(): diff --git a/patches/v8/0013-Modify-where-to-look-for-fp16-dependency.-This-depen.patch b/patches/v8/0013-Modify-where-to-look-for-fp16-dependency.-This-depen.patch index 6aee0dee451..29ee3b4bd8d 100644 --- a/patches/v8/0013-Modify-where-to-look-for-fp16-dependency.-This-depen.patch +++ b/patches/v8/0013-Modify-where-to-look-for-fp16-dependency.-This-depen.patch @@ -1,4 +1,4 @@ -From e001dbb4984d73158ddd152cb757cdde432a33e9 Mon Sep 17 00:00:00 2001 +From 767abe4282acdd322266d3cc4d5409f8f6378d97 Mon Sep 17 00:00:00 2001 From: Garrett Gu Date: Mon, 22 Apr 2024 10:10:21 -0500 Subject: Modify where to look for fp16 dependency. This dependency is normally @@ -7,10 +7,10 @@ Subject: Modify where to look for fp16 dependency. This dependency is normally diff --git a/BUILD.bazel b/BUILD.bazel -index 3f1a94c7bd2c31a1581ff3aaa215fb5a682c51b3..629966b565e2a3b1018cf09b64dd5d969ad075a7 100644 +index 4a831b0d190ea85eebb7796a1bc9bb5eae3a13ea..e99cb6fe2dc950678612d22693fd8dbfa8a3aa7a 100644 --- a/BUILD.bazel +++ b/BUILD.bazel -@@ -3723,16 +3723,22 @@ filegroup( +@@ -3799,16 +3799,22 @@ filegroup( }), ) diff --git a/patches/v8/0014-Expose-v8-Symbol-GetDispose.patch b/patches/v8/0014-Expose-v8-Symbol-GetDispose.patch index 4a5981ede5f..7c4fc911de3 100644 --- a/patches/v8/0014-Expose-v8-Symbol-GetDispose.patch +++ b/patches/v8/0014-Expose-v8-Symbol-GetDispose.patch @@ -1,4 +1,4 @@ -From de001edd8a331a3bc3a53c27d5e425ff493078d9 Mon Sep 17 00:00:00 2001 +From 8ac4ac0d557c2e56df096b419a435641dec55ba0 Mon Sep 17 00:00:00 2001 From: Jon Phillips Date: Tue, 30 Apr 2024 00:06:33 +0100 Subject: Expose v8::Symbol::GetDispose(). @@ -8,10 +8,10 @@ management spec. Since `Symbol.dispose` has been exposed to JS we need to be able to access the native v8::Symbol too. diff --git a/include/v8-primitive.h b/include/v8-primitive.h -index 1adb9cbcb22515d100eb4bf1160eb5bfb7cac409..f7507eccad97d1d7a8f7e717d73065203849e00d 100644 +index 426bb379099e262191dadfd87262f4431bd444c6..7d0f6399a22cb32b19641398b9e858ce563afc4c 100644 --- a/include/v8-primitive.h +++ b/include/v8-primitive.h -@@ -692,6 +692,8 @@ class V8_EXPORT Symbol : public Name { +@@ -694,6 +694,8 @@ class V8_EXPORT Symbol : public Name { static Local GetToPrimitive(Isolate* isolate); static Local GetToStringTag(Isolate* isolate); static Local GetUnscopables(Isolate* isolate); @@ -21,10 +21,10 @@ index 1adb9cbcb22515d100eb4bf1160eb5bfb7cac409..f7507eccad97d1d7a8f7e717d7306520 V8_INLINE static Symbol* Cast(Data* data) { #ifdef V8_ENABLE_CHECKS diff --git a/src/api/api.cc b/src/api/api.cc -index dc1044ba427c5bd2bd7ac995adccd2472afbcfe2..908c23b1e451a2106581fe21224b0ce12a707b96 100644 +index 8db94796eb44db416f38fb5488ea4c83eeec1bf0..d3fc6d77ea3a75535ca688e120e884afa1b5815d 100644 --- a/src/api/api.cc +++ b/src/api/api.cc -@@ -9463,7 +9463,9 @@ Local v8::Symbol::ForApi(Isolate* v8_isolate, Local name) { +@@ -9461,7 +9461,9 @@ Local v8::Symbol::ForApi(Isolate* v8_isolate, Local name) { V(Split, split) \ V(ToPrimitive, to_primitive) \ V(ToStringTag, to_string_tag) \ diff --git a/patches/v8/0015-Rename-V8_COMPRESS_POINTERS_IN_ISOLATE_CAGE-V8_COMPR.patch b/patches/v8/0015-Rename-V8_COMPRESS_POINTERS_IN_ISOLATE_CAGE-V8_COMPR.patch index 38160ad880c..39fdef7008f 100644 --- a/patches/v8/0015-Rename-V8_COMPRESS_POINTERS_IN_ISOLATE_CAGE-V8_COMPR.patch +++ b/patches/v8/0015-Rename-V8_COMPRESS_POINTERS_IN_ISOLATE_CAGE-V8_COMPR.patch @@ -1,4 +1,4 @@ -From bd2d06301b076672d9041e4d2c3dc88084bb6759 Mon Sep 17 00:00:00 2001 +From 6b20e02e373af03a7efdefff23cfc62c02f4c43f Mon Sep 17 00:00:00 2001 From: Jon Phillips Date: Thu, 9 May 2024 23:36:43 +0100 Subject: Rename V8_COMPRESS_POINTERS_IN_ISOLATE_CAGE -> @@ -9,10 +9,10 @@ this rename elsewhere: https://chromium-review.googlesource.com/c/v8/v8/+/5279595. diff --git a/BUILD.bazel b/BUILD.bazel -index 629966b565e2a3b1018cf09b64dd5d969ad075a7..4deec252e0f8c4ec140f0d16e571a0329f695144 100644 +index e99cb6fe2dc950678612d22693fd8dbfa8a3aa7a..4146cef20a6684ae811aacc7a93a0832943a2173 100644 --- a/BUILD.bazel +++ b/BUILD.bazel -@@ -287,10 +287,10 @@ selects.config_setting_group( +@@ -329,10 +329,10 @@ selects.config_setting_group( ], ) @@ -25,7 +25,7 @@ index 629966b565e2a3b1018cf09b64dd5d969ad075a7..4deec252e0f8c4ec140f0d16e571a032 match_all = [ ":is_v8_enable_pointer_compression", ":is_not_v8_enable_pointer_compression_shared_cage", -@@ -485,8 +485,8 @@ v8_config( +@@ -529,8 +529,8 @@ v8_config( ":enable_pointer_compression_shared_cage": [ "V8_COMPRESS_POINTERS_IN_SHARED_CAGE", ], diff --git a/patches/v8/0016-Revert-TracedReference-deref-API-removal.patch b/patches/v8/0016-Revert-TracedReference-deref-API-removal.patch index 61d171d1c09..bd6437d53f3 100644 --- a/patches/v8/0016-Revert-TracedReference-deref-API-removal.patch +++ b/patches/v8/0016-Revert-TracedReference-deref-API-removal.patch @@ -1,4 +1,4 @@ -From 40286c19da2ce5f426b9e9f3f98dee211158017c Mon Sep 17 00:00:00 2001 +From 0c2cfb3ccfee22226d9aabe79c123021c689166e Mon Sep 17 00:00:00 2001 From: Harris Hancock Date: Fri, 28 Jun 2024 14:19:25 +0100 Subject: Revert TracedReference deref API removal diff --git a/patches/v8/0017-Revert-heap-Add-masm-specific-unwinding-annotations-.patch b/patches/v8/0017-Revert-heap-Add-masm-specific-unwinding-annotations-.patch index cc04200cab7..adee018d9d3 100644 --- a/patches/v8/0017-Revert-heap-Add-masm-specific-unwinding-annotations-.patch +++ b/patches/v8/0017-Revert-heap-Add-masm-specific-unwinding-annotations-.patch @@ -1,4 +1,4 @@ -From 21c4be174097013e55cd6ac6213f79e19a9c35a8 Mon Sep 17 00:00:00 2001 +From 59ac8a1956fa4f6afbc56d39d0e399ab20d17bdd Mon Sep 17 00:00:00 2001 From: Harris Hancock Date: Wed, 3 Jul 2024 15:46:43 +0100 Subject: Revert "heap: Add masm-specific unwinding annotations to GC @@ -9,10 +9,10 @@ This reverts commit 42bc7bfdf56cc7a8cd7757d96aa70b83ce82d9ff. This commit broke our build, because we patch V8 to build push_registers_asm.cc with clang-cl on Windows, and this commit makes it an error to compile that file on Windows with any compiler. Maybe clang-cl and masm can be used together? I'm not sure. In the meantime, I'm reverting this commit in the hope of getting our V8 upgrade unblocked. diff --git a/BUILD.gn b/BUILD.gn -index 92e8541951384f3eba02be02162978fa57b63798..3051f560dff3f9d0a3a9916bd57527240f67acf5 100644 +index 19e0d2b584790eed3f633152f25665aa333d6f4a..3fd262bd0184d0e9b1c9df7ac2b9ae717ba0482a 100644 --- a/BUILD.gn +++ b/BUILD.gn -@@ -4183,8 +4183,8 @@ v8_header_set("v8_internal_headers") { +@@ -4240,8 +4240,8 @@ v8_header_set("v8_internal_headers") { "src/third_party/siphash/halfsiphash.h", "src/third_party/utf8-decoder/utf8-decoder.h", "src/torque/runtime-macro-shims.h", @@ -22,7 +22,7 @@ index 92e8541951384f3eba02be02162978fa57b63798..3051f560dff3f9d0a3a9916bd5752724 "src/tracing/traced-value.h", "src/tracing/tracing-category-observer.h", "src/utils/address-map.h", -@@ -6858,12 +6858,7 @@ v8_source_set("v8_heap_base") { +@@ -6940,12 +6940,7 @@ v8_source_set("v8_heap_base") { if (is_clang || !is_win) { if (current_cpu == "x64") { diff --git a/patches/v8/0018-Update-illegal-invocation-error-message-in-v8.patch b/patches/v8/0018-Update-illegal-invocation-error-message-in-v8.patch index 8cef4288c53..7a59173d7da 100644 --- a/patches/v8/0018-Update-illegal-invocation-error-message-in-v8.patch +++ b/patches/v8/0018-Update-illegal-invocation-error-message-in-v8.patch @@ -1,11 +1,11 @@ -From 16b1c354fde124590e4f3c1dc95495bd49f9c6ec Mon Sep 17 00:00:00 2001 +From 8fb73f4a64dab74bd79bf2cae012eacafdba5f1d Mon Sep 17 00:00:00 2001 From: James M Snell Date: Tue, 9 Jul 2024 08:37:05 -0700 Subject: Update illegal invocation error message in v8 diff --git a/src/common/message-template.h b/src/common/message-template.h -index 1eeef77dc9e88089a8608a7650997d5f748b7137..2d82d8a0012ec32c2002e273a648336a901f2540 100644 +index 1390439013513f314e4cda5078c2026ca244d2a1..de253f53c5171d5d91eb023f71fab6ff51519b8e 100644 --- a/src/common/message-template.h +++ b/src/common/message-template.h @@ -112,7 +112,9 @@ namespace internal { diff --git a/patches/v8/0019-wasm-Fix-more-code-logging-races.patch b/patches/v8/0019-wasm-Fix-more-code-logging-races.patch deleted file mode 100644 index 2ffd4f10c7c..00000000000 --- a/patches/v8/0019-wasm-Fix-more-code-logging-races.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 7681014c831ca1002d0c654f0744d4cd065d50ef Mon Sep 17 00:00:00 2001 -From: Clemens Backes -Date: Mon, 22 Jul 2024 18:26:42 +0200 -Subject: [wasm] Fix more code logging races - -Fix more causes for failures during shutdown or unlucky timing. - -R=mliedtke@chromium.org - -Bug: 42204620 -Change-Id: I056b197042d77ee652aedddf15579e90f60bcc61 -Cq-Include-Trybots: luci.v8.try:v8_linux64_tsan_dbg -Cq-Include-Trybots: luci.v8.try:v8_linux64_tsan_isolates_rel -Cq-Include-Trybots: luci.v8.try:v8_linux64_tsan_rel -Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5725360 -Reviewed-by: Matthias Liedtke -Commit-Queue: Clemens Backes -Cr-Commit-Position: refs/heads/main@{#95170} - -diff --git a/src/wasm/wasm-engine.cc b/src/wasm/wasm-engine.cc -index 117f33e8fc46dc64b790f9dd42a42eb75643cbb4..c8f3a971bebb123259b6fd78b9c55e10d5b1d5aa 100644 ---- a/src/wasm/wasm-engine.cc -+++ b/src/wasm/wasm-engine.cc -@@ -142,7 +142,8 @@ class WasmEngine::LogCodesTask : public CancelableTask { - friend class WasmEngine; - - public: -- LogCodesTask(Isolate* isolate) : CancelableTask(isolate), isolate_(isolate) {} -+ explicit LogCodesTask(Isolate* isolate) -+ : CancelableTask(isolate), isolate_(isolate) {} - - ~LogCodesTask() override { GetWasmEngine()->DeregisterCodeLoggingTask(this); } - -@@ -1272,6 +1273,10 @@ void WasmEngine::RemoveIsolate(Isolate* isolate) { - - // Keep a WasmCodeRefScope which dies after the {mutex_} is released, to avoid - // deadlock when code actually dies, as that requires taking the {mutex_}. -+ // Also, keep the NativeModules themselves alive. The isolate is shutting -+ // down, so the heap will not do that any more. -+ std::map> -+ native_modules_with_code_to_log; - WasmCodeRefScope code_ref_scope_for_dead_code; - - base::MutexGuard guard(&mutex_); -@@ -1318,6 +1323,17 @@ void WasmEngine::RemoveIsolate(Isolate* isolate) { - // Clear the {code_to_log} vector. - for (auto& [script_id, code_to_log] : isolate_info->code_to_log) { - for (WasmCode* code : code_to_log.code) { -+ if (!native_modules_with_code_to_log.count(code->native_module())) { -+ std::shared_ptr shared_native_module = -+ native_modules_[code->native_module()]->weak_ptr.lock(); -+ if (!shared_native_module) { -+ // The module is dying already; there's no need to decrement the ref -+ // count and add the code to the WasmCodeRefScope. -+ continue; -+ } -+ native_modules_with_code_to_log.insert(std::make_pair( -+ code->native_module(), std::move(shared_native_module))); -+ } - // Keep a reference in the {code_ref_scope_for_dead_code} such that the - // code cannot become dead immediately. - WasmCodeRefScope::AddRef(code); -@@ -1441,7 +1457,8 @@ void WasmEngine::DeregisterCodeLoggingTask(LogCodesTask* task) { - // If the isolate died already, the IsolateInfo can not be found. - if (it == isolates_.end()) return; - IsolateInfo* info = it->second.get(); -- DCHECK(info->log_codes_task == nullptr || info->log_codes_task == task); -+ // If another task is already scheduled (or we already deregistered), return. -+ if (info->log_codes_task != task) return; - info->log_codes_task = nullptr; - } - diff --git a/patches/v8/0020-wasm-Remove-destructor-of-LogCodesTask.patch b/patches/v8/0020-wasm-Remove-destructor-of-LogCodesTask.patch deleted file mode 100644 index 75263189ed9..00000000000 --- a/patches/v8/0020-wasm-Remove-destructor-of-LogCodesTask.patch +++ /dev/null @@ -1,130 +0,0 @@ -From 58a36ca22df3470497f59b2492e302f157ed69d2 Mon Sep 17 00:00:00 2001 -From: Clemens Backes -Date: Tue, 23 Jul 2024 10:51:51 +0200 -Subject: [wasm] Remove destructor of LogCodesTask - -This is a follow-up to https://crrev.com/c/5718451. The destructor is -still sometimes called very late by the platform, after global teardown. -In this case, the WasmEngine was already deallocated. - -It turns out we do not need the destructor at all. We can just schedule -a task when the first code to log is put into the queue, similar to how -we request the interrupt. - -R=mliedtke@chromium.org - -Bug: 42204620 -Change-Id: I4daf644bc157f68ac0b53290cc411109c5a6a5c9 -Fixed: 354251542 -Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5729763 -Reviewed-by: Matthias Liedtke -Commit-Queue: Clemens Backes -Cr-Commit-Position: refs/heads/main@{#95184} - -diff --git a/src/wasm/wasm-engine.cc b/src/wasm/wasm-engine.cc -index c8f3a971bebb123259b6fd78b9c55e10d5b1d5aa..e1f0b899286a61dd4a71b603a8e8fe4b20605b6f 100644 ---- a/src/wasm/wasm-engine.cc -+++ b/src/wasm/wasm-engine.cc -@@ -145,10 +145,7 @@ class WasmEngine::LogCodesTask : public CancelableTask { - explicit LogCodesTask(Isolate* isolate) - : CancelableTask(isolate), isolate_(isolate) {} - -- ~LogCodesTask() override { GetWasmEngine()->DeregisterCodeLoggingTask(this); } -- - void RunInternal() override { -- GetWasmEngine()->DeregisterCodeLoggingTask(this); - GetWasmEngine()->LogOutstandingCodesForIsolate(isolate_); - } - -@@ -483,9 +480,6 @@ struct WasmEngine::IsolateInfo { - // Caches whether code needs to be logged on this isolate. - bool log_codes; - -- // The currently scheduled LogCodesTask. -- LogCodesTask* log_codes_task = nullptr; -- - // Maps script ID to vector of code objects that still need to be logged, and - // the respective source URL. - struct CodeToLogPerScript { -@@ -1368,10 +1362,13 @@ void WasmEngine::LogCode(base::Vector code_vec) { - // weak handle is cleared already, we also don't need to log any more. - if (script_it == info->scripts.end()) continue; - -- // If this is the first code to log in that isolate, request an interrupt -- // to log the newly added code as soon as possible. -+ // If there is no code scheduled to be logged already in that isolate, -+ // then schedule a new task and also set an interrupt to log the newly -+ // added code as soon as possible. - if (info->code_to_log.empty()) { - isolate->stack_guard()->RequestLogWasmCode(); -+ to_schedule.emplace_back(info->foreground_task_runner, -+ std::make_unique(isolate)); - } - - WeakScriptHandle& weak_script_handle = script_it->second; -@@ -1387,22 +1384,6 @@ void WasmEngine::LogCode(base::Vector code_vec) { - DCHECK_EQ(native_module, code->native_module()); - code->IncRef(); - } -- -- if (info->log_codes_task == nullptr) { -- auto new_task = std::make_unique(isolate); -- info->log_codes_task = new_task.get(); -- // Store the LogCodeTasks to post them outside the WasmEngine::mutex_. -- // Posting the task in the mutex can cause the following deadlock (only -- // in d8): When d8 shuts down, it sets a terminate to the task runner. -- // When the terminate flag in the taskrunner is set, all newly posted -- // tasks get destroyed immediately. When the LogCodesTask gets -- // destroyed, it takes the WasmEngine::mutex_ lock to deregister itself -- // from the IsolateInfo. Therefore, as the LogCodesTask may get -- // destroyed immediately when it gets posted, it cannot get posted when -- // the WasmEngine::mutex_ lock is held. -- to_schedule.emplace_back(info->foreground_task_runner, -- std::move(new_task)); -- } - } - } - for (auto& [runner, task] : to_schedule) { -@@ -1450,18 +1431,6 @@ void WasmEngine::LogOutstandingCodesForIsolate(Isolate* isolate) { - } - } - --void WasmEngine::DeregisterCodeLoggingTask(LogCodesTask* task) { -- base::MutexGuard engine_mutex_guard(&mutex_); -- Isolate* isolate = task->isolate_; -- auto it = isolates_.find(isolate); -- // If the isolate died already, the IsolateInfo can not be found. -- if (it == isolates_.end()) return; -- IsolateInfo* info = it->second.get(); -- // If another task is already scheduled (or we already deregistered), return. -- if (info->log_codes_task != task) return; -- info->log_codes_task = nullptr; --} -- - std::shared_ptr WasmEngine::NewNativeModule( - Isolate* isolate, WasmEnabledFeatures enabled, - CompileTimeImports compile_imports, -@@ -1909,7 +1878,7 @@ void WasmEngine::PotentiallyFinishCurrentGC() { - - size_t WasmEngine::EstimateCurrentMemoryConsumption() const { - UPDATE_WHEN_CLASS_CHANGES(WasmEngine, 760); -- UPDATE_WHEN_CLASS_CHANGES(IsolateInfo, 192); -+ UPDATE_WHEN_CLASS_CHANGES(IsolateInfo, 184); - UPDATE_WHEN_CLASS_CHANGES(NativeModuleInfo, 144); - UPDATE_WHEN_CLASS_CHANGES(CurrentGCInfo, 96); - size_t result = sizeof(WasmEngine); -diff --git a/src/wasm/wasm-engine.h b/src/wasm/wasm-engine.h -index 4d9fce22e05b24ce1345d3df19257aa39e85c70b..5e353b8474859b03711a85400d913b5ade2efda9 100644 ---- a/src/wasm/wasm-engine.h -+++ b/src/wasm/wasm-engine.h -@@ -298,10 +298,6 @@ class V8_EXPORT_PRIVATE WasmEngine { - // outstanding code objects (added via {LogCode}). - void LogOutstandingCodesForIsolate(Isolate*); - -- // Code logging is done via a separate task per isolate. This deregisters a -- // task after execution (or destruction because of isolate shutdown). -- void DeregisterCodeLoggingTask(LogCodesTask*); -- - // Create a new NativeModule. The caller is responsible for its - // lifetime. The native module will be given some memory for code, - // which will be page size aligned. The size of the initial memory