mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
0646eda4fc
Store all primordials as properties of the primordials object. Static functions are prefixed by the constructor's name and prototype methods are prefixed by the constructor's name followed by "Prototype". For example: primordials.Object.keys becomes primordials.ObjectKeys. PR-URL: https://github.com/nodejs/node/pull/30610 Refs: https://github.com/nodejs/node/issues/29766 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
43 lines
1.1 KiB
JavaScript
43 lines
1.1 KiB
JavaScript
'use strict';
|
|
|
|
const {
|
|
JSONStringify,
|
|
} = primordials;
|
|
|
|
const vm = require('vm');
|
|
|
|
const scriptFiles = [
|
|
'internal/v8_prof_polyfill',
|
|
'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',
|
|
'internal/deps/v8/tools/arguments',
|
|
'internal/deps/v8/tools/tickprocessor',
|
|
'internal/deps/v8/tools/SourceMap',
|
|
'internal/deps/v8/tools/tickprocessor-driver'
|
|
];
|
|
let script = '';
|
|
|
|
scriptFiles.forEach((s) => {
|
|
script += internalBinding('natives')[s] + '\n';
|
|
});
|
|
|
|
const tickArguments = [];
|
|
if (process.platform === 'darwin') {
|
|
tickArguments.push('--mac');
|
|
} else if (process.platform === 'win32') {
|
|
tickArguments.push('--windows');
|
|
}
|
|
tickArguments.push.apply(tickArguments, process.argv.slice(1));
|
|
script = `(function(module, require) {
|
|
arguments = ${JSONStringify(tickArguments)};
|
|
function write (s) { process.stdout.write(s) }
|
|
function printErr(err) { console.error(err); }
|
|
${script}
|
|
})`;
|
|
vm.runInThisContext(script)(module, require);
|