Skip to content

Commit

Permalink
update v8 to 12.4 (#2005)
Browse files Browse the repository at this point in the history
Co-authored-by: James M Snell <jasnell@gmail.com>
  • Loading branch information
garrettgu10 and jasnell committed Apr 29, 2024
1 parent cdb18b7 commit 2fe7335
Show file tree
Hide file tree
Showing 22 changed files with 237 additions and 470 deletions.
29 changes: 21 additions & 8 deletions WORKSPACE
Expand Up @@ -144,6 +144,11 @@ git_repository(
build_file = "//:build/BUILD.dawn",
commit = "c5169ef5b9982e17a8caddd1218aa0ad5e24a4e3",
remote = "https://dawn.googlesource.com/dawn.git",
patches = [
"//:patches/dawn/0001-Add-iomanip.patch",
"//:patches/dawn/0002-Add-missing-array-import.patch",
],
patch_args = ["-p1"],
repo_mapping = {
"@abseil_cpp": "@com_google_absl",
},
Expand Down Expand Up @@ -186,10 +191,17 @@ http_archive(
# to confusing compiler errors in tcmalloc in the past.
git_repository(
name = "com_google_absl",
commit = "0764ad493e54a79c7e3e02fc3412ef55b4835b9e",
commit = "b3ae305fd5dbc6ad41eed9add26768c29181219f",
remote = "https://chromium.googlesource.com/chromium/src/third_party/abseil-cpp.git",
)

git_repository(
name = "fp16",
commit = "0a92994d729ff76a58f692d3028ca1b64b145d91",
build_file_content = "exports_files(glob([\"**\"]))",
remote = "https://chromium.googlesource.com/external/github.com/Maratyszcza/FP16.git"
)

# Bindings for abseil libraries used by V8
[
bind(
Expand Down Expand Up @@ -451,15 +463,16 @@ http_archive(
"//:patches/v8/0010-Enable-V8-shared-linkage.patch",
"//:patches/v8/0011-Randomize-the-initial-ExecutionContextId-used-by-the.patch",
"//:patches/v8/0012-Always-enable-continuation-preserved-data-in-the-bui.patch",
"//:patches/v8/0013-Attach-continuation-context-to-Promise-thenable-task.patch",
"//:patches/v8/0014-increase-visibility-of-virtual-method.patch",
"//:patches/v8/0015-Add-ValueSerializer-SetTreatFunctionsAsHostObjects.patch",
"//:patches/v8/0016-wasm-liftoff-arm64-Fix-LoadTaggedPointer.patch",
"//:patches/v8/0013-increase-visibility-of-virtual-method.patch",
"//:patches/v8/0014-Add-ValueSerializer-SetTreatFunctionsAsHostObjects.patch",
"//: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",
],
integrity = "sha256-QphdaJn35eZeo+qoayNFIgm02hX5WHjKf+pr3WXCiEs=",
strip_prefix = "v8-12.3.219.10",
integrity = "sha256-C6bsXXbKgeCxmG1VNO/LScaPq0HVlmofpVHJ5kswoLg=",
strip_prefix = "v8-12.4.254.11",
type = "tgz",
url = "https://github.com/v8/v8/archive/refs/tags/12.3.219.10.tar.gz",
url = "https://github.com/v8/v8/archive/refs/tags/12.4.254.11.tar.gz",
)

git_repository(
Expand Down
17 changes: 17 additions & 0 deletions patches/dawn/0001-Add-iomanip.patch
@@ -0,0 +1,17 @@
From 37bc132e418017ff70e5c5a4562c457c2064f49b Mon Sep 17 00:00:00 2001
From: James M Snell <jasnell@gmail.com>
Date: Mon, 29 Apr 2024 13:22:55 -0700
Subject: Add iomanip


diff --git a/src/dawn/native/stream/ByteVectorSink.cpp b/src/dawn/native/stream/ByteVectorSink.cpp
--- a/src/dawn/native/stream/ByteVectorSink.cpp
+++ b/src/dawn/native/stream/ByteVectorSink.cpp
@@ -27,6 +27,7 @@

#include "dawn/native/stream/ByteVectorSink.h"

+#include <iomanip>
#include "dawn/native/stream/Stream.h"

namespace dawn::native::stream {
18 changes: 18 additions & 0 deletions patches/dawn/0002-Add-missing-array-import.patch
@@ -0,0 +1,18 @@
From 340abe0c734899650f10ce19f0a45d8aa4981972 Mon Sep 17 00:00:00 2001
From: James M Snell <jasnell@gmail.com>
Date: Mon, 29 Apr 2024 14:22:47 -0700
Subject: Add missing array import


diff --git a/src/dawn/native/ApplyClearColorValueWithDrawHelper.h b/src/dawn/native/ApplyClearColorValueWithDrawHelper.h
index a1ff88e07a9572baacf8a96e35d830c318b56777..00b4795b41711a10106cece1bcac2644fcf7dcaa 100644
--- a/src/dawn/native/ApplyClearColorValueWithDrawHelper.h
+++ b/src/dawn/native/ApplyClearColorValueWithDrawHelper.h
@@ -29,6 +29,7 @@
#define SRC_DAWN_NATIVE_APPLYCLEARVALUEWITHDRAWHELPER_H_

#include <bitset>
+#include <array>
#include <unordered_map>
#include "dawn/common/Constants.h"
#include "dawn/native/Error.h"
@@ -1,4 +1,4 @@
From c0e8edbdd404361db740316cd43bc347bfe4730f Mon Sep 17 00:00:00 2001
From 9cd118a8ffa4c2154438f65503e3fdb8c9b1741d Mon Sep 17 00:00:00 2001
From: Alex Robinson <arobinson@cloudflare.com>
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 9ca94b045c26c97292ad376c88d794a3dce11660..f3c446b7fe82158dab17c103062ababfb368e50e 100644
index a7070c494c211bec5692767e26ab7bd072b2d6fd..b94dd72c64ef345ca6f13c246c93b7b7191d2cf9 100644
--- a/src/api/api.cc
+++ b/src/api/api.cc
@@ -3691,6 +3691,10 @@ uint32_t ValueDeserializer::GetWireFormatVersion() const {
@@ -3645,6 +3645,10 @@ uint32_t ValueDeserializer::GetWireFormatVersion() const {
return private_->deserializer.GetWireFormatVersion();
}

Expand Down
@@ -1,4 +1,4 @@
From 6f67b7491de310dbe14586402d03ca489598496c Mon Sep 17 00:00:00 2001
From e235a6aabeddaf28c1214e628c4a41edef552d69 Mon Sep 17 00:00:00 2001
From: James M Snell <jasnell@gmail.com>
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 f3c446b7fe82158dab17c103062ababfb368e50e..8418ea61dfcaa87dc68834b2254cdce8e55186ad 100644
index b94dd72c64ef345ca6f13c246c93b7b7191d2cf9..b375bfe4d9a82c4dc2ecae1de9349d02c4dd47aa 100644
--- a/src/api/api.cc
+++ b/src/api/api.cc
@@ -3559,6 +3559,10 @@ ValueSerializer::ValueSerializer(Isolate* v8_isolate, Delegate* delegate)
@@ -3513,6 +3513,10 @@ ValueSerializer::ValueSerializer(Isolate* v8_isolate, Delegate* delegate)

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

Expand All @@ -37,18 +37,18 @@ index f3c446b7fe82158dab17c103062ababfb368e50e..8418ea61dfcaa87dc68834b2254cdce8

void ValueSerializer::SetTreatArrayBufferViewsAsHostObjects(bool mode) {
diff --git a/src/objects/value-serializer.cc b/src/objects/value-serializer.cc
index 1b2eefa1ea67e0ea9f03641bf2e454a1046cb267..f0b1956253fe603ad6da30a41fb923078ef6bd78 100644
index 50dbe657283d4c22aacef6824eee670281cd164c..f6b3579da294d86b6ad415471e2f29538ed5a629 100644
--- a/src/objects/value-serializer.cc
+++ b/src/objects/value-serializer.cc
@@ -267,6 +267,7 @@ ValueSerializer::ValueSerializer(Isolate* isolate,
@@ -291,6 +291,7 @@ ValueSerializer::ValueSerializer(Isolate* isolate,
: isolate_(isolate),
delegate_(delegate),
zone_(isolate->allocator(), ZONE_NAME),
+ version_(kLatestVersion),
id_map_(isolate->heap(), ZoneAllocationPolicy(&zone_)),
array_buffer_transfer_map_(isolate->heap(),
ZoneAllocationPolicy(&zone_)) {
@@ -286,9 +287,17 @@ ValueSerializer::~ValueSerializer() {
@@ -310,9 +311,17 @@ ValueSerializer::~ValueSerializer() {
}
}

Expand All @@ -67,7 +67,7 @@ index 1b2eefa1ea67e0ea9f03641bf2e454a1046cb267..f0b1956253fe603ad6da30a41fb92307
}

void ValueSerializer::SetTreatArrayBufferViewsAsHostObjects(bool mode) {
@@ -1011,10 +1020,12 @@ Maybe<bool> ValueSerializer::WriteJSArrayBufferView(
@@ -1035,10 +1044,12 @@ Maybe<bool> ValueSerializer::WriteJSArrayBufferView(
WriteVarint(static_cast<uint8_t>(tag));
WriteVarint(static_cast<uint32_t>(view->byte_offset()));
WriteVarint(static_cast<uint32_t>(view->byte_length()));
Expand Down
2 changes: 1 addition & 1 deletion patches/v8/0003-Add-ArrayBuffer-MaybeNew.patch
@@ -1,4 +1,4 @@
From 18c53a127e3d83ae49dc0cab45a0ba78e6111ac8 Mon Sep 17 00:00:00 2001
From 831deb67e4977c12667462f3b67efababdd3c411 Mon Sep 17 00:00:00 2001
From: Kenton Varda <kenton@cloudflare.com>
Date: Fri, 16 Sep 2022 21:41:45 -0500
Subject: Add `ArrayBuffer::MaybeNew()`.
Expand Down
24 changes: 12 additions & 12 deletions patches/v8/0004-Allow-Windows-builds-under-Bazel.patch
@@ -1,14 +1,14 @@
From 92cd581a93d31cb4f0f06e04a479bb35cc5bab13 Mon Sep 17 00:00:00 2001
From 41767e80304816d674136ce08ab241596e4494ee Mon Sep 17 00:00:00 2001
From: Brendan Coll <bcoll@cloudflare.com>
Date: Thu, 16 Mar 2023 11:56:10 +0000
Subject: Allow Windows builds under Bazel


diff --git a/BUILD.bazel b/BUILD.bazel
index 2351c1e3300e0b1d258c558e6c333086238eba4a..fcfc5aa3ad57722c4b4d11783cf5ae704c8c859f 100644
index 05b7472165ae858df0a300279c6065c38faf1768..4a914c56851dbd43329829f9b42c9ca500055fc7 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -777,6 +777,7 @@ filegroup(
@@ -778,6 +778,7 @@ filegroup(
"src/base/platform/mutex.h",
"src/base/platform/platform.cc",
"src/base/platform/platform.h",
Expand Down Expand Up @@ -40,7 +40,7 @@ index 2351c1e3300e0b1d258c558e6c333086238eba4a..fcfc5aa3ad57722c4b4d11783cf5ae70
"src/api/api-arguments.cc",
"src/api/api-arguments.h",
"src/api/api-arguments-inl.h",
@@ -2671,6 +2673,11 @@ filegroup(
@@ -2672,6 +2674,11 @@ filegroup(
"src/trap-handler/handler-inside-posix.cc",
"src/trap-handler/handler-outside-posix.cc",
],
Expand All @@ -52,7 +52,7 @@ index 2351c1e3300e0b1d258c558e6c333086238eba4a..fcfc5aa3ad57722c4b4d11783cf5ae70
"//conditions:default": [],
}) + select({
"@v8//bazel/config:v8_arm64_simulator": [
@@ -2678,13 +2685,6 @@ filegroup(
@@ -2679,13 +2686,6 @@ filegroup(
"src/trap-handler/trap-handler-simulator.h",
],
"//conditions:default": [],
Expand All @@ -66,7 +66,7 @@ index 2351c1e3300e0b1d258c558e6c333086238eba4a..fcfc5aa3ad57722c4b4d11783cf5ae70
}) + select({
"@v8//bazel/config:is_windows_64bit": [
"src/diagnostics/unwinding-info-win64.cc",
@@ -3675,6 +3675,9 @@ filegroup(
@@ -3682,6 +3682,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 2351c1e3300e0b1d258c558e6c333086238eba4a..fcfc5aa3ad57722c4b4d11783cf5ae70
}),
)

@@ -4038,9 +4041,11 @@ filegroup(
@@ -4057,9 +4060,11 @@ filegroup(
"src/d8/d8-js.cc",
"src/d8/d8-platforms.cc",
"src/d8/d8-platforms.h",
Expand All @@ -90,7 +90,7 @@ index 2351c1e3300e0b1d258c558e6c333086238eba4a..fcfc5aa3ad57722c4b4d11783cf5ae70
)

genrule(
@@ -4376,7 +4381,7 @@ py_test(
@@ -4396,7 +4401,7 @@ py_test(
":noicu/d8",
":noicu/v8_build_config",
"//testing/pybase",
Expand All @@ -99,7 +99,7 @@ index 2351c1e3300e0b1d258c558e6c333086238eba4a..fcfc5aa3ad57722c4b4d11783cf5ae70
main = "tools/run-tests.py",
python_version = "PY3",
tags = [
@@ -4406,7 +4411,7 @@ py_test(
@@ -4426,7 +4431,7 @@ py_test(
":icu/d8",
":icu/v8_build_config",
"//testing/pybase",
Expand Down Expand Up @@ -178,7 +178,7 @@ index 67454fa90eea460e70e286623fb1c99edd22c650..7efff1ab909dc7048a216e511c2e71c7
name = "is_clang",
match_any = [
diff --git a/bazel/defs.bzl b/bazel/defs.bzl
index 1ea9bc0da8de0f3fe3d39cfac0c920d60ea763b9..f050b04f76b96fbc761671958126b62288f94fd5 100644
index f23f48ef03ae6adb08e3cfa605bff35d820c865e..fba64a0ca755da3c4a6b24a02d16ca552113a384 100644
--- a/bazel/defs.bzl
+++ b/bazel/defs.bzl
@@ -118,6 +118,24 @@ def _default_args():
Expand Down Expand Up @@ -230,15 +230,15 @@ index 1ea9bc0da8de0f3fe3d39cfac0c920d60ea763b9..f050b04f76b96fbc761671958126b622
],
"@v8//bazel/config:is_macos": ["-pthread"],
"//conditions:default": ["-Wl,--no-as-needed -ldl -pthread"],
@@ -498,6 +526,7 @@ def v8_mksnapshot(name, args, suffix = ""):
@@ -492,6 +520,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": "",
}),
)
@@ -509,6 +538,7 @@ def v8_mksnapshot(name, args, suffix = ""):
@@ -503,6 +532,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
@@ -1,4 +1,4 @@
From acfe5d6daeb91acfaacf0f3f8f38e4d43f2f8e23 Mon Sep 17 00:00:00 2001
From f67a62ae6200e4394bcd885d2c5953098244131a Mon Sep 17 00:00:00 2001
From: Felix Hanau <felix@cloudflare.com>
Date: Tue, 11 Apr 2023 14:41:31 -0400
Subject: Disable bazel whole-archive build
Expand Down
@@ -1,4 +1,4 @@
From 4a43a003fcba6d9a441a906a8c3f4360a2890806 Mon Sep 17 00:00:00 2001
From bb0e0093b5b827b32b98655541fb7452062083ba Mon Sep 17 00:00:00 2001
From: Kenton Varda <kenton@cloudflare.com>
Date: Tue, 23 May 2023 09:18:57 -0500
Subject: Make v8::Locker automatically call isolate->Enter().
Expand Down
@@ -1,4 +1,4 @@
From 45609de67c8486fbda8342799cb36ee1d8d94383 Mon Sep 17 00:00:00 2001
From 7ffee5a4b6c0cf7b144616a1023a074c71335333 Mon Sep 17 00:00:00 2001
From: Kenton Varda <kenton@cloudflare.com>
Date: Tue, 23 May 2023 09:24:11 -0500
Subject: Add an API to capture and restore the cage base pointers.
Expand Down
@@ -1,4 +1,4 @@
From 902b7c63a8ae4c3fb7732d8999eb0d04538c115d Mon Sep 17 00:00:00 2001
From 2d9e350afb0511e2be66fdfc28321ecef79a9f4d Mon Sep 17 00:00:00 2001
From: Felix Hanau <felix@cloudflare.com>
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 fcfc5aa3ad57722c4b4d11783cf5ae704c8c859f..6a1a43db67d607b23f7319f296f03dc67905d970 100644
index 4a914c56851dbd43329829f9b42c9ca500055fc7..11c26187981450ccbb1291217cae2c4fae3db023 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -17,6 +17,7 @@ load(
Expand All @@ -23,7 +23,7 @@ index fcfc5aa3ad57722c4b4d11783cf5ae704c8c859f..6a1a43db67d607b23f7319f296f03dc6
)
load(":bazel/v8-non-pointer-compression.bzl", "v8_binary_non_pointer_compression")

@@ -4048,22 +4049,20 @@ filegroup(
@@ -4067,22 +4068,20 @@ filegroup(
}),
)

Expand Down Expand Up @@ -52,7 +52,7 @@ index fcfc5aa3ad57722c4b4d11783cf5ae704c8c859f..6a1a43db67d607b23f7319f296f03dc6
)

v8_mksnapshot(
@@ -4263,8 +4262,6 @@ v8_binary(
@@ -4283,8 +4282,6 @@ v8_binary(
srcs = [
"src/regexp/gen-regexp-special-case.cc",
"src/regexp/special-case.h",
Expand All @@ -61,7 +61,7 @@ index fcfc5aa3ad57722c4b4d11783cf5ae704c8c859f..6a1a43db67d607b23f7319f296f03dc6
],
copts = ["-Wno-implicit-fallthrough"],
defines = [
@@ -4276,6 +4273,7 @@ v8_binary(
@@ -4296,6 +4293,7 @@ v8_binary(
],
deps = [
"//external:absl_optional",
Expand All @@ -70,7 +70,7 @@ index fcfc5aa3ad57722c4b4d11783cf5ae704c8c859f..6a1a43db67d607b23f7319f296f03dc6
],
)
diff --git a/bazel/defs.bzl b/bazel/defs.bzl
index f050b04f76b96fbc761671958126b62288f94fd5..e3f5a9b50341b2d083e0b4532b99f930d2f73b18 100644
index fba64a0ca755da3c4a6b24a02d16ca552113a384..a8552489ae1901e380fe6825def658911ffb9d62 100644
--- a/bazel/defs.bzl
+++ b/bazel/defs.bzl
@@ -337,6 +337,15 @@ def v8_library(
Expand All @@ -89,7 +89,7 @@ index f050b04f76b96fbc761671958126b62288f94fd5..e3f5a9b50341b2d083e0b4532b99f930
# 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.
@@ -404,7 +413,7 @@ _v8_torque_files = rule(
@@ -401,7 +410,7 @@ _v8_torque_files = rule(
"tool": attr.label(
allow_files = True,
executable = True,
Expand All @@ -98,20 +98,14 @@ index f050b04f76b96fbc761671958126b62288f94fd5..e3f5a9b50341b2d083e0b4532b99f930
),
"args": attr.string_list(),
},
@@ -505,16 +514,19 @@ _v8_mksnapshot = rule(
@@ -502,13 +511,16 @@ _v8_mksnapshot = rule(
mandatory = True,
allow_files = True,
executable = True,
- cfg = "exec",
+ cfg = get_cfg(),
),
"target_os": attr.string(mandatory = True),
- "_allowlist_function_transition": attr.label(
- default = "@bazel_tools//tools/allowlists/function_transition_allowlist",
- ),
+ # "_allowlist_function_transition": attr.label(
+ # default = "@bazel_tools//tools/allowlists/function_transition_allowlist",
+ # ),
"prefix": attr.string(mandatory = True),
"suffix": attr.string(mandatory = True),
},
Expand All @@ -123,7 +117,7 @@ index f050b04f76b96fbc761671958126b62288f94fd5..e3f5a9b50341b2d083e0b4532b99f930
)

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

0 comments on commit 2fe7335

Please sign in to comment.