benchmark: avoid TurboFan deopt in arrays bench
Something unidentified at the moment is causing the arrays benchmarks to
deopt when run with the TurboFan compiler. Refactor the test to use an
inner function that can be correctly optimized by TurboFan and
Crankshaft.
I think this change also makes the benchmarks generally better. I will optimize the run
function instead of the whole main
that is run only once anyway.
Refs: https://github.com/nodejs/node/issues/11851#issuecomment-287106714
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
commit message follows commit guidelines
Affected core subsystem(s)
benchmark