blob: 0b9a5139ba23cfe3a65497f4caba3f03203c6f0c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
// 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');
|