0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-30 15:30:56 +01:00
nodejs/benchmark/misc/v8-bench.js
Rich Trott 1bedeeb41d benchmark: fix lint errors
PR-URL: https://github.com/nodejs/node/pull/5517
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-03-03 09:53:22 -08:00

24 lines
713 B
JavaScript

// compare with "google-chrome deps/v8/benchmarks/run.html"
'use strict';
var fs = require('fs');
var path = require('path');
var vm = require('vm');
var dir = path.join(__dirname, '..', '..', 'deps', 'v8', 'benchmarks');
global.print = function(s) {
if (s === '----') return;
console.log('misc/v8_bench.js %s', s);
};
global.load = function(filename) {
var source = fs.readFileSync(path.join(dir, filename), 'utf8');
// deps/v8/benchmarks/regexp.js breaks console.log() because it clobbers
// the RegExp global, Restore the original when the script is done.
var $RegExp = global.RegExp;
vm.runInThisContext(source, { filename: filename });
global.RegExp = $RegExp;
};
global.load('run.js');