Skip to content

Instantly share code, notes, and snippets.

@domenic
Last active December 11, 2020 01:45
Show Gist options
  • Star 16 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save domenic/aca7774a5d94156bfcc1 to your computer and use it in GitHub Desktop.
Save domenic/aca7774a5d94156bfcc1 to your computer and use it in GitHub Desktop.
V8 versions for embedders

Embedders of V8 should generally use the head of the branch corresponding to the minor version of V8 that ships in Chrome.

Finding the minor version of V8 corresponding to the latest stable Chrome

To find out what version this is,

  1. Go to https://omahaproxy.appspot.com/
  2. Find the latest stable Chrome version in the table
  3. Enter it into the "Translate a Chrome verison to a V8 version" box below the table.
  4. Ignore the last two parts.

Example: at the time of this writing, the site indicates that for win/stable, the Chrome release version is 39.0.2171.95. Entering that into the box gives back "V8 Version: 3.29.88.17." Cutting that down to only the minor version gives 3.29.

Finding the head of the corresponding branch

V8's version-related branches do not appear in the online repository at https://chromium.googlesource.com/v8/v8.git; instead only tags appear. To find the head of that branch, go to the URL in this form:

https://chromium.googlesource.com/v8/v8.git/+/branch-heads/<minor-version>

Example: for the V8 minor version 3.29 found above, we go to https://chromium.googlesource.com/v8/v8.git/+/branch-heads/3.29, finding a commit titled "Version 3.29.88.19 (cherry-pick)." Thus, the version of V8 that embedders should use at the time of this writing is 3.29.88.19.

Caution: You should not simply find the numerically-greatest tag corresponding to the above minor V8 version, as sometimes those are not supported, e.g. they are tagged before deciding where to cut minor releases. Such versions will not receive backports or similar.

Example: the V8 tags 3.29.91, 3.29.92, 3.29.93, and 3.29.93.1 are abandoned, despite being numerically greater than the branch head of 3.29.88.19.

Checking out the head of the corresponding branch

If you have the source already, you can check out the head somewhat directly. If you have retrieved the source using depot_tools then you should be able to do

$ git branch --remotes | grep branch-heads/

to list the relevant branches. You'll want to check out the one corresponding to the minor V8 version you found above, and use that. The tag that you end up on will be the appropriate V8 version for you as the embedder.

If you did not use depot_tools, you'll need to edit .git/config and add the line below to the [remote "origin"] section:

fetch = +refs/branch-heads/*:refs/remotes/branch-heads/*

Example: for the V8 minor version 3.29 found above, we can do

$ git checkout branch-heads/3.29
HEAD is now at 02f2ff3... Version 3.29.88.19 (cherry-pick)
@ruimarinho
Copy link

Thanks for compiling this information @domenic. I was not aware of the difference between tags and branch heads on V8.

@kapouer
Copy link

kapouer commented Jan 15, 2015

Following this, node 0.12 branch should have been using 3.28.71 instead of 3.28.73, no ?

@hashseed
Copy link

There is no need to "Translate a Chrome verison to a V8 version". If you simply scroll right in that table, the V8 version is in the next to the last row.

@kentonv
Copy link

kentonv commented Jul 11, 2017

I believe the above instructions can be summarized as:

V8_VERSION=$(curl -s 'https://omahaproxy.appspot.com/all.json?os=linux&channel=stable' |
    jq -r '.[].versions[].v8_version' |
    egrep -o '^[0-9]+\.[0-9]+\b')
git checkout branch-heads/$V8_VERSION

@paulirish
Copy link

paulirish commented Dec 12, 2017

Writing these up here as it's somewhat related:

How to find what V8 version a v8 commit landed in

  1. Grab the commit hash.
  2. Open https://github.com/v8/v8/commit/GIT_HASH_HERE
  3. At the end of the blue commit details box are the tags that include this commit. The last tag is this commit's debut.

For example v8/v8@8315422 first shipped in v8 6.2.53.

How to find what Chrome version a v8 commit landed in

A little more complicated this time...

  1. Open a chromium checkout
  2. cd into the v8 folder
  3. gclient sync --with_branch_heads
  4. gclient fetch
  5. tools/release/mergeinfo.py <v8_commit_hash>
  6. You'll see some output like:
2.) General information:
Is LKGR:         True
Is on Canary:    3169
First V8 branch: 6.2.100 (Might not be the rolled version)

The "First V8 branch" is simple enough; that's the V8 version this first made it into.

The "Is on Canary" value is the Chromium branch. Armed with this useful description of Chrome version numbers, you can do a quick google search. Given a branch of 3169, search for 3169 site:chromium.googlesource.com and you should be able to spot the actual milestone number. (62.0.3169.0, in this case.)

@hashseed
Copy link

For the V8 version you can also check the content of v8/include/v8-version.h.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment