src: merge fn_name in NODE_SET_PROTOTYPE_METHOD

Merge two duplicate `fn_name` into one in NODE_SET_PROTOTYPE_METHOD,
it may improve a bit performance.

PR-URL: https://github.com/nodejs/node/pull/13547
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
XadillaX 2017-06-08 21:12:11 +08:00 committed by Refael Ackermann
parent 871e4d0280
commit b5d8d7c6f9

View File

@ -293,7 +293,7 @@ inline void NODE_SET_PROTOTYPE_METHOD(v8::Local<v8::FunctionTemplate> recv,
v8::FunctionTemplate::New(isolate, callback, v8::Local<v8::Value>(), s);
v8::Local<v8::String> fn_name = v8::String::NewFromUtf8(isolate, name);
t->SetClassName(fn_name);
recv->PrototypeTemplate()->Set(v8::String::NewFromUtf8(isolate, name), t);
recv->PrototypeTemplate()->Set(fn_name, t);
}
#define NODE_SET_PROTOTYPE_METHOD node::NODE_SET_PROTOTYPE_METHOD