doc,test: update v8 method doc and comment

Update documentation and test comment for v8.cachedDataVersionTag().

PR-URL: https://github.com/nodejs/node/pull/35795
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
This commit is contained in:
Rich Trott committed 2020-10-27 06:18:26 -07:00
1 parent 34810e0141
commit 245ec6f5ab
2 files changed
+14 -5

No files matched your search

+11 -2
View File
@@ -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
+3 -3
View File
@@ -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();