Skip to content

Commit

Permalink
Merge pull request #2104 from cloudflare/jphillips/v8-12.5
Browse files Browse the repository at this point in the history
Update to v8 12.5.
  • Loading branch information
jp4a50 authored May 10, 2024
2 parents 62481a4 + 6d2c942 commit 34a2739
Show file tree
Hide file tree
Showing 26 changed files with 193 additions and 118 deletions.
10 changes: 6 additions & 4 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ http_archive(
# to confusing compiler errors in tcmalloc in the past.
git_repository(
name = "com_google_absl",
commit = "b3ae305fd5dbc6ad41eed9add26768c29181219f",
commit = "a64dd87cec79c80c88190265cfea0cbd4027677f",
remote = "https://chromium.googlesource.com/chromium/src/third_party/abseil-cpp.git",
)

Expand Down Expand Up @@ -468,11 +468,13 @@ http_archive(
"//:patches/v8/0015-Set-torque-generator-path-to-external-v8.-This-allow.patch",
"//:patches/v8/0016-Modify-where-to-look-for-fp16-dependency.-This-depen.patch",
"//:patches/v8/0017-Fixup-RunMicrotask-to-restore-async-context-on-termi.patch",
"//:patches/v8/0018-Expose-v8-Symbol-GetDispose.patch",
"//:patches/v8/0019-Rename-V8_COMPRESS_POINTERS_IN_ISOLATE_CAGE.patch",
],
integrity = "sha256-C6bsXXbKgeCxmG1VNO/LScaPq0HVlmofpVHJ5kswoLg=",
strip_prefix = "v8-12.4.254.11",
integrity = "sha256-61Qzg9XnA/S2Jw1xSDgfGm8VUnrPR483gcsQOqlBNq0=",
strip_prefix = "v8-12.5.227.3",
type = "tgz",
url = "https://github.com/v8/v8/archive/refs/tags/12.4.254.11.tar.gz",
url = "https://github.com/v8/v8/archive/refs/tags/12.5.227.3.tar.gz",
)

git_repository(
Expand Down
2 changes: 1 addition & 1 deletion docs/v8-updates.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,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`, `com_google_chromium_icu` and `trace_event_common`.
These currently include `abseil`, `com_googlesource_chromium_icu` and `trace_event_common`.
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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 9cd118a8ffa4c2154438f65503e3fdb8c9b1741d Mon Sep 17 00:00:00 2001
From 5d5e25c278ac0afc8e48386cc61b936e7eac10ed Mon Sep 17 00:00:00 2001
From: Alex Robinson <[email protected]>
Date: Wed, 2 Mar 2022 15:58:04 -0600
Subject: Allow manually setting ValueDeserializer format version
Expand Down Expand Up @@ -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 a7070c494c211bec5692767e26ab7bd072b2d6fd..b94dd72c64ef345ca6f13c246c93b7b7191d2cf9 100644
index e99e7d9d1359c4fcd38478412ebfc1586eeda7b3..151d0380c5c8d043f2f9a6d556d463040749167d 100644
--- a/src/api/api.cc
+++ b/src/api/api.cc
@@ -3645,6 +3645,10 @@ uint32_t ValueDeserializer::GetWireFormatVersion() const {
@@ -3582,6 +3582,10 @@ uint32_t ValueDeserializer::GetWireFormatVersion() const {
return private_->deserializer.GetWireFormatVersion();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From e235a6aabeddaf28c1214e628c4a41edef552d69 Mon Sep 17 00:00:00 2001
From 599f2f35811c9afefe99a45724ae89e8c2b169f0 Mon Sep 17 00:00:00 2001
From: James M Snell <[email protected]>
Date: Wed, 16 Mar 2022 08:59:21 -0700
Subject: Allow manually setting ValueSerializer format version
Expand All @@ -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 b94dd72c64ef345ca6f13c246c93b7b7191d2cf9..b375bfe4d9a82c4dc2ecae1de9349d02c4dd47aa 100644
index 151d0380c5c8d043f2f9a6d556d463040749167d..9d46870f6bfdfee90d38a7b3cda2d9846196addc 100644
--- a/src/api/api.cc
+++ b/src/api/api.cc
@@ -3513,6 +3513,10 @@ ValueSerializer::ValueSerializer(Isolate* v8_isolate, Delegate* delegate)
@@ -3450,6 +3450,10 @@ ValueSerializer::ValueSerializer(Isolate* v8_isolate, Delegate* delegate)

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

Expand All @@ -37,7 +37,7 @@ index b94dd72c64ef345ca6f13c246c93b7b7191d2cf9..b375bfe4d9a82c4dc2ecae1de9349d02

void ValueSerializer::SetTreatArrayBufferViewsAsHostObjects(bool mode) {
diff --git a/src/objects/value-serializer.cc b/src/objects/value-serializer.cc
index 50dbe657283d4c22aacef6824eee670281cd164c..f6b3579da294d86b6ad415471e2f29538ed5a629 100644
index 1c8f2fa9122e46d8813569504c0534f38f8ae53d..bb36e71af9cb2fda605200550a36c0a74e560671 100644
--- a/src/objects/value-serializer.cc
+++ b/src/objects/value-serializer.cc
@@ -291,6 +291,7 @@ ValueSerializer::ValueSerializer(Isolate* isolate,
Expand Down
6 changes: 3 additions & 3 deletions patches/v8/0003-Add-ArrayBuffer-MaybeNew.patch
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 831deb67e4977c12667462f3b67efababdd3c411 Mon Sep 17 00:00:00 2001
From 124a4fecfef38f07e8851ad8003db94950c3d2bc Mon Sep 17 00:00:00 2001
From: Kenton Varda <[email protected]>
Date: Fri, 16 Sep 2022 21:41:45 -0500
Subject: Add `ArrayBuffer::MaybeNew()`.
Expand All @@ -8,10 +8,10 @@ In Cloudflare's edge runtime, this is part of a larger patch that allows gracefu
(We would like to upstream our internal patch, just need to find the time...)

diff --git a/include/v8-array-buffer.h b/include/v8-array-buffer.h
index ea6f5b5571a476574d3fb0cd495d162f3b333b0f..e0ccd9dadb0c30f1f040a5240d46dae0883f4fb0 100644
index 5d855441f8ed7bd775332c0a20d7a57411a1baa8..981dda00eede693bff1d3a240ffe2396b5de9f21 100644
--- a/include/v8-array-buffer.h
+++ b/include/v8-array-buffer.h
@@ -210,6 +210,14 @@ class V8_EXPORT ArrayBuffer : public Object {
@@ -216,6 +216,14 @@ class V8_EXPORT ArrayBuffer : public Object {
*/
size_t MaxByteLength() const;

Expand Down
34 changes: 17 additions & 17 deletions patches/v8/0004-Allow-Windows-builds-under-Bazel.patch
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
From 41767e80304816d674136ce08ab241596e4494ee Mon Sep 17 00:00:00 2001
From fa10e15fe7cef2b0b221b231d6ad9f8f3bc04de5 Mon Sep 17 00:00:00 2001
From: Brendan Coll <[email protected]>
Date: Thu, 16 Mar 2023 11:56:10 +0000
Subject: Allow Windows builds under Bazel


diff --git a/BUILD.bazel b/BUILD.bazel
index 05b7472165ae858df0a300279c6065c38faf1768..4a914c56851dbd43329829f9b42c9ca500055fc7 100644
index 453726808be0e2c9b5f7cbdbec148e480b4c7349..026eeebd5a336597e3bc89b9239a919d94feb6a2 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -778,6 +778,7 @@ filegroup(
@@ -779,6 +779,7 @@ filegroup(
"src/base/platform/mutex.h",
"src/base/platform/platform.cc",
"src/base/platform/platform.h",
+ "src/base/platform/platform-posix.h", # Always included by src/execution/isolate.h
"src/base/platform/semaphore.cc",
"src/base/platform/semaphore.h",
"src/base/platform/time.cc",
@@ -817,7 +818,6 @@ filegroup(
@@ -820,7 +821,6 @@ filegroup(
] + select({
"@v8//bazel/config:is_posix": [
"src/base/platform/platform-posix.cc",
- "src/base/platform/platform-posix.h",
"src/base/platform/platform-posix-time.cc",
"src/base/platform/platform-posix-time.h",
],
@@ -840,6 +840,7 @@ filegroup(
@@ -843,6 +843,7 @@ filegroup(
"@v8//bazel/config:is_windows": [
"src/base/debug/stack_trace_win.cc",
"src/base/platform/platform-win32.cc",
+ "src/base/platform/platform-win32.h",
"src/base/win32-headers.h",
],
}),
@@ -1229,6 +1230,7 @@ filegroup(
@@ -1233,6 +1234,7 @@ filegroup(
"include/v8-wasm-trap-handler-posix.h",
"src/api/api.cc",
"src/api/api.h",
+ "include/v8-wasm-trap-handler-win.h",
"src/api/api-arguments.cc",
"src/api/api-arguments.h",
"src/api/api-arguments-inl.h",
@@ -2672,6 +2674,11 @@ filegroup(
@@ -2686,6 +2688,11 @@ filegroup(
"src/trap-handler/handler-inside-posix.cc",
"src/trap-handler/handler-outside-posix.cc",
],
Expand All @@ -52,7 +52,7 @@ index 05b7472165ae858df0a300279c6065c38faf1768..4a914c56851dbd43329829f9b42c9ca5
"//conditions:default": [],
}) + select({
"@v8//bazel/config:v8_arm64_simulator": [
@@ -2679,13 +2686,6 @@ filegroup(
@@ -2693,13 +2700,6 @@ filegroup(
"src/trap-handler/trap-handler-simulator.h",
],
"//conditions:default": [],
Expand All @@ -66,7 +66,7 @@ index 05b7472165ae858df0a300279c6065c38faf1768..4a914c56851dbd43329829f9b42c9ca5
}) + select({
"@v8//bazel/config:is_windows_64bit": [
"src/diagnostics/unwinding-info-win64.cc",
@@ -3682,6 +3682,9 @@ filegroup(
@@ -3693,6 +3693,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"],
Expand All @@ -76,7 +76,7 @@ index 05b7472165ae858df0a300279c6065c38faf1768..4a914c56851dbd43329829f9b42c9ca5
}),
)

@@ -4057,9 +4060,11 @@ filegroup(
@@ -4068,9 +4071,11 @@ filegroup(
"src/d8/d8-js.cc",
"src/d8/d8-platforms.cc",
"src/d8/d8-platforms.h",
Expand All @@ -90,7 +90,7 @@ index 05b7472165ae858df0a300279c6065c38faf1768..4a914c56851dbd43329829f9b42c9ca5
)

genrule(
@@ -4396,7 +4401,7 @@ py_test(
@@ -4407,7 +4412,7 @@ py_test(
":noicu/d8",
":noicu/v8_build_config",
"//testing/pybase",
Expand All @@ -99,7 +99,7 @@ index 05b7472165ae858df0a300279c6065c38faf1768..4a914c56851dbd43329829f9b42c9ca5
main = "tools/run-tests.py",
python_version = "PY3",
tags = [
@@ -4426,7 +4431,7 @@ py_test(
@@ -4437,7 +4442,7 @@ py_test(
":icu/d8",
":icu/v8_build_config",
"//testing/pybase",
Expand Down Expand Up @@ -178,10 +178,10 @@ index 67454fa90eea460e70e286623fb1c99edd22c650..7efff1ab909dc7048a216e511c2e71c7
name = "is_clang",
match_any = [
diff --git a/bazel/defs.bzl b/bazel/defs.bzl
index f23f48ef03ae6adb08e3cfa605bff35d820c865e..fba64a0ca755da3c4a6b24a02d16ca552113a384 100644
index 2c49fe59ba342491b53dfae762ee6f882cebf075..4fafb2ae40afa499356777f9bbfedf25f808fdd7 100644
--- a/bazel/defs.bzl
+++ b/bazel/defs.bzl
@@ -118,6 +118,24 @@ def _default_args():
@@ -119,6 +119,24 @@ def _default_args():
"-Wno-non-virtual-dtor",
"-isystem .",
],
Expand All @@ -206,7 +206,7 @@ index f23f48ef03ae6adb08e3cfa605bff35d820c865e..fba64a0ca755da3c4a6b24a02d16ca55
"//conditions:default": [],
}) + select({
"@v8//bazel/config:is_clang": [
@@ -164,13 +182,23 @@ def _default_args():
@@ -165,13 +183,23 @@ def _default_args():
],
"//conditions:default": [
],
Expand All @@ -230,15 +230,15 @@ index f23f48ef03ae6adb08e3cfa605bff35d820c865e..fba64a0ca755da3c4a6b24a02d16ca55
],
"@v8//bazel/config:is_macos": ["-pthread"],
"//conditions:default": ["-Wl,--no-as-needed -ldl -pthread"],
@@ -492,6 +520,7 @@ def v8_mksnapshot(name, args, suffix = ""):
@@ -493,6 +521,7 @@ def v8_mksnapshot(name, args, suffix = ""):
suffix = suffix,
target_os = select({
"@v8//bazel/config:is_macos": "mac",
+ "@v8//bazel/config:is_windows": "win",
"//conditions:default": "",
}),
)
@@ -503,6 +532,7 @@ def v8_mksnapshot(name, args, suffix = ""):
@@ -504,6 +533,7 @@ def v8_mksnapshot(name, args, suffix = ""):
suffix = suffix,
target_os = select({
"@v8//bazel/config:is_macos": "mac",
Expand Down
2 changes: 1 addition & 1 deletion patches/v8/0005-Disable-bazel-whole-archive-build.patch
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From f67a62ae6200e4394bcd885d2c5953098244131a Mon Sep 17 00:00:00 2001
From 3a50fdac34c69d142ea40df39bc05fa02d0771c7 Mon Sep 17 00:00:00 2001
From: Felix Hanau <[email protected]>
Date: Tue, 11 Apr 2023 14:41:31 -0400
Subject: Disable bazel whole-archive build
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From bb0e0093b5b827b32b98655541fb7452062083ba Mon Sep 17 00:00:00 2001
From e1f71b7b5e1df33c0d05c7e932c6816d20062b33 Mon Sep 17 00:00:00 2001
From: Kenton Varda <[email protected]>
Date: Tue, 23 May 2023 09:18:57 -0500
Subject: Make v8::Locker automatically call isolate->Enter().
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 7ffee5a4b6c0cf7b144616a1023a074c71335333 Mon Sep 17 00:00:00 2001
From 8dab305cca01cf429c15b75b11f59b5917089e9d Mon Sep 17 00:00:00 2001
From: Kenton Varda <[email protected]>
Date: Tue, 23 May 2023 09:24:11 -0500
Subject: Add an API to capture and restore the cage base pointers.
Expand Down Expand Up @@ -56,7 +56,7 @@ index 22b7a8767a83a702a2601bdfd4c0f71206df0ad5..fee48faffe82400595dca17197c5bbee

#endif // INCLUDE_V8_LOCKER_H_
diff --git a/src/execution/v8threads.cc b/src/execution/v8threads.cc
index 91e1a43d305d06fdf07fccdf80eb07e86115619b..dfe5da8f6bdc5a30d65b7f31d0e3a42fbe49d22b 100644
index 91e1a43d305d06fdf07fccdf80eb07e86115619b..857da6f175e666930a0d768fbf9edb935f04da5e 100644
--- a/src/execution/v8threads.cc
+++ b/src/execution/v8threads.cc
@@ -6,6 +6,7 @@
Expand All @@ -74,7 +74,7 @@ index 91e1a43d305d06fdf07fccdf80eb07e86115619b..dfe5da8f6bdc5a30d65b7f31d0e3a42f
+
+PointerCageContext PointerCageContext::GetCurrent() {
+ PointerCageContext result;
+#ifdef V8_COMPRESS_POINTERS_IN_ISOLATE_CAGE
+#ifdef V8_COMPRESS_POINTERS_IN_MULTIPLE_CAGES
+ result.cage = i::V8HeapCompressionScheme::base();
+#ifdef V8_EXTERNAL_CODE_SPACE
+ result.code_cage = i::ExternalCodeCompressionScheme::base();
Expand All @@ -84,12 +84,12 @@ index 91e1a43d305d06fdf07fccdf80eb07e86115619b..dfe5da8f6bdc5a30d65b7f31d0e3a42f
+#else
+ result.cage = 0;
+ result.code_cage = 0;
+#endif // V8_COMPRESS_POINTERS_IN_ISOLATE_CAGE
+#endif // V8_COMPRESS_POINTERS_IN_MULTIPLE_CAGES
+ return result;
+}
+
+void PointerCageContext::Apply() const {
+#ifdef V8_COMPRESS_POINTERS_IN_ISOLATE_CAGE
+#ifdef V8_COMPRESS_POINTERS_IN_MULTIPLE_CAGES
+ i::V8HeapCompressionScheme::InitBase(cage);
+#ifdef V8_EXTERNAL_CODE_SPACE
+ i::ExternalCodeCompressionScheme::InitBase(code_cage);
Expand All @@ -99,7 +99,7 @@ index 91e1a43d305d06fdf07fccdf80eb07e86115619b..dfe5da8f6bdc5a30d65b7f31d0e3a42f
+ // warning with this line.
+ (void)code_cage;
+#endif // V8_EXTERNAL_CODE_SPACE
+#endif // V8_COMPRESS_POINTERS_IN_ISOLATE_CAGE
+#endif // V8_COMPRESS_POINTERS_IN_MULTIPLE_CAGES
+}
+
} // namespace v8
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 2d9e350afb0511e2be66fdfc28321ecef79a9f4d Mon Sep 17 00:00:00 2001
From 44c1b5772d868c1f048c7cdc30c954a501cc4d09 Mon Sep 17 00:00:00 2001
From: Felix Hanau <[email protected]>
Date: Wed, 7 Jun 2023 21:40:54 -0400
Subject: Speed up V8 bazel build by always using target cfg
Expand All @@ -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 4a914c56851dbd43329829f9b42c9ca500055fc7..11c26187981450ccbb1291217cae2c4fae3db023 100644
index 026eeebd5a336597e3bc89b9239a919d94feb6a2..35c8ec1656a0874c182d420954c7b1101dd6b1f7 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -17,6 +17,7 @@ load(
Expand All @@ -23,7 +23,7 @@ index 4a914c56851dbd43329829f9b42c9ca500055fc7..11c26187981450ccbb1291217cae2c4f
)
load(":bazel/v8-non-pointer-compression.bzl", "v8_binary_non_pointer_compression")

@@ -4067,22 +4068,20 @@ filegroup(
@@ -4078,22 +4079,20 @@ filegroup(
}),
)

Expand Down Expand Up @@ -52,7 +52,7 @@ index 4a914c56851dbd43329829f9b42c9ca500055fc7..11c26187981450ccbb1291217cae2c4f
)

v8_mksnapshot(
@@ -4283,8 +4282,6 @@ v8_binary(
@@ -4294,8 +4293,6 @@ v8_binary(
srcs = [
"src/regexp/gen-regexp-special-case.cc",
"src/regexp/special-case.h",
Expand All @@ -61,7 +61,7 @@ index 4a914c56851dbd43329829f9b42c9ca500055fc7..11c26187981450ccbb1291217cae2c4f
],
copts = ["-Wno-implicit-fallthrough"],
defines = [
@@ -4296,6 +4293,7 @@ v8_binary(
@@ -4307,6 +4304,7 @@ v8_binary(
],
deps = [
"//external:absl_optional",
Expand All @@ -70,10 +70,10 @@ index 4a914c56851dbd43329829f9b42c9ca500055fc7..11c26187981450ccbb1291217cae2c4f
],
)
diff --git a/bazel/defs.bzl b/bazel/defs.bzl
index fba64a0ca755da3c4a6b24a02d16ca552113a384..a8552489ae1901e380fe6825def658911ffb9d62 100644
index 4fafb2ae40afa499356777f9bbfedf25f808fdd7..58c5a0273769e0df997e9e92bd4274f3cb8f2fc6 100644
--- a/bazel/defs.bzl
+++ b/bazel/defs.bzl
@@ -337,6 +337,15 @@ def v8_library(
@@ -338,6 +338,15 @@ def v8_library(
**kwargs
)

Expand All @@ -89,7 +89,7 @@ index fba64a0ca755da3c4a6b24a02d16ca552113a384..a8552489ae1901e380fe6825def65891
# Use a single generator target for torque definitions and initializers. We can
# split the set of outputs by using OutputGroupInfo, that way we do not need to
# run the torque generator twice.
@@ -401,7 +410,7 @@ _v8_torque_files = rule(
@@ -402,7 +411,7 @@ _v8_torque_files = rule(
"tool": attr.label(
allow_files = True,
executable = True,
Expand All @@ -98,7 +98,7 @@ index fba64a0ca755da3c4a6b24a02d16ca552113a384..a8552489ae1901e380fe6825def65891
),
"args": attr.string_list(),
},
@@ -502,13 +511,16 @@ _v8_mksnapshot = rule(
@@ -503,13 +512,16 @@ _v8_mksnapshot = rule(
mandatory = True,
allow_files = True,
executable = True,
Expand All @@ -117,7 +117,7 @@ index fba64a0ca755da3c4a6b24a02d16ca552113a384..a8552489ae1901e380fe6825def65891
)

def v8_mksnapshot(name, args, suffix = ""):
@@ -631,3 +643,34 @@ def v8_build_config(name):
@@ -632,3 +644,34 @@ def v8_build_config(name):
outs = ["icu/" + name + ".json"],
cmd = "echo '" + build_config_content(cpu, "true") + "' > \"$@\"",
)
Expand Down
Loading

0 comments on commit 34a2739

Please sign in to comment.