-
Notifications
You must be signed in to change notification settings - Fork 29.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tools: single, cross-platform tick processor
Currently there are three separate tick processor scripts for mac, windows, and linux. These have been replaced with a single node.js script to improve maintainability and remove the need to preserve parallel logic in these separate places. PR-URL: #2868 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
- Loading branch information
Showing
5 changed files
with
54 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
'use strict'; | ||
var cp = require('child_process'); | ||
var fs = require('fs'); | ||
var path = require('path'); | ||
|
||
var toolsPath = path.join(__dirname, '..', '..', 'deps', 'v8', 'tools'); | ||
var scriptFiles = [ | ||
path.join(__dirname, 'polyfill.js'), | ||
path.join(toolsPath, 'splaytree.js'), | ||
path.join(toolsPath, 'codemap.js'), | ||
path.join(toolsPath, 'csvparser.js'), | ||
path.join(toolsPath, 'consarray.js'), | ||
path.join(toolsPath, 'csvparser.js'), | ||
path.join(toolsPath, 'consarray.js'), | ||
path.join(toolsPath, 'profile.js'), | ||
path.join(toolsPath, 'profile_view.js'), | ||
path.join(toolsPath, 'logreader.js'), | ||
path.join(toolsPath, 'tickprocessor.js'), | ||
path.join(toolsPath, 'SourceMap.js'), | ||
path.join(toolsPath, 'tickprocessor-driver.js')]; | ||
var tempScript = path.join(__dirname, 'tick-processor-tmp-' + process.pid); | ||
|
||
process.on('exit', function() { | ||
try { fs.unlinkSync(tempScript); } catch (e) {} | ||
}); | ||
process.on('uncaughtException', function(err) { | ||
try { fs.unlinkSync(tempScript); } catch (e) {} | ||
throw err; | ||
}); | ||
|
||
var inStreams = scriptFiles.map(function(f) { | ||
return fs.createReadStream(f); | ||
}); | ||
var outStream = fs.createWriteStream(tempScript); | ||
inStreams.reduce(function(prev, curr, i) { | ||
prev.on('end', function() { | ||
curr.pipe(outStream, { end: i === inStreams.length - 1}); | ||
}); | ||
return curr; | ||
}); | ||
inStreams[0].pipe(outStream, { end: false }); | ||
outStream.on('close', function() { | ||
var tickArguments = [tempScript]; | ||
if (process.platform === 'darwin') { | ||
tickArguments.push('--mac', '--nm=' + path.join(toolsPath, 'mac-nm')); | ||
} else if (process.platform === 'win32') { | ||
tickArguments.push('--windows'); | ||
} | ||
tickArguments.push.apply(tickArguments, process.argv.slice(2)); | ||
var processTicks = cp.spawn(process.execPath, tickArguments, { stdio: 'inherit' }); | ||
}); |
This file was deleted.
Oops, something went wrong.