Skip to content

Commit 092c6c4

Browse files
Trotttargos
authored andcommitted
doc,test: update v8 method doc and comment
Update documentation and test comment for v8.cachedDataVersionTag(). PR-URL: #35795 Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
1 parent b07f4a3 commit 092c6c4

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

doc/api/v8.md

+11-2
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,20 @@ added: v8.0.0
1818

1919
* Returns: {integer}
2020

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

26+
```js
27+
console.log(v8.cachedDataVersionTag()); // 3947234607
28+
// The value returned by v8.cachedDataVersionTag() is derived from the V8
29+
// version, command-line flags, and detected CPU features. Test that the value
30+
// does indeed update when flags are toggled.
31+
v8.setFlagsFromString('--allow_natives_syntax');
32+
console.log(v8.cachedDataVersionTag()); // 183726201
33+
```
34+
2635
## `v8.getHeapSpaceStatistics()`
2736
<!-- YAML
2837
added: v6.0.0

test/parallel/test-v8-version-tag.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ const versionTag1 = v8.cachedDataVersionTag();
77
assert.strictEqual(typeof versionTag1, 'number');
88
assert.strictEqual(v8.cachedDataVersionTag(), versionTag1);
99

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

1515
const versionTag2 = v8.cachedDataVersionTag();

0 commit comments

Comments
 (0)