OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 21 matching lines...) Expand all Loading... |
32 case "": return Profile.CodeState.COMPILED; | 32 case "": return Profile.CodeState.COMPILED; |
33 case "~": return Profile.CodeState.OPTIMIZABLE; | 33 case "~": return Profile.CodeState.OPTIMIZABLE; |
34 case "*": return Profile.CodeState.OPTIMIZED; | 34 case "*": return Profile.CodeState.OPTIMIZED; |
35 } | 35 } |
36 throw new Error("unknown code state: " + s); | 36 throw new Error("unknown code state: " + s); |
37 } | 37 } |
38 | 38 |
39 function LogProcessor() { | 39 function LogProcessor() { |
40 LogReader.call(this, { | 40 LogReader.call(this, { |
41 'code-creation': { | 41 'code-creation': { |
42 parsers: [null, parseInt, parseInt, null, 'var-args'], | 42 parsers: [null, parseInt, parseInt, parseInt, null, 'var-args'], |
43 processor: this.processCodeCreation }, | 43 processor: this.processCodeCreation }, |
44 'code-move': { parsers: [parseInt, parseInt], | 44 'code-move': { parsers: [parseInt, parseInt], |
45 processor: this.processCodeMove }, | 45 processor: this.processCodeMove }, |
46 'code-delete': null, | 46 'code-delete': null, |
47 'sfi-move': { parsers: [parseInt, parseInt], | 47 'sfi-move': { parsers: [parseInt, parseInt], |
48 processor: this.processFunctionMove }, | 48 processor: this.processFunctionMove }, |
49 'shared-library': null, | 49 'shared-library': null, |
50 'profiler': null, | 50 'profiler': null, |
51 'tick': null }); | 51 'tick': null }); |
52 this.profile = new Profile(); | 52 this.profile = new Profile(); |
53 | 53 |
54 } | 54 } |
55 LogProcessor.prototype.__proto__ = LogReader.prototype; | 55 LogProcessor.prototype.__proto__ = LogReader.prototype; |
56 | 56 |
57 LogProcessor.prototype.processCodeCreation = function( | 57 LogProcessor.prototype.processCodeCreation = function( |
58 type, start, size, name, maybe_func) { | 58 type, kind, start, size, name, maybe_func) { |
59 if (type != "LazyCompile" && type != "Script" && type != "Function") return; | 59 if (type != "LazyCompile" && type != "Script" && type != "Function") return; |
| 60 // Scripts will compile into anonymous functions starting at 1:1. Adjust the |
| 61 // name here so that it matches corrsponding function's name during the heap |
| 62 // traversal. |
| 63 if (type == "Script") name = " :1:1"; |
60 // Discard types to avoid discrepancies in "LazyCompile" vs. "Function". | 64 // Discard types to avoid discrepancies in "LazyCompile" vs. "Function". |
61 type = ""; | 65 type = ""; |
62 if (maybe_func.length) { | 66 if (maybe_func.length) { |
63 var funcAddr = parseInt(maybe_func[0]); | 67 var funcAddr = parseInt(maybe_func[0]); |
64 var state = parseState(maybe_func[1]); | 68 var state = parseState(maybe_func[1]); |
65 this.profile.addFuncCode(type, name, start, size, funcAddr, state); | 69 this.profile.addFuncCode(type, name, start, size, funcAddr, state); |
66 } else { | 70 } else { |
67 this.profile.addCode(type, name, start, size); | 71 this.profile.addCode(type, name, start, size); |
68 } | 72 } |
69 }; | 73 }; |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 out.push((c[0] ? " " : "* ") + | 180 out.push((c[0] ? " " : "* ") + |
177 c[1].toString(16) + " " + | 181 c[1].toString(16) + " " + |
178 (c[2] ? c[2] : "---") + " " + | 182 (c[2] ? c[2] : "---") + " " + |
179 (c[3] ? c[3] : "---")); | 183 (c[3] ? c[3] : "---")); |
180 } | 184 } |
181 } | 185 } |
182 result[0] ? true : out.join("\n"); | 186 result[0] ? true : out.join("\n"); |
183 } else { | 187 } else { |
184 result; | 188 result; |
185 } | 189 } |
OLD | NEW |