Unverified Commit 955be862 authored by Anna Henningsen's avatar Anna Henningsen
Browse files

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: default avatarJames M Snell <jasnell@gmail.com>
Reviewed-By: default avatarBen Noordhuis <info@bnoordhuis.nl>
parent 1bdcfa7a
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment