util: avoid out-of-bounds arguments index access
This updates util.inspect() to avoid accessing out-of-range indices of the arguments
object, which is known to cause optimization bailout.
Based on an average of 10 runs of the benchmark in benchmark/util/inspect.js
, this change improves the performance of util.inspect
by about 10%.
Relates to https://github.com/nodejs/node/issues/10323
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
commit message follows commit guidelines
Affected core subsystem(s)
util