diff --git a/benchmark/common.js b/benchmark/common.js index 495d6fdf365871..94f11a2be96933 100644 --- a/benchmark/common.js +++ b/benchmark/common.js @@ -208,11 +208,14 @@ Benchmark.prototype.report = function(rate, elapsed) { }); }; -exports.v8ForceOptimization = function(method, ...args) { +exports.v8ForceOptimization = function(method) { if (typeof method !== 'function') return; + const v8 = require('v8'); v8.setFlagsFromString('--allow_natives_syntax'); + + const args = Array.prototype.slice.call(arguments, 1); method.apply(null, args); eval('%OptimizeFunctionOnNextCall(method)'); method.apply(null, args);