From 955be8623d58566849cf6a59ff82e78cf14f239a Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Fri, 1 Mar 2019 21:31:40 +0100 Subject: src: use object to pass `Environment` to functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use a `v8::Object` with an internal field, rather than a `v8::External`. On a `GetReturnValue().Set(Environment::GetCurrent(args) == nullptr)` noop function, this benchmarks as a ~60 % speedup, as calls to `obj->GetAlignedPointerFromInternalField()` can be inlined and the field is stored with one level of indirection less. This also makes breaking up some pieces of the `Environment` class into per-native-binding data easier, if we want to pursue that path in the future. PR-URL: https://github.com/nodejs/node/pull/26382 Reviewed-By: James M Snell Reviewed-By: Ben Noordhuis --- src/node_env_var.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/node_env_var.cc') diff --git a/src/node_env_var.cc b/src/node_env_var.cc index d994a2199a..7e4913702b 100644 --- a/src/node_env_var.cc +++ b/src/node_env_var.cc @@ -212,7 +212,7 @@ static void EnvEnumerator(const PropertyCallbackInfo& info) { MaybeLocal CreateEnvVarProxy(Local context, Isolate* isolate, - Local data) { + Local data) { EscapableHandleScope scope(isolate); Local env_proxy_template = ObjectTemplate::New(isolate); env_proxy_template->SetHandler(NamedPropertyHandlerConfiguration( -- cgit v1.2.1