Skip to content

Commit

Permalink
doc,test: update v8 method doc and comment
Browse files Browse the repository at this point in the history
Update documentation and test comment for v8.cachedDataVersionTag().

PR-URL: #35795
Reviewed-By: Daijiro Wachi <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
  • Loading branch information
Trott authored and targos committed Nov 3, 2020
1 parent b07f4a3 commit 092c6c4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
13 changes: 11 additions & 2 deletions doc/api/v8.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,20 @@ added: v8.0.0

* Returns: {integer}

Returns an integer representing a "version tag" derived from the V8 version,
command-line flags and detected CPU features. This is useful for determining
Returns an integer representing a version tag derived from the V8 version,
command-line flags, and detected CPU features. This is useful for determining
whether a [`vm.Script`][] `cachedData` buffer is compatible with this instance
of V8.

```js
console.log(v8.cachedDataVersionTag()); // 3947234607
// The value returned by v8.cachedDataVersionTag() is derived from the V8
// version, command-line flags, and detected CPU features. Test that the value
// does indeed update when flags are toggled.
v8.setFlagsFromString('--allow_natives_syntax');
console.log(v8.cachedDataVersionTag()); // 183726201
```

## `v8.getHeapSpaceStatistics()`
<!-- YAML
added: v6.0.0
Expand Down
6 changes: 3 additions & 3 deletions test/parallel/test-v8-version-tag.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ const versionTag1 = v8.cachedDataVersionTag();
assert.strictEqual(typeof versionTag1, 'number');
assert.strictEqual(v8.cachedDataVersionTag(), versionTag1);

// The value of cachedDataVersionTag is derived from the command line flags and
// detected CPU features. Test that the value does indeed update when flags
// are toggled.
// The value returned by v8.cachedDataVersionTag() is derived from the V8
// version, command-line flags, and detected CPU features. Test that the value
// does indeed update when flags are toggled.
v8.setFlagsFromString('--allow_natives_syntax');

const versionTag2 = v8.cachedDataVersionTag();
Expand Down

0 comments on commit 092c6c4

Please sign in to comment.