From 70beef97bdf21b52632492c3b54b067a331ea068 Mon Sep 17 00:00:00 2001 From: Andres Suarez Date: Thu, 23 Feb 2017 02:04:48 -0500 Subject: [PATCH] v8: add cachedDataVersionTag Adds `v8.cachedDataVersionTag()`, which returns an integer representing the version tag for `cachedData` for the current V8 version & flags. PR-URL: https://github.com/nodejs/node/pull/11515 Reviewed-By: Anna Henningsen Reviewed-By: Ben Noordhuis --- doc/api/v8.md | 11 +++++++++++ lib/v8.js | 1 + src/node_v8.cc | 13 +++++++++++++ test/parallel/test-v8-version-tag.js | 19 +++++++++++++++++++ 4 files changed, 44 insertions(+) create mode 100644 test/parallel/test-v8-version-tag.js diff --git a/doc/api/v8.md b/doc/api/v8.md index be222bbabf6..173d0abeefc 100644 --- a/doc/api/v8.md +++ b/doc/api/v8.md @@ -9,6 +9,16 @@ const v8 = require('v8'); *Note*: The APIs and implementation are subject to change at any time. +## v8.cachedDataVersionTag() + + +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. + ## v8.getHeapSpaceStatistics()