2018-02-07 10:42:26 -05:00
|
|
|
'use strict';
|
|
|
|
|
2019-11-22 18:04:46 +01:00
|
|
|
const {
|
2020-10-29 19:43:42 +01:00
|
|
|
ArrayPrototypePush,
|
|
|
|
ArrayPrototypeSlice,
|
2019-11-22 18:04:46 +01:00
|
|
|
JSONStringify,
|
|
|
|
} = primordials;
|
2019-03-31 13:30:12 +02:00
|
|
|
|
2018-02-07 10:42:26 -05:00
|
|
|
const vm = require('vm');
|
|
|
|
|
2015-12-09 11:37:51 -08:00
|
|
|
const scriptFiles = [
|
2015-11-25 06:08:58 -08:00
|
|
|
'internal/v8_prof_polyfill',
|
2017-10-22 12:16:48 -07: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 09:23:16 -05:00
|
|
|
'internal/deps/v8/tools/arguments',
|
2017-10-22 12:16:48 -07:00
|
|
|
'internal/deps/v8/tools/tickprocessor',
|
|
|
|
'internal/deps/v8/tools/SourceMap',
|
2021-02-06 05:36:58 -08:00
|
|
|
'internal/deps/v8/tools/tickprocessor-driver',
|
2015-11-25 06:08:58 -08:00
|
|
|
];
|
2019-11-12 15:57:05 +01:00
|
|
|
let script = '';
|
2015-11-25 06:08:58 -08:00
|
|
|
|
2020-10-29 19:43:42 +01:00
|
|
|
for (const s of scriptFiles) {
|
2018-10-15 01:41:32 +02:00
|
|
|
script += internalBinding('natives')[s] + '\n';
|
2020-10-29 19:43:42 +01:00
|
|
|
}
|
2015-11-25 06:08:58 -08:00
|
|
|
|
2016-09-17 12:54:34 +02:00
|
|
|
const tickArguments = [];
|
2015-11-25 06:08:58 -08:00
|
|
|
if (process.platform === 'darwin') {
|
2020-10-29 19:43:42 +01:00
|
|
|
ArrayPrototypePush(tickArguments, '--mac');
|
2015-11-25 06:08:58 -08:00
|
|
|
} else if (process.platform === 'win32') {
|
2020-10-29 19:43:42 +01:00
|
|
|
ArrayPrototypePush(tickArguments, '--windows');
|
2015-11-25 06:08:58 -08:00
|
|
|
}
|
2020-10-29 19:43:42 +01:00
|
|
|
ArrayPrototypePush(tickArguments,
|
|
|
|
...ArrayPrototypeSlice(process.argv, 1));
|
2018-02-28 14:23:08 +00:00
|
|
|
script = `(function(module, require) {
|
2019-11-22 18:04:46 +01:00
|
|
|
arguments = ${JSONStringify(tickArguments)};
|
2017-08-21 19:01:06 +01:00
|
|
|
function write (s) { process.stdout.write(s) }
|
2018-03-11 10:33:42 -04:00
|
|
|
function printErr(err) { console.error(err); }
|
2016-01-24 09:32:14 -08:00
|
|
|
${script}
|
2018-02-07 10:42:26 -05:00
|
|
|
})`;
|
2018-02-28 14:23:08 +00:00
|
|
|
vm.runInThisContext(script)(module, require);
|