To update the version of V8 used by workerd, the steps are:
-
Check https://chromiumdash.appspot.com/ and identify the latest version of V8 used by the beta versions of Chrome beta.
-
Install
depot_tools
if it is not already present on your machine. -
Fetch a local copy of V8:
mkdir v8 cd v8 fetch v8
-
Sync the local copy of V8 to the version used by workerd.
First find, the tag of the V8
http_archive
(name = "v8"
) in the workerd WORKSPACE file.Then sync your fetched version v8 based on the tag.
cd <path_to_v8>/v8 git checkout <tag> gclient sync
-
Create a V8 branch for workerd's V8 patches in your local copy of V8.
git checkout -b workerd-patches git am <path_to_workerd>/patches/v8/*
-
Rebase the workerd V8 changes onto the new version of V8. For example, assuming we are updating to 11.4.183.8 and there are 19 workerd patches for V8, the command would be:
git rebase --onto 11.4.183.8 HEAD~19
Note that
HEAD~19
, here and elsewhere, could be replaced with$(git describe --tags --abbrev=0)
, which prints the name of the tag on which the branch is based.There is usually some minor patch editing required during a rebase.
Ideally at this stage, you should be able to build and test the local V8 with the patches applied. See the V8 Testing page.
-
Re-generate workerd's V8 patches. Assuming there are 19 workerd patches for V8, the command would be:
git format-patch --full-index -k --no-signature --no-stat --zero-commit HEAD~19
-
Remove the existing patches from
workerd/patches/v8
and copy over the latest generated patches from the V8 directory. -
Update the
http_archive
for V8 in theworkerd/WORKSPACE
file.The list of patches should be refreshed if new patches are being added or existing patches are being removed.
strip_prefix
andurl
in thehttp_archive
for V8 should be updated based on the new V8 version/tag.The
integrity
check needs to be updated to the new value. You can get the new value in bazel's preferred format just by looking into the mismatch error while trying to compile workerd using the newer V8 version or by runningopenssl dgst -sha256 -binary <tarball_filename> | openssl base64 -A
-
Update V8's dependencies in
workerd/WORKSPACE
.You can find the commit versions for V8's dependencies under
v8/DEPS
and the ones that are carried through to workerd in theworkerd/WORKSPACE
file.These currently include
zlib
andcom_googlesource_chromium_icu
. Typically you'll get a build failure if the projects are out of sync. Copy the commit versions fromv8/DEPS
to theWORKSPACE
file. -
Check workerd's tests pass with the updated V8.
bazel test //...
-
Commit your workerd changes and push them for review.