GeezerVison is showing github.com — doc,test: update v8 method doc and comment · nodejs/node@be79250
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: doc/api/v8.md +11-2Lines changed: 11 additions & 2 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -18,11 +18,20 @@ added: v8.0.0 |
18 | 18 |
|
19 | 19 | * Returns: {integer} |
20 | 20 |
|
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 |
23 | 23 | whether a [`vm.Script`][] `cachedData` buffer is compatible with this instance |
24 | 24 | of V8. |
25 | 25 |
|
| 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 | + |
26 | 35 | ## `v8.getHeapSpaceStatistics()` |
27 | 36 | <!-- YAML |
28 | 37 | added: v6.0.0 |
|
Collapse file
Copy file name to clipboardExpand all lines: test/parallel/test-v8-version-tag.js +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -7,9 +7,9 @@ const versionTag1 = v8.cachedDataVersionTag(); |
7 | 7 | assert.strictEqual(typeof versionTag1, 'number'); |
8 | 8 | assert.strictEqual(v8.cachedDataVersionTag(), versionTag1); |
9 | 9 |
|
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. |
13 | 13 | v8.setFlagsFromString('--allow_natives_syntax'); |
14 | 14 |
|
15 | 15 | const versionTag2 = v8.cachedDataVersionTag(); |
|