mirror of
https://github.com/nodejs/node.git
synced 2025-12-28 07:50:41 +00:00
Instead of polyfilling it with vm.SourceTextModule, use a built-in source text module loader so that we can also build the code cache for it at build tiem to embed the code cache for them in the binary. Drive-by: instead of inferring how to compile a particular built-in at run time, do the inferring at build time, so the function-based built-ins can be compiled using parameters quickly looked up from a static map, and the builtins that should be compiled as source text modules are known internally based on extension in the source code (at run time, the extensions are all removed). PR-URL: https://github.com/nodejs/node/pull/60518 Reviewed-By: Aditi Singh <aditisingh1400@gmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
37 lines
1.1 KiB
JavaScript
37 lines
1.1 KiB
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const tmpdir = require('../common/tmpdir');
|
|
const fs = require('fs');
|
|
const assert = require('assert');
|
|
const { spawnSyncAndAssert, spawnSyncAndExitWithoutError } = require('../common/child_process');
|
|
|
|
if (!common.enoughTestMem)
|
|
common.skip('skipped due to memory requirements');
|
|
if (common.isAIX)
|
|
common.skip('does not work on AIX');
|
|
|
|
tmpdir.refresh();
|
|
|
|
// Generate log file.
|
|
spawnSyncAndExitWithoutError(process.execPath, [ '--prof', '-p', '42' ], { cwd: tmpdir.path });
|
|
|
|
const files = fs.readdirSync(tmpdir.path);
|
|
const logfile = files.find((name) => /\.log$/.test(name));
|
|
assert(logfile);
|
|
|
|
// Make sure that the --preprocess argument is passed through correctly,
|
|
// as an example flag listed in deps/v8/tools/tickprocessor.js.
|
|
// Any of the other flags there should work for this test too, if --preprocess
|
|
// is ever removed.
|
|
spawnSyncAndAssert(
|
|
process.execPath,
|
|
[ '--prof-process', '--preprocess', logfile ],
|
|
{ cwd: tmpdir.path, encoding: 'utf8', maxBuffer: Infinity },
|
|
{
|
|
stdout(output) {
|
|
// Make sure that the result is valid JSON.
|
|
JSON.parse(output);
|
|
}
|
|
}
|
|
);
|