2018-02-07 16:42:26 +01:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const vm = require('vm');
|
|
|
|
|
2015-12-09 20:37:51 +01:00
|
|
|
const scriptFiles = [
|
2015-11-25 15:08:58 +01:00
|
|
|
'internal/v8_prof_polyfill',
|
2017-10-22 21:16:48 +02:00
|
|
|
'internal/deps/v8/tools/splaytree',
|
|
|
|
'internal/deps/v8/tools/codemap',
|
|
|
|
'internal/deps/v8/tools/csvparser',
|
|
|
|
'internal/deps/v8/tools/consarray',
|
|
|
|
'internal/deps/v8/tools/profile',
|
|
|
|
'internal/deps/v8/tools/profile_view',
|
|
|
|
'internal/deps/v8/tools/logreader',
|
2018-01-30 15:23:16 +01:00
|
|
|
'internal/deps/v8/tools/arguments',
|
2017-10-22 21:16:48 +02:00
|
|
|
'internal/deps/v8/tools/tickprocessor',
|
|
|
|
'internal/deps/v8/tools/SourceMap',
|
|
|
|
'internal/deps/v8/tools/tickprocessor-driver'
|
2015-11-25 15:08:58 +01:00
|
|
|
];
|
2015-12-09 20:37:51 +01:00
|
|
|
var script = '';
|
2015-11-25 15:08:58 +01:00
|
|
|
|
2015-12-09 20:37:51 +01:00
|
|
|
scriptFiles.forEach(function(s) {
|
|
|
|
script += process.binding('natives')[s] + '\n';
|
2015-11-25 15:08:58 +01:00
|
|
|
});
|
|
|
|
|
2016-09-17 12:54:34 +02:00
|
|
|
const tickArguments = [];
|
2015-11-25 15:08:58 +01:00
|
|
|
if (process.platform === 'darwin') {
|
2016-09-10 15:05:30 +02:00
|
|
|
tickArguments.push('--mac');
|
2015-11-25 15:08:58 +01:00
|
|
|
} else if (process.platform === 'win32') {
|
|
|
|
tickArguments.push('--windows');
|
|
|
|
}
|
|
|
|
tickArguments.push.apply(tickArguments, process.argv.slice(1));
|
2018-02-28 15:23:08 +01:00
|
|
|
script = `(function(module, require) {
|
2016-01-24 18:32:14 +01:00
|
|
|
arguments = ${JSON.stringify(tickArguments)};
|
2017-08-21 20:01:06 +02:00
|
|
|
function write (s) { process.stdout.write(s) }
|
2018-03-11 15:33:42 +01:00
|
|
|
function printErr(err) { console.error(err); }
|
2016-01-24 18:32:14 +01:00
|
|
|
${script}
|
2018-02-07 16:42:26 +01:00
|
|
|
})`;
|
2018-02-28 15:23:08 +01:00
|
|
|
vm.runInThisContext(script)(module, require);
|