events: onceWrapper apply directly with arguments
Due to changes in V8 in 6.0 & 6.1, it's no longer necessary to copy arguments to avoid deopt. Just call .apply with arguments. Retains fast cases for 0-3 arguments. events/ee-once-4-args.js n=20000000 11.58 % *** 1.310379e-05 PR-URL: https://github.com/nodejs/node/pull/16212 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
This commit is contained in:
parent
d5fb78982a
commit
fe13e0077f
@ -328,10 +328,7 @@ function onceWrapper() {
|
||||
return this.listener.call(this.target, arguments[0], arguments[1],
|
||||
arguments[2]);
|
||||
default:
|
||||
const args = new Array(arguments.length);
|
||||
for (var i = 0; i < args.length; ++i)
|
||||
args[i] = arguments[i];
|
||||
this.listener.apply(this.target, args);
|
||||
this.listener.apply(this.target, arguments);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user