Bug 1479672 - Write callgraph.txt via JS shell redirection instead of bash redirection, r=jonco
authorSteve Fink <sfink@mozilla.com>
Tue, 26 Sep 2017 21:02:32 -0700
changeset 500002 d67c4217db0bb9d96cb36f8eca1ca5cc755837ab
parent 500001 57b0208b6a7809a487584f128eced32eb99c16d4
child 500003 5dc260a940fb4c7e4804ae08de3fa853d8b46c2b
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjonco
bugs1479672
milestone64.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1479672 - Write callgraph.txt via JS shell redirection instead of bash redirection, r=jonco
js/src/devtools/rootAnalysis/analyze.py
js/src/devtools/rootAnalysis/computeCallgraph.js
--- a/js/src/devtools/rootAnalysis/analyze.py
+++ b/js/src/devtools/rootAnalysis/analyze.py
@@ -128,18 +128,19 @@ JOBS = {'dbs':
           '.'),
          ()),
 
         'list-dbs':
         (('ls', '-l'),
          ()),
 
         'callgraph':
-        (('%(js)s', '%(analysis_scriptdir)s/computeCallgraph.js', '%(typeInfo)s'),
-         'callgraph.txt'),
+        (('%(js)s', '%(analysis_scriptdir)s/computeCallgraph.js', '%(typeInfo)s',
+          '[callgraph]'),
+         ('callgraph.txt',)),
 
         'gcFunctions':
         (('%(js)s', '%(analysis_scriptdir)s/computeGCFunctions.js', '%(callgraph)s',
           '[gcFunctions]', '[gcFunctions_list]', '[gcEdges]', '[suppressedFunctions_list]'),
          ('gcFunctions.txt', 'gcFunctions.lst', 'gcEdges.txt', 'suppressedFunctions.lst')),
 
         'gcTypes':
         (('%(js)s', '%(analysis_scriptdir)s/computeGCTypes.js',
--- a/js/src/devtools/rootAnalysis/computeCallgraph.js
+++ b/js/src/devtools/rootAnalysis/computeCallgraph.js
@@ -6,16 +6,19 @@ loadRelativeToScript('callgraph.js');
 
 var theFunctionNameToFind;
 if (scriptArgs[0] == '--function') {
     theFunctionNameToFind = scriptArgs[1];
     scriptArgs = scriptArgs.slice(2);
 }
 
 var typeInfo_filename = scriptArgs[0] || "typeInfo.txt";
+var callgraphOut_filename = scriptArgs[1] || "callgraph.txt";
+
+var origOut = os.file.redirect(callgraphOut_filename);
 
 var memoized = new Map();
 var memoizedCount = 0;
 
 function memo(name)
 {
     if (!memoized.has(name)) {
         let id = memoized.size + 1;
@@ -265,8 +268,10 @@ function process(functionName, functionB
 
 for (var nameIndex = minStream; nameIndex <= maxStream; nameIndex++) {
     var name = xdb.read_key(nameIndex);
     var data = xdb.read_entry(name);
     process(name.readString(), JSON.parse(data.readString()));
     xdb.free_string(name);
     xdb.free_string(data);
 }
+
+os.file.close(os.file.redirect(origOut));