Skip to content

Commit

Permalink
build: add V8 embedder version string
Browse files Browse the repository at this point in the history
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.

Closes: #15698
  • Loading branch information
targos committed Oct 5, 2017
1 parent 613a871 commit 4c0a7d8
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
4 changes: 4 additions & 0 deletions common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
# Default to -O0 for debug builds.
'v8_optimized_debug%': 0,

# Reset this number to 0 on major V8 upgrades.
# Increment by one for each non-official patch applied to deps/v8.
'v8_embedder_string': '-node.0',

# Enable disassembler for `--print-code` v8 options
'v8_enable_disassembler': 1,

Expand Down
5 changes: 4 additions & 1 deletion doc/api/process.md
Original file line number Diff line number Diff line change
Expand Up @@ -1790,6 +1790,9 @@ changes:
- version: v4.2.0
pr-url: https://github.com/nodejs/node/pull/3102
description: The `icu` property is now supported.
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/15785
description: The `v8` property now includes a Node.js specific suffix.
-->

* {Object}
Expand All @@ -1810,7 +1813,7 @@ Will generate an object similar to:
{
http_parser: '2.3.0',
node: '1.1.1',
v8: '4.1.0.14',
v8: '6.1.534.42-node.0',
uv: '1.3.0',
zlib: '1.2.8',
ares: '1.10.0-DEV',
Expand Down
12 changes: 7 additions & 5 deletions lib/internal/v8_prof_polyfill.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,16 @@ function readline() {
}

function versionCheck() {
// v8-version looks like "v8-version,$major,$minor,$build,$patch,$candidate"
// whereas process.versions.v8 is either "$major.$minor.$build" or
// "$major.$minor.$build.$patch".
// v8-version looks like
// "v8-version,$major,$minor,$build,$patch[,$embedder],$candidate"
// whereas process.versions.v8 is either "$major.$minor.$build-$embedder" or
// "$major.$minor.$build.$patch-$embedder".
var firstLine = readline();
line = firstLine + '\n' + line;
firstLine = firstLine.split(',');
const curVer = process.versions.v8.split('.');
if (firstLine.length !== 6 && firstLine[0] !== 'v8-version') {
const curVer = process.versions.v8.split(/\.-/);
if (firstLine.length !== 6 && firstLine.length !== 7 ||
firstLine[0] !== 'v8-version') {
console.log('Unable to read v8-version from log file.');
return;
}
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-process-versions.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ assert(commonTemplate.test(process.versions.node));
assert(commonTemplate.test(process.versions.uv));
assert(commonTemplate.test(process.versions.zlib));

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

Expand Down

0 comments on commit 4c0a7d8

Please sign in to comment.