Skip to content
This repository was archived by the owner on Aug 31, 2018. It is now read-only.

Commit 1ea6696

Browse files
targosaddaleax
authored andcommittedDec 7, 2017
build: add V8 embedder version string
After this commit, `process.versions.v8` will look like: "6.0.287.53-node.0". The goal is that everytime we apply a non-official patch to `deps/v8`, we increment our own number instead of V8's patch level. This number must be set back to 0 after major V8 updates. Fixes: nodejs/node#15698 PR-URL: nodejs/node#15785 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]> Reviewed-By: Ali Ijaz Sheikh <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
1 parent 6bca416 commit 1ea6696

File tree

5 files changed

+19
-8
lines changed

5 files changed

+19
-8
lines changed
 

‎common.gypi

+4
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525
# Default to -O0 for debug builds.
2626
'v8_optimized_debug%': 0,
2727

28+
# Reset this number to 0 on major V8 upgrades.
29+
# Increment by one for each non-official patch applied to deps/v8.
30+
'v8_embedder_string': '-node.0',
31+
2832
# Enable disassembler for `--print-code` v8 options
2933
'v8_enable_disassembler': 1,
3034

‎doc/api/process.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -1816,6 +1816,9 @@ changes:
18161816
- version: v4.2.0
18171817
pr-url: https://github.com/nodejs/node/pull/3102
18181818
description: The `icu` property is now supported.
1819+
- version: REPLACEME
1820+
pr-url: https://github.com/nodejs/node/pull/15785
1821+
description: The `v8` property now includes a Node.js specific suffix.
18191822
-->
18201823

18211824
* {Object}
@@ -1836,7 +1839,7 @@ Will generate an object similar to:
18361839
{
18371840
http_parser: '2.3.0',
18381841
node: '1.1.1',
1839-
v8: '4.1.0.14',
1842+
v8: '6.1.534.42-node.0',
18401843
uv: '1.3.0',
18411844
zlib: '1.2.8',
18421845
ares: '1.10.0-DEV',

‎doc/guides/maintaining-V8.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,8 @@ to be cherry-picked in the Node.js repository and V8-CI must test the change.
167167

168168
* For each abandoned V8 branch corresponding to an LTS branch that is affected by the bug:
169169
* Open a cherry-pick PR on nodejs/node targeting the appropriate *vY.x-staging* branch (e.g. *v6.x-staging* to fix an issue in V8-5.1).
170-
* Increase the patch level version in v8-version.h. This will not cause any problems with versioning because V8 will not publish other patches for this branch, so Node.js can effectively bump the patch version.
170+
* On Node.js < 9.0.0: Increase the patch level version in v8-version.h. This will not cause any problems with versioning because V8 will not publish other patches for this branch, so Node.js can effectively bump the patch version.
171+
* On Node.js >= 9.0.0: Increase the `v8_embedder_string` number in `common.gypi`.
171172
* In some cases the patch may require extra effort to merge in case V8 has changed substantially. For important issues we may be able to lean on the V8 team to get help with reimplementing the patch.
172173
* Run the Node.js [V8-CI](https://ci.nodejs.org/job/node-test-commit-v8-linux/) in addition to the [Node.js CI](https://ci.nodejs.org/job/node-test-pull-request/).
173174

@@ -265,6 +266,7 @@ above. A better strategy is to
265266

266267
1. Audit the current master branch and look at the patches that have been floated since the last major V8 update.
267268
1. Replace the copy of V8 in Node.js with a fresh checkout of the latest stable V8 branch. Special care must be taken to recursively update the DEPS that V8 has a compile time dependency on (at the moment of this writing, these are only trace_event and gtest_prod.h)
269+
1. Reset the `v8_embedder_string` variable to "-node.0" in `common.gypi`.
268270
1. Refloat (cherry-pick) all the patches from list computed in 1) as necessary. Some of the patches may no longer be necessary.
269271

270272
To audit for floating patches:

‎lib/internal/v8_prof_polyfill.js

+7-5
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,16 @@ function readline() {
8282
}
8383

8484
function versionCheck() {
85-
// v8-version looks like "v8-version,$major,$minor,$build,$patch,$candidate"
86-
// whereas process.versions.v8 is either "$major.$minor.$build" or
87-
// "$major.$minor.$build.$patch".
85+
// v8-version looks like
86+
// "v8-version,$major,$minor,$build,$patch[,$embedder],$candidate"
87+
// whereas process.versions.v8 is either "$major.$minor.$build-$embedder" or
88+
// "$major.$minor.$build.$patch-$embedder".
8889
var firstLine = readline();
8990
line = firstLine + '\n' + line;
9091
firstLine = firstLine.split(',');
91-
const curVer = process.versions.v8.split('.');
92-
if (firstLine.length !== 6 && firstLine[0] !== 'v8-version') {
92+
const curVer = process.versions.v8.split(/\.-/);
93+
if (firstLine.length !== 6 && firstLine.length !== 7 ||
94+
firstLine[0] !== 'v8-version') {
9395
console.log('Unable to read v8-version from log file.');
9496
return;
9597
}

‎test/parallel/test-process-versions.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ assert(commonTemplate.test(process.versions.node));
2929
assert(commonTemplate.test(process.versions.uv));
3030
assert(commonTemplate.test(process.versions.zlib));
3131

32-
assert(/^\d+\.\d+\.\d+(?:\.\d+)?(?: \(candidate\))?$/
32+
assert(/^\d+\.\d+\.\d+(?:\.\d+)?-node\.\d+(?: \(candidate\))?$/
3333
.test(process.versions.v8));
3434
assert(/^\d+$/.test(process.versions.modules));
3535

0 commit comments

Comments
 (0)
This repository has been archived.