events: avoid emit() eager deopt
This commit makes sure EventEmitter.emit() doesn't get deoptimized by V8.
The deopt happens when accessing out of bound indexes of the arguments
object.
This issue has been raised here: https://github.com/nodejs/node/issues/10323 and this specific case might become a more serious performance issue in upcoming V8 releases.
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included
-
commit message follows commit guidelines
Affected core subsystem(s)
- events
- @nodejs/v8