Two requested changes to tick processor.

1. If D8_PATH isn't specified, first try to locate 'd8' shell in path,
   and if not found, fallback to the one in tools_path/..
2. Add '--nm=<nm_exec>' parameter to specify 'nm' executable to use.

Review URL: http://codereview.chromium.org/132021


git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2225 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 5831cc70
#!/bin/sh #!/bin/sh
tools_path=`cd $(dirname "$0");pwd` tools_path=`cd $(dirname "$0");pwd`
if [ ! "$D8_PATH" ]; then
d8_public=`which d8`
if [ $d8_public ]; then D8_PATH=$(dirname "$d8_public"); fi
fi
[ "$D8_PATH" ] || D8_PATH=$tools_path/.. [ "$D8_PATH" ] || D8_PATH=$tools_path/..
d8_exec=$D8_PATH/d8 d8_exec=$D8_PATH/d8
if [ "$1" == "--no-build" ]; then
shift
else
# compile d8 if it doesn't exist, assuming this script # compile d8 if it doesn't exist, assuming this script
# resides in the repository. # resides in the repository.
[ -x $d8_exec ] || scons -j4 -C $D8_PATH -Y $tools_path/.. d8 [ -x $d8_exec ] || scons -j4 -C $D8_PATH -Y $tools_path/.. d8
fi
# nm spits out 'no symbols found' messages to stderr. # nm spits out 'no symbols found' messages to stderr.
$d8_exec $tools_path/splaytree.js $tools_path/codemap.js \ $d8_exec $tools_path/splaytree.js $tools_path/codemap.js \
......
...@@ -412,9 +412,10 @@ CppEntriesProvider.prototype.parseNextLine = function() { ...@@ -412,9 +412,10 @@ CppEntriesProvider.prototype.parseNextLine = function() {
}; };
function UnixCppEntriesProvider() { function UnixCppEntriesProvider(nmExec) {
this.symbols = []; this.symbols = [];
this.parsePos = 0; this.parsePos = 0;
this.nmExec = nmExec;
}; };
inherits(UnixCppEntriesProvider, CppEntriesProvider); inherits(UnixCppEntriesProvider, CppEntriesProvider);
...@@ -426,8 +427,8 @@ UnixCppEntriesProvider.prototype.loadSymbols = function(libName) { ...@@ -426,8 +427,8 @@ UnixCppEntriesProvider.prototype.loadSymbols = function(libName) {
this.parsePos = 0; this.parsePos = 0;
try { try {
this.symbols = [ this.symbols = [
os.system('nm', ['-C', '-n', libName], -1, -1), os.system(this.nmExec, ['-C', '-n', libName], -1, -1),
os.system('nm', ['-C', '-n', '-D', libName], -1, -1) os.system(this.nmExec, ['-C', '-n', '-D', libName], -1, -1)
]; ];
} catch (e) { } catch (e) {
// If the library cannot be found on this system let's not panic. // If the library cannot be found on this system let's not panic.
...@@ -525,7 +526,8 @@ function processArguments(args) { ...@@ -525,7 +526,8 @@ function processArguments(args) {
platform: 'unix', platform: 'unix',
stateFilter: null, stateFilter: null,
ignoreUnknown: false, ignoreUnknown: false,
separateIc: false separateIc: false,
nm: 'nm'
}; };
var argsDispatch = { var argsDispatch = {
'-j': ['stateFilter', TickProcessor.VmStates.JS, '-j': ['stateFilter', TickProcessor.VmStates.JS,
...@@ -545,7 +547,9 @@ function processArguments(args) { ...@@ -545,7 +547,9 @@ function processArguments(args) {
'--unix': ['platform', 'unix', '--unix': ['platform', 'unix',
'Specify that we are running on *nix platform'], 'Specify that we are running on *nix platform'],
'--windows': ['platform', 'windows', '--windows': ['platform', 'windows',
'Specify that we are running on Windows platform'] 'Specify that we are running on Windows platform'],
'--nm': ['nm', 'nm',
'Specify the \'nm\' executable to use (e.g. --nm=/my_dir/nm)']
}; };
argsDispatch['--js'] = argsDispatch['-j']; argsDispatch['--js'] = argsDispatch['-j'];
argsDispatch['--gc'] = argsDispatch['-g']; argsDispatch['--gc'] = argsDispatch['-g'];
...@@ -577,9 +581,15 @@ function processArguments(args) { ...@@ -577,9 +581,15 @@ function processArguments(args) {
break; break;
} }
args.shift(); args.shift();
var userValue = null;
var eqPos = arg.indexOf('=');
if (eqPos != -1) {
userValue = arg.substr(eqPos + 1);
arg = arg.substr(0, eqPos);
}
if (arg in argsDispatch) { if (arg in argsDispatch) {
var dispatch = argsDispatch[arg]; var dispatch = argsDispatch[arg];
result[dispatch[0]] = dispatch[1]; result[dispatch[0]] = userValue == null ? dispatch[1] : userValue;
} else { } else {
printUsageAndExit(); printUsageAndExit();
} }
...@@ -594,7 +604,7 @@ function processArguments(args) { ...@@ -594,7 +604,7 @@ function processArguments(args) {
var params = processArguments(arguments); var params = processArguments(arguments);
var tickProcessor = new TickProcessor( var tickProcessor = new TickProcessor(
params.platform == 'unix' ? new UnixCppEntriesProvider() : params.platform == 'unix' ? new UnixCppEntriesProvider(params.nm) :
new WindowsCppEntriesProvider(), new WindowsCppEntriesProvider(),
params.separateIc, params.separateIc,
params.ignoreUnknown, params.ignoreUnknown,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment