OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 } | 65 } |
66 | 66 |
67 | 67 |
68 function load_scripts(scripts) { | 68 function load_scripts(scripts) { |
69 time("Loading scripts", | 69 time("Loading scripts", |
70 function() { for (var i in scripts) importScripts(scripts[i]); }); | 70 function() { for (var i in scripts) importScripts(scripts[i]); }); |
71 self.postMessage({ "call" : "script" }); | 71 self.postMessage({ "call" : "script" }); |
72 } | 72 } |
73 | 73 |
74 | 74 |
| 75 function log_error(text) { |
| 76 self.postMessage({"call": "error", "args": text}); |
| 77 self.postMessage({"call": "reset"}); |
| 78 } |
| 79 |
| 80 |
75 function run(args) { | 81 function run(args) { |
76 var file = args["file"]; | 82 var file = args["file"]; |
77 var resx = args["resx"]; | 83 var resx = args["resx"]; |
78 var resy = args["resy"]; | 84 var resy = args["resy"]; |
79 var distortion = args["distortion"]; | 85 var distortion = args["distortion"]; |
80 var range_start_override = args["range_start"]; | 86 var range_start_override = args["range_start"]; |
81 var range_end_override = args["range_end"]; | 87 var range_end_override = args["range_end"]; |
82 | 88 |
83 var reader = new FileReaderSync(); | 89 var reader = new FileReaderSync(); |
84 var content_lines; | 90 var content_lines; |
(...skipping 29 matching lines...) Expand all Loading... |
114 for (var i = 0; i < content_lines.length; i++) { | 120 for (var i = 0; i < content_lines.length; i++) { |
115 tickProcessor.processLogLine(content_lines[i]); | 121 tickProcessor.processLogLine(content_lines[i]); |
116 } | 122 } |
117 tickProcessor.printStatistics(); | 123 tickProcessor.printStatistics(); |
118 displayprof(profile); | 124 displayprof(profile); |
119 }); | 125 }); |
120 | 126 |
121 var input_file_name = "input_temp"; | 127 var input_file_name = "input_temp"; |
122 var output_file_name = "output.svg"; | 128 var output_file_name = "output.svg"; |
123 | 129 |
124 var psc = new PlotScriptComposer(resx, resy); | 130 var psc = new PlotScriptComposer(resx, resy, log_error); |
125 var objects = 0; | 131 var objects = 0; |
126 | 132 |
127 time("Collecting events (" + content_lines.length + " entries)", | 133 time("Collecting events (" + content_lines.length + " entries)", |
128 function() { | 134 function() { |
129 var line_cursor = 0; | 135 var line_cursor = 0; |
130 var input = function() { return content_lines[line_cursor++]; }; | 136 var input = function() { return content_lines[line_cursor++]; }; |
131 psc.collectData(input, distortion); | 137 psc.collectData(input, distortion); |
132 psc.findPlotRange(range_start_override, | 138 psc.findPlotRange(range_start_override, |
133 range_end_override, | 139 range_end_override, |
134 setRange); | 140 setRange); |
(...skipping 23 matching lines...) Expand all Loading... |
158 | 164 |
159 var Module = { | 165 var Module = { |
160 "noInitialRun": true, | 166 "noInitialRun": true, |
161 print: function(text) { | 167 print: function(text) { |
162 self.postMessage({"call": "error", "args": text}); | 168 self.postMessage({"call": "error", "args": text}); |
163 }, | 169 }, |
164 printErr: function(text) { | 170 printErr: function(text) { |
165 self.postMessage({"call": "error", "args": text}); | 171 self.postMessage({"call": "error", "args": text}); |
166 }, | 172 }, |
167 }; | 173 }; |
OLD | NEW |