From 092c6c4f8fbad2dd0867ae6be6429b7073235cd5 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sun, 25 Oct 2020 05:55:34 -0700 Subject: [PATCH] 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 Reviewed-By: Luigi Pinca Reviewed-By: Gireesh Punathil --- doc/api/v8.md | 13 +++++++++++-- test/parallel/test-v8-version-tag.js | 6 +++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/doc/api/v8.md b/doc/api/v8.md index e0b2039264b63b..4f72b16e017913 100644 --- a/doc/api/v8.md +++ b/doc/api/v8.md @@ -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()`