diff options
author | Andres Suarez <zertosh@gmail.com> | 2017-02-23 10:04:48 +0300 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2017-03-05 16:23:02 +0300 |
commit | 70beef97bdf21b52632492c3b54b067a331ea068 (patch) | |
tree | 402b730c74e04058375e25d7f49830dafe36d759 /src/node_v8.cc | |
parent | 94d1c8d1b0f85faba7c594631d1065eee957afda (diff) |
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 <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'src/node_v8.cc')
-rw-r--r-- | src/node_v8.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/node_v8.cc b/src/node_v8.cc index 70599226070..4dfb88a5396 100644 --- a/src/node_v8.cc +++ b/src/node_v8.cc @@ -13,10 +13,12 @@ using v8::Context; using v8::FunctionCallbackInfo; using v8::HeapSpaceStatistics; using v8::HeapStatistics; +using v8::Integer; using v8::Isolate; using v8::Local; using v8::NewStringType; using v8::Object; +using v8::ScriptCompiler; using v8::String; using v8::Uint32; using v8::V8; @@ -53,6 +55,15 @@ static const size_t kHeapSpaceStatisticsPropertiesCount = static size_t number_of_heap_spaces = 0; +void CachedDataVersionTag(const FunctionCallbackInfo<Value>& args) { + Environment* env = Environment::GetCurrent(args); + Local<Integer> result = + Integer::NewFromUnsigned(env->isolate(), + ScriptCompiler::CachedDataVersionTag()); + args.GetReturnValue().Set(result); +} + + void UpdateHeapStatisticsArrayBuffer(const FunctionCallbackInfo<Value>& args) { Environment* env = Environment::GetCurrent(args); HeapStatistics s; @@ -99,6 +110,8 @@ void InitializeV8Bindings(Local<Object> target, Local<Context> context) { Environment* env = Environment::GetCurrent(context); + env->SetMethod(target, "cachedDataVersionTag", CachedDataVersionTag); + env->SetMethod(target, "updateHeapStatisticsArrayBuffer", UpdateHeapStatisticsArrayBuffer); |