OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 |
11 // with the distribution. | 11 // with the distribution. |
12 // * Neither the name of Google Inc. nor the names of its | 12 // * Neither the name of Google Inc. nor the names of its |
13 // contributors may be used to endorse or promote products derived | 13 // contributors may be used to endorse or promote products derived |
14 // from this software without specific prior written permission. | 14 // from this software without specific prior written permission. |
15 // | 15 // |
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 // Node imports | |
29 if (typeof module !== 'undefined' && module.exports) { | |
30 Profile = require('./profile'); | |
31 LogReader = require('./logreader'); | |
32 ProfileView = require('./profile_view').ProfileView; | |
33 ViewBuilder = require('./profile_view').ViewBuilder; | |
34 } | |
35 | |
36 // Node polyfill | |
37 var os = os || { | |
38 system: function(name, args) { | |
39 return require('child_process').execSync(name + ' ' + args.join(' ')).toStri ng(); | |
Jakob Kummerow
2015/06/19 09:43:53
80-col
noordhuis
2015/06/19 10:43:07
I suggest using `execFileSync(name, args, { encodi
mattloring
2015/06/19 17:29:03
Done.
mattloring
2015/06/19 17:29:03
Done.
| |
40 } | |
41 }; | |
42 | |
43 var print = print || console.log.bind(console); | |
44 | |
45 var read = read || function(fileName) { | |
46 return require('fs').readFileSync(fileName, 'utf8'); | |
47 }; | |
48 | |
49 // End Node polyfill | |
28 | 50 |
29 function inherits(childCtor, parentCtor) { | 51 function inherits(childCtor, parentCtor) { |
30 childCtor.prototype.__proto__ = parentCtor.prototype; | 52 childCtor.prototype.__proto__ = parentCtor.prototype; |
31 }; | 53 }; |
32 | 54 |
33 | |
Jakob Kummerow
2015/06/19 09:43:53
keep this line
mattloring
2015/06/19 17:29:03
Done.
| |
34 function V8Profile(separateIc) { | 55 function V8Profile(separateIc) { |
35 Profile.call(this); | 56 Profile.call(this); |
36 if (!separateIc) { | 57 if (!separateIc) { |
37 this.skipThisFunction = function(name) { return V8Profile.IC_RE.test(name); }; | 58 this.skipThisFunction = function(name) { return V8Profile.IC_RE.test(name); }; |
38 } | 59 } |
39 }; | 60 }; |
40 inherits(V8Profile, Profile); | 61 inherits(V8Profile, Profile); |
41 | 62 |
42 | 63 |
43 V8Profile.IC_RE = | 64 V8Profile.IC_RE = |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
296 }; | 317 }; |
297 | 318 |
298 | 319 |
299 TickProcessor.prototype.isJsCode = function(name) { | 320 TickProcessor.prototype.isJsCode = function(name) { |
300 return name !== "UNKNOWN" && !(name in this.codeTypes_); | 321 return name !== "UNKNOWN" && !(name in this.codeTypes_); |
301 }; | 322 }; |
302 | 323 |
303 | 324 |
304 TickProcessor.prototype.processLogFile = function(fileName) { | 325 TickProcessor.prototype.processLogFile = function(fileName) { |
305 this.lastLogFileName_ = fileName; | 326 this.lastLogFileName_ = fileName; |
306 var line; | 327 var contents = readFile(fileName); |
307 while (line = readline()) { | 328 this.processLogChunk(contents); |
Jakob Kummerow
2015/06/19 09:43:53
Nope, this is not equivalent. processLogLine has e
mattloring
2015/06/19 17:29:03
Done.
| |
308 this.processLogLine(line); | |
309 } | |
310 }; | 329 }; |
311 | 330 |
312 | 331 |
313 TickProcessor.prototype.processLogFileInTest = function(fileName) { | 332 TickProcessor.prototype.processLogFileInTest = function(fileName) { |
314 // Hack file name to avoid dealing with platform specifics. | 333 // Hack file name to avoid dealing with platform specifics. |
315 this.lastLogFileName_ = 'v8.log'; | 334 this.lastLogFileName_ = 'v8.log'; |
316 var contents = readFile(fileName); | 335 var contents = readFile(fileName); |
317 this.processLogChunk(contents); | 336 this.processLogChunk(contents); |
318 }; | 337 }; |
319 | 338 |
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
961 for (var synArg in this.argsDispatch_) { | 980 for (var synArg in this.argsDispatch_) { |
962 if (arg !== synArg && dispatch === this.argsDispatch_[synArg]) { | 981 if (arg !== synArg && dispatch === this.argsDispatch_[synArg]) { |
963 synonyms.push(synArg); | 982 synonyms.push(synArg); |
964 delete this.argsDispatch_[synArg]; | 983 delete this.argsDispatch_[synArg]; |
965 } | 984 } |
966 } | 985 } |
967 print(' ' + padRight(synonyms.join(', '), 20) + " " + dispatch[2]); | 986 print(' ' + padRight(synonyms.join(', '), 20) + " " + dispatch[2]); |
968 } | 987 } |
969 quit(2); | 988 quit(2); |
970 }; | 989 }; |
990 | |
991 // Node exports | |
992 if (typeof module !== 'undefined' && module.exports) { | |
993 module.exports.UnixCppEntriesProvider = UnixCppEntriesProvider; | |
994 module.exports.WindowsCppEntriesProvider = WindowsCppEntriesProvider; | |
995 module.exports.MacCppEntriesProvider = MacCppEntriesProvider; | |
996 module.exports.ArgumentsProcessor = ArgumentsProcessor; | |
997 module.exports.TickProcessor = TickProcessor; | |
998 module.exports.SnapshotLogProcessor = SnapshotLogProcessor; | |
999 } | |
OLD | NEW |