Skip to content

Commit 316068f

Browse files
erikcorryfhanau
andauthored
Roll V8 to 13.3 (#3417)
* Roll V8 to 13.3 * Try to get highway bindings right * Update abseil, zlib and icu to match V8 13.3. * Improve compatibility with V8 13.3 (#3440) - Adjust isolate group creation to allow building with and without shared pointer cage - Update V8 defines in compile_flags.txt based on bazel aquery output – we currently build V8 without perfetto support. Ideally we'd have an external, auto-generated file with the set of definitions that matter for embedders, but for now this needs to be maintained manually. - Fix some of the deprecation warnings from V8 13.3. - Change comment on updating Chromium zlib, this is more of a chore than a necessity. * Fix V8 macOS build --------- Co-authored-by: Felix Hanau <felix@cloudflare.com>
1 parent 789a13a commit 316068f

29 files changed

+230
-216
lines changed

WORKSPACE

+17-8
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ filegroup(
126126
#
127127
git_repository(
128128
name = "com_google_absl",
129-
commit = "dc257ad54f38739767a6cb26eb57fd51c37bfe3c",
129+
commit = "72093794ac42be8105817ae0b0569fb411a6ca9b",
130130
remote = "https://chromium.googlesource.com/chromium/src/third_party/abseil-cpp.git",
131131
)
132132

@@ -144,6 +144,18 @@ git_repository(
144144
remote = "https://chromium.googlesource.com/external/github.com/Maratyszcza/FP16.git",
145145
)
146146

147+
git_repository(
148+
name = "highway",
149+
commit = "00fe003dac355b979f36157f9407c7c46448958e",
150+
remote = "https://chromium.googlesource.com/external/github.com/google/highway.git",
151+
)
152+
153+
# Bindings for Highway library used by V8
154+
bind(
155+
name = "hwy",
156+
actual = "@highway//:hwy",
157+
)
158+
147159
# Bindings for abseil libraries used by V8
148160
[
149161
bind(
@@ -157,11 +169,6 @@ git_repository(
157169
]
158170
]
159171

160-
bind(
161-
name = "absl_optional",
162-
actual = "@com_google_absl//absl/types:optional",
163-
)
164-
165172
# OK, now we can bring in tcmalloc itself.
166173
http_archive(
167174
name = "com_google_tcmalloc",
@@ -178,8 +185,10 @@ http_archive(
178185
git_repository(
179186
name = "zlib",
180187
build_file = "//:build/BUILD.zlib",
181-
# Must match the version used by v8
182-
commit = "fa9f14143c7938e6a1d18443900efee7a1e5e669",
188+
# This should match the version specified in V8 DEPS, but in practice it is generally acceptable
189+
# for it to be behind – zlib is very stable and its API has not changed in a long time, most
190+
# changes to the Chromium fork affect ancillary tools and not the zlib library itself.
191+
commit = "82a5fecf8aae8f288267cfdb2d29c9ebf7b37e59",
183192
remote = "https://chromium.googlesource.com/chromium/src/third_party/zlib.git",
184193
)
185194

build/deps/v8.bzl

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
22
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
33

4-
VERSION = "13.2.152.34"
4+
VERSION = "13.3.415.18"
55

6-
INTEGRITY = "sha256-wER1sDu6Ez7pXzLDufpxYE26d3S1WdsyuQxoFvzLc5Q="
6+
INTEGRITY = "sha256-irTC8837o+iRvTVx6YatlscLn3+nJcr5RumtHCMUhW0="
77

88
PATCHES = [
99
"0001-Allow-manually-setting-ValueDeserializer-format-vers.patch",
@@ -23,11 +23,11 @@ PATCHES = [
2323
"0015-Update-illegal-invocation-error-message-in-v8.patch",
2424
"0016-Implement-cross-request-context-promise-resolve-hand.patch",
2525
"0017-Modify-where-to-look-for-fast_float-dependency.patch",
26-
"0018-Return-rejected-promise-from-WebAssembly.compile-if-.patch",
27-
"0019-Add-another-slot-in-the-isolate-for-embedder.patch",
28-
"0020-Add-ValueSerializer-SetTreatProxiesAsHostObjects.patch",
29-
"0021-Disable-memory-leak-assert-when-shutting-down-V8.patch",
30-
"0022-Enable-V8-shared-linkage.patch",
26+
"0018-Add-another-slot-in-the-isolate-for-embedder.patch",
27+
"0019-Add-ValueSerializer-SetTreatProxiesAsHostObjects.patch",
28+
"0020-Disable-memory-leak-assert-when-shutting-down-V8.patch",
29+
"0021-Enable-V8-shared-linkage.patch",
30+
"0022-Fix-macOS-build.patch",
3131
]
3232

3333
# V8 and its dependencies
@@ -56,7 +56,7 @@ def deps_v8():
5656
git_repository(
5757
name = "com_googlesource_chromium_icu",
5858
build_file = "@v8//:bazel/BUILD.icu",
59-
commit = "4239b1559d11d4fa66c100543eda4161e060311e",
59+
commit = "bbccc2f6efc1b825de5f2c903c48be685cd0cf22",
6060
patch_cmds = ["find source -name BUILD.bazel | xargs rm"],
6161
patch_cmds_win = ["Get-ChildItem -Path source -File -Include BUILD.bazel -Recurse | Remove-Item"],
6262
remote = "https://chromium.googlesource.com/chromium/deps/icu.git",

compile_flags.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@
8989
-DV8_ENABLE_CHECKS
9090
-DV8_ENABLE_CONTINUATION_PRESERVED_EMBEDDER_DATA
9191
-DV8_ENABLE_LAZY_SOURCE_POSITIONS
92+
-DV8_ENABLE_MAGLEV
93+
-DV8_ENABLE_SPARKPLUG
9294
-DV8_ENABLE_TURBOFAN
9395
-DV8_ENABLE_WEBASSEMBLY
9496
-DV8_HAVE_TARGET_OS
@@ -97,7 +99,6 @@
9799
-DV8_TARGET_ARCH_X64
98100
-DV8_TARGET_OS_LINUX
99101
-DV8_TYPED_ARRAY_MAX_SIZE_IN_HEAP=64
100-
-DV8_USE_PERFETTO
101102
-DWORKERD_USE_PERFETTO
102103
-DPERFETTO_ENABLE_LEGACY_TRACE_EVENTS=1
103104
-DWORKERD_ICU_DATA_EMBED

patches/v8/0001-Allow-manually-setting-ValueDeserializer-format-vers.patch

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
From 38b8fe7083c7b168204f0225040403a5a5887524 Mon Sep 17 00:00:00 2001
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
22
From: Alex Robinson <arobinson@cloudflare.com>
33
Date: Wed, 2 Mar 2022 15:58:04 -0600
44
Subject: Allow manually setting ValueDeserializer format version
@@ -35,10 +35,10 @@ index 0cb3e045bc46ec732956318b980e749d1847d06d..40ad805c7970cc9379e69f046205836d
3535
* Reads raw data in various common formats to the buffer.
3636
* Note that integer types are read in base-128 varint format, not with a
3737
diff --git a/src/api/api.cc b/src/api/api.cc
38-
index 3e15759b3d30ff0ac8c311fa409b34d19ba7ae2c..88b9002375fba64bd6b4aa41eaaccce25a861b23 100644
38+
index c0ff2001df718c89bd1fdf06e95d51e56aa23f03..c9d69132f41457d6eb1f2996dea30fdbba8143f9 100644
3939
--- a/src/api/api.cc
4040
+++ b/src/api/api.cc
41-
@@ -3626,6 +3626,10 @@ uint32_t ValueDeserializer::GetWireFormatVersion() const {
41+
@@ -3646,6 +3646,10 @@ uint32_t ValueDeserializer::GetWireFormatVersion() const {
4242
return private_->deserializer.GetWireFormatVersion();
4343
}
4444

@@ -48,12 +48,12 @@ index 3e15759b3d30ff0ac8c311fa409b34d19ba7ae2c..88b9002375fba64bd6b4aa41eaaccce2
4848
+
4949
MaybeLocal<Value> ValueDeserializer::ReadValue(Local<Context> context) {
5050
PREPARE_FOR_EXECUTION(context, ValueDeserializer, ReadValue);
51-
i::MaybeHandle<i::Object> result;
51+
i::MaybeDirectHandle<i::Object> result;
5252
diff --git a/src/objects/value-serializer.h b/src/objects/value-serializer.h
53-
index 342c58be184d098499b04e656a4b7729e6953d3d..fd9ff05f3f5455a84b76246b5e9996cf7bcbf8db 100644
53+
index 3e76d677a1753eef605b87a203fcbde0b788bc49..c58a695378ea692d9cebef4b04ea86202baba49d 100644
5454
--- a/src/objects/value-serializer.h
5555
+++ b/src/objects/value-serializer.h
56-
@@ -218,6 +218,13 @@ class ValueDeserializer {
56+
@@ -220,6 +220,13 @@ class ValueDeserializer {
5757
*/
5858
uint32_t GetWireFormatVersion() const { return version_; }
5959

patches/v8/0002-Allow-manually-setting-ValueSerializer-format-versio.patch

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
From a5f845b13014fddc6f6f108b7b466159b06229d2 Mon Sep 17 00:00:00 2001
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
22
From: James M Snell <jasnell@gmail.com>
33
Date: Wed, 16 Mar 2022 08:59:21 -0700
44
Subject: Allow manually setting ValueSerializer format version
@@ -22,10 +22,10 @@ index 40ad805c7970cc9379e69f046205836dbd760373..596be18adeb3a5a81794aaa44b1d347d
2222
* Writes out a header, which includes the format version.
2323
*/
2424
diff --git a/src/api/api.cc b/src/api/api.cc
25-
index 88b9002375fba64bd6b4aa41eaaccce25a861b23..2e2dcb6a26d61bddd23a783fc50d2f22b2ed4070 100644
25+
index c9d69132f41457d6eb1f2996dea30fdbba8143f9..1cb6383aa42545433f07e88e0a21a2bc73d44348 100644
2626
--- a/src/api/api.cc
2727
+++ b/src/api/api.cc
28-
@@ -3494,6 +3494,10 @@ ValueSerializer::ValueSerializer(Isolate* v8_isolate, Delegate* delegate)
28+
@@ -3514,6 +3514,10 @@ ValueSerializer::ValueSerializer(Isolate* v8_isolate, Delegate* delegate)
2929

3030
ValueSerializer::~ValueSerializer() { delete private_; }
3131

@@ -37,7 +37,7 @@ index 88b9002375fba64bd6b4aa41eaaccce25a861b23..2e2dcb6a26d61bddd23a783fc50d2f22
3737

3838
void ValueSerializer::SetTreatArrayBufferViewsAsHostObjects(bool mode) {
3939
diff --git a/src/objects/value-serializer.cc b/src/objects/value-serializer.cc
40-
index fbd616fbf6f7678279a8ead4fd91e7b9bae3fc5d..7683d5e8e802503ff76ded13b2dfdba44e8fbdaa 100644
40+
index 8b116abf485630de0a80b72ab71c22490a51bc31..0034b0d9807d19836a0d00247a98b63ec36b7614 100644
4141
--- a/src/objects/value-serializer.cc
4242
+++ b/src/objects/value-serializer.cc
4343
@@ -291,6 +291,7 @@ ValueSerializer::ValueSerializer(Isolate* isolate,
@@ -83,7 +83,7 @@ index fbd616fbf6f7678279a8ead4fd91e7b9bae3fc5d..7683d5e8e802503ff76ded13b2dfdba4
8383
}
8484

8585
diff --git a/src/objects/value-serializer.h b/src/objects/value-serializer.h
86-
index fd9ff05f3f5455a84b76246b5e9996cf7bcbf8db..cb9f1f3d9750da8914d5bd73c6742d6459c48e06 100644
86+
index c58a695378ea692d9cebef4b04ea86202baba49d..76722020fd33d720e1504a3f811f8b4bef7d80ea 100644
8787
--- a/src/objects/value-serializer.h
8888
+++ b/src/objects/value-serializer.h
8989
@@ -54,6 +54,11 @@ class ValueSerializer {
@@ -98,7 +98,7 @@ index fd9ff05f3f5455a84b76246b5e9996cf7bcbf8db..cb9f1f3d9750da8914d5bd73c6742d64
9898
/*
9999
* Writes out a header, which includes the format version.
100100
*/
101-
@@ -179,6 +184,7 @@ class ValueSerializer {
101+
@@ -181,6 +186,7 @@ class ValueSerializer {
102102
bool treat_array_buffer_views_as_host_objects_ = false;
103103
bool out_of_memory_ = false;
104104
Zone zone_;

patches/v8/0003-Allow-Windows-builds-under-Bazel.patch

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,46 @@
1-
From 3f722017889ee5ca565a41ff57954ef3a52b90eb Mon Sep 17 00:00:00 2001
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
22
From: Brendan Coll <bcoll@cloudflare.com>
33
Date: Thu, 16 Mar 2023 11:56:10 +0000
44
Subject: Allow Windows builds under Bazel
55

66

77
diff --git a/BUILD.bazel b/BUILD.bazel
8-
index 6c19fa58f66ea0e680be6881cd4f402f4c7bef93..13e4bc0c80f23907cf07a7d338a6bd4398e413ca 100644
8+
index 6467518686d6e886c4f3a7f787551bc3be914462..c056e87386233c7d8e512dfa53f4108c8b42678e 100644
99
--- a/BUILD.bazel
1010
+++ b/BUILD.bazel
11-
@@ -829,6 +829,7 @@ filegroup(
11+
@@ -822,6 +822,7 @@ filegroup(
1212
"src/base/platform/mutex.h",
1313
"src/base/platform/platform.cc",
1414
"src/base/platform/platform.h",
1515
+ "src/base/platform/platform-posix.h", # Always included by src/execution/isolate.h
1616
"src/base/platform/semaphore.cc",
1717
"src/base/platform/semaphore.h",
1818
"src/base/platform/time.cc",
19-
@@ -872,7 +873,6 @@ filegroup(
19+
@@ -866,7 +867,6 @@ filegroup(
2020
] + select({
2121
"@v8//bazel/config:is_posix": [
2222
"src/base/platform/platform-posix.cc",
2323
- "src/base/platform/platform-posix.h",
2424
"src/base/platform/platform-posix-time.cc",
2525
"src/base/platform/platform-posix-time.h",
2626
],
27-
@@ -895,6 +895,7 @@ filegroup(
27+
@@ -889,6 +889,7 @@ filegroup(
2828
"@v8//bazel/config:is_windows": [
2929
"src/base/debug/stack_trace_win.cc",
3030
"src/base/platform/platform-win32.cc",
3131
+ "src/base/platform/platform-win32.h",
3232
"src/base/win32-headers.h",
3333
],
3434
}),
35-
@@ -1277,6 +1278,7 @@ filegroup(
35+
@@ -1271,6 +1272,7 @@ filegroup(
3636
"include/v8-wasm-trap-handler-posix.h",
3737
"src/api/api.cc",
3838
"src/api/api.h",
3939
+ "include/v8-wasm-trap-handler-win.h",
4040
"src/api/api-arguments.cc",
4141
"src/api/api-arguments.h",
4242
"src/api/api-arguments-inl.h",
43-
@@ -2762,6 +2764,11 @@ filegroup(
43+
@@ -2757,6 +2759,11 @@ filegroup(
4444
"src/trap-handler/handler-inside-posix.cc",
4545
"src/trap-handler/handler-outside-posix.cc",
4646
],
@@ -52,7 +52,7 @@ index 6c19fa58f66ea0e680be6881cd4f402f4c7bef93..13e4bc0c80f23907cf07a7d338a6bd43
5252
"//conditions:default": [],
5353
}) + select({
5454
"@v8//bazel/config:v8_arm64_simulator": [
55-
@@ -2769,13 +2776,6 @@ filegroup(
55+
@@ -2764,13 +2771,6 @@ filegroup(
5656
"src/trap-handler/trap-handler-simulator.h",
5757
],
5858
"//conditions:default": [],
@@ -66,7 +66,7 @@ index 6c19fa58f66ea0e680be6881cd4f402f4c7bef93..13e4bc0c80f23907cf07a7d338a6bd43
6666
}) + select({
6767
"@v8//bazel/config:is_windows_64bit": [
6868
"src/diagnostics/unwinding-info-win64.cc",
69-
@@ -3836,6 +3836,9 @@ filegroup(
69+
@@ -3833,6 +3833,9 @@ filegroup(
7070
"@v8//bazel/config:is_msvc_asm_ia32": ["src/heap/base/asm/ia32/push_registers_masm.asm"],
7171
"@v8//bazel/config:is_msvc_asm_x64": ["src/heap/base/asm/x64/push_registers_masm.asm"],
7272
"@v8//bazel/config:is_msvc_asm_arm64": ["src/heap/base/asm/arm64/push_registers_masm.S"],
@@ -76,7 +76,7 @@ index 6c19fa58f66ea0e680be6881cd4f402f4c7bef93..13e4bc0c80f23907cf07a7d338a6bd43
7676
}),
7777
)
7878

79-
@@ -4232,9 +4235,11 @@ filegroup(
79+
@@ -4227,9 +4230,11 @@ filegroup(
8080
"src/d8/d8-js.cc",
8181
"src/d8/d8-platforms.cc",
8282
"src/d8/d8-platforms.h",
@@ -90,7 +90,7 @@ index 6c19fa58f66ea0e680be6881cd4f402f4c7bef93..13e4bc0c80f23907cf07a7d338a6bd43
9090
)
9191

9292
genrule(
93-
@@ -4585,7 +4590,7 @@ py_test(
93+
@@ -4581,7 +4586,7 @@ py_test(
9494
":noicu/d8",
9595
":noicu/v8_build_config",
9696
"//testing/pybase",
@@ -99,7 +99,7 @@ index 6c19fa58f66ea0e680be6881cd4f402f4c7bef93..13e4bc0c80f23907cf07a7d338a6bd43
9999
main = "tools/run-tests.py",
100100
python_version = "PY3",
101101
tags = [
102-
@@ -4624,7 +4629,7 @@ py_test(
102+
@@ -4620,7 +4625,7 @@ py_test(
103103
":icu/d8",
104104
":icu/v8_build_config",
105105
"//testing/pybase",

patches/v8/0004-Disable-bazel-whole-archive-build.patch

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
From 23f8db09c4d8ac24637d0f9d190c8247f67415ed Mon Sep 17 00:00:00 2001
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
22
From: Felix Hanau <felix@cloudflare.com>
33
Date: Tue, 11 Apr 2023 14:41:31 -0400
44
Subject: Disable bazel whole-archive build

patches/v8/0005-Speed-up-V8-bazel-build-by-always-using-target-cfg.patch

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
From b44a9a7a78ddfe2d29b96b05ea9ed3c3638088bd Mon Sep 17 00:00:00 2001
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
22
From: Felix Hanau <felix@cloudflare.com>
33
Date: Wed, 7 Jun 2023 21:40:54 -0400
44
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,
1212
this also improves build times.
1313

1414
diff --git a/BUILD.bazel b/BUILD.bazel
15-
index 13e4bc0c80f23907cf07a7d338a6bd4398e413ca..f62048d985496583457ef370bea74c761524bf3a 100644
15+
index c056e87386233c7d8e512dfa53f4108c8b42678e..69d5e5206ccae77199b9df7efe7797264b42a6e7 100644
1616
--- a/BUILD.bazel
1717
+++ b/BUILD.bazel
1818
@@ -17,6 +17,7 @@ load(
@@ -23,7 +23,7 @@ index 13e4bc0c80f23907cf07a7d338a6bd4398e413ca..f62048d985496583457ef370bea74c76
2323
)
2424
load(":bazel/v8-non-pointer-compression.bzl", "v8_binary_non_pointer_compression")
2525

26-
@@ -4242,22 +4243,20 @@ filegroup(
26+
@@ -4237,22 +4238,20 @@ filegroup(
2727
}),
2828
)
2929

@@ -52,7 +52,7 @@ index 13e4bc0c80f23907cf07a7d338a6bd4398e413ca..f62048d985496583457ef370bea74c76
5252
)
5353

5454
v8_mksnapshot(
55-
@@ -4458,8 +4457,6 @@ v8_binary(
55+
@@ -4454,8 +4453,6 @@ v8_binary(
5656
srcs = [
5757
"src/regexp/gen-regexp-special-case.cc",
5858
"src/regexp/special-case.h",
@@ -61,7 +61,7 @@ index 13e4bc0c80f23907cf07a7d338a6bd4398e413ca..f62048d985496583457ef370bea74c76
6161
],
6262
copts = ["-Wno-implicit-fallthrough"],
6363
defines = [
64-
@@ -4471,6 +4468,7 @@ v8_binary(
64+
@@ -4467,6 +4464,7 @@ v8_binary(
6565
],
6666
deps = [
6767
"//external:absl_optional",

0 commit comments

Comments
 (0)