mirror of
https://github.com/nodejs/node.git
synced 2025-04-30 15:41:06 +00:00

`/bin/sh -c` trick wasn't working for several reasons: * `/bin/sh -c "..."` expects the first argument after `"..."` to be a `$0`, not a `$1`. Previously `-n` wasn't passed to `nm` because of this, and many symbols were ordered improperly * `c++filt` was applied not only to the names of the functions but to their `nm` prefixes like `t` and `a` (`t xxx` turns into `unsigned char xxx`). Instead of applying `c++filt` wide and using `sh -c`, execute `nm` as requested by `deps/v8/tools/tickprocessor.js` and apply `c++filt` to all matching entries manually. Included test demonstrates where previous approach failed: all builtins were merged into `v8::internal::Builtins::~Builtins`, because they were prefixed by `t` in `nm` output. PR-URL: https://github.com/nodejs/node/pull/8480 Reviewed-By: Matthew Loring <mattloring@google.com>
33 lines
785 B
JavaScript
33 lines
785 B
JavaScript
/* eslint-disable strict */
|
|
const scriptFiles = [
|
|
'internal/v8_prof_polyfill',
|
|
'v8/tools/splaytree',
|
|
'v8/tools/codemap',
|
|
'v8/tools/csvparser',
|
|
'v8/tools/consarray',
|
|
'v8/tools/profile',
|
|
'v8/tools/profile_view',
|
|
'v8/tools/logreader',
|
|
'v8/tools/tickprocessor',
|
|
'v8/tools/SourceMap',
|
|
'v8/tools/tickprocessor-driver'
|
|
];
|
|
var script = '';
|
|
|
|
scriptFiles.forEach(function(s) {
|
|
script += process.binding('natives')[s] + '\n';
|
|
});
|
|
|
|
var 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() {
|
|
arguments = ${JSON.stringify(tickArguments)};
|
|
${script}
|
|
})()`;
|
|
eval(script);
|