Skip to content

Commit fe13e00

Browse files
committed
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: #16212 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Refael Ackermann <[email protected]>
1 parent d5fb789 commit fe13e00

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

lib/events.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -328,10 +328,7 @@ function onceWrapper() {
328328
return this.listener.call(this.target, arguments[0], arguments[1],
329329
arguments[2]);
330330
default:
331-
const args = new Array(arguments.length);
332-
for (var i = 0; i < args.length; ++i)
333-
args[i] = arguments[i];
334-
this.listener.apply(this.target, args);
331+
this.listener.apply(this.target, arguments);
335332
}
336333
}
337334
}

0 commit comments

Comments
 (0)