summaryrefslogtreecommitdiff
path: root/src/node_process_object.cc
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2019-03-01 21:31:40 +0100
committerAnna Henningsen <anna@addaleax.net>2019-03-05 00:56:37 +0100
commit955be8623d58566849cf6a59ff82e78cf14f239a (patch)
treeff4ad2ccd691527045ef10eb57f5b5dc4c773dac /src/node_process_object.cc
parent1bdcfa7abe308bb7f79cd3679e9f345b58b37334 (diff)
downloadandroid-node-v8-955be8623d58566849cf6a59ff82e78cf14f239a.tar.gz
android-node-v8-955be8623d58566849cf6a59ff82e78cf14f239a.tar.bz2
android-node-v8-955be8623d58566849cf6a59ff82e78cf14f239a.zip
src: use object to pass `Environment` to functions
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 <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'src/node_process_object.cc')
-rw-r--r--src/node_process_object.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/node_process_object.cc b/src/node_process_object.cc
index 1b0aad3029..ece0eb76a5 100644
--- a/src/node_process_object.cc
+++ b/src/node_process_object.cc
@@ -92,7 +92,7 @@ MaybeLocal<Object> CreateProcessObject(
title_string,
ProcessTitleGetter,
env->owns_process_state() ? ProcessTitleSetter : nullptr,
- env->as_external(),
+ env->as_callback_data(),
DEFAULT,
None,
SideEffectType::kHasNoSideEffect)
@@ -152,7 +152,7 @@ MaybeLocal<Object> CreateProcessObject(
.ToLocalChecked()).FromJust();
Local<Object> env_var_proxy;
- if (!CreateEnvVarProxy(context, isolate, env->as_external())
+ if (!CreateEnvVarProxy(context, isolate, env->as_callback_data())
.ToLocal(&env_var_proxy))
return MaybeLocal<Object>();
@@ -310,7 +310,7 @@ MaybeLocal<Object> CreateProcessObject(
debug_port_string,
DebugPortGetter,
env->owns_process_state() ? DebugPortSetter : nullptr,
- env->as_external())
+ env->as_callback_data())
.FromJust());
// process._rawDebug: may be overwritten later in JS land, but should be