Commit bd83c396 authored by Trevor Norris's avatar Trevor Norris Committed by Bert Belder
Browse files

async-wrap: explicitly pass parent

When instantiating a new AsyncWrap allow the parent AsyncWrap to be
passed. This is useful for cases like TCP incoming connections, so the
connection can be tied to the server receiving the connection.

Because the current architecture instantiates the *Wrap inside a
v8::FunctionCallback, the parent pointer is currently wrapped inside a
new v8::External every time and passed as an argument. This adds ~80ns
to instantiation time.

A future optimization would be to add the v8::External as the data field
when creating the v8::FunctionTemplate, change the pointer just before
making the call then NULL'ing it out afterwards. This adds enough code
complexity that it will not be attempted until the current approach
demonstrates it is a bottle neck.

PR-URL: https://github.com/joyent/node/pull/8110


Signed-off-by: default avatarTrevor Norris <trev.norris@gmail.com>
Reviewed-by: default avatarFedor Indutny <fedor@indutny.com>
Reviewed-by: default avatarAlexis Campailla <alexis@janeasystems.com>
Reviewed-by: default avatarJulien Gilli <julien.gilli@joyent.com>
parent afe27e34
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