Porting brendangregg's FlameGraph perl scripts to JavaScript.