OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 | 53 |
54 | 54 |
55 function inherits(childCtor, parentCtor) { | 55 function inherits(childCtor, parentCtor) { |
56 childCtor.prototype.__proto__ = parentCtor.prototype; | 56 childCtor.prototype.__proto__ = parentCtor.prototype; |
57 }; | 57 }; |
58 | 58 |
59 | 59 |
60 function SnapshotLogProcessor() { | 60 function SnapshotLogProcessor() { |
61 devtools.profiler.LogReader.call(this, { | 61 devtools.profiler.LogReader.call(this, { |
62 'code-creation': { | 62 'code-creation': { |
63 parsers: [null, parseInt, parseInt, null], | 63 parsers: [null, this.createAddressParser('code'), parseInt, null], |
64 processor: this.processCodeCreation }, | 64 processor: this.processCodeCreation, backrefs: true }, |
65 'code-move': { parsers: [parseInt, parseInt], | 65 'code-move': { parsers: [this.createAddressParser('code'), |
66 processor: this.processCodeMove }, | 66 this.createAddressParser('code-move-to')], |
67 'code-delete': { parsers: [parseInt], | 67 processor: this.processCodeMove, backrefs: true }, |
68 processor: this.processCodeDelete }, | 68 'code-delete': { parsers: [this.createAddressParser('code')], |
| 69 processor: this.processCodeDelete, backrefs: true }, |
69 'function-creation': null, | 70 'function-creation': null, |
70 'function-move': null, | 71 'function-move': null, |
71 'function-delete': null, | 72 'function-delete': null, |
72 'snapshot-pos': { parsers: [parseInt, parseInt], | 73 'snapshot-pos': { parsers: [this.createAddressParser('code'), parseInt], |
73 processor: this.processSnapshotPosition }}); | 74 processor: this.processSnapshotPosition, backrefs: true }}); |
74 | 75 |
75 Profile.prototype.handleUnknownCode = function(operation, addr) { | 76 Profile.prototype.handleUnknownCode = function(operation, addr) { |
76 var op = devtools.profiler.Profile.Operation; | 77 var op = devtools.profiler.Profile.Operation; |
77 switch (operation) { | 78 switch (operation) { |
78 case op.MOVE: | 79 case op.MOVE: |
79 print('Snapshot: Code move event for unknown code: 0x' + | 80 print('Snapshot: Code move event for unknown code: 0x' + |
80 addr.toString(16)); | 81 addr.toString(16)); |
81 break; | 82 break; |
82 case op.DELETE: | 83 case op.DELETE: |
83 print('Snapshot: Code delete event for unknown code: 0x' + | 84 print('Snapshot: Code delete event for unknown code: 0x' + |
84 addr.toString(16)); | 85 addr.toString(16)); |
85 break; | 86 break; |
86 } | 87 } |
87 }; | 88 }; |
88 | 89 |
89 this.profile_ = new Profile(); | 90 this.profile_ = new Profile(); |
90 this.serializedEntries_ = []; | 91 this.serializedEntries_ = []; |
91 } | 92 } |
92 inherits(SnapshotLogProcessor, devtools.profiler.LogReader); | 93 inherits(SnapshotLogProcessor, devtools.profiler.LogReader); |
93 | 94 |
94 | 95 |
95 SnapshotLogProcessor.prototype.processCodeCreation = function( | 96 SnapshotLogProcessor.prototype.processCodeCreation = function( |
96 type, start, size, name) { | 97 type, start, size, name) { |
97 var entry = this.profile_.addCode(type, name, start, size); | 98 var entry = this.profile_.addCode( |
| 99 this.expandAlias(type), name, start, size); |
98 }; | 100 }; |
99 | 101 |
100 | 102 |
101 SnapshotLogProcessor.prototype.processCodeMove = function(from, to) { | 103 SnapshotLogProcessor.prototype.processCodeMove = function(from, to) { |
102 this.profile_.moveCode(from, to); | 104 this.profile_.moveCode(from, to); |
103 }; | 105 }; |
104 | 106 |
105 | 107 |
106 SnapshotLogProcessor.prototype.processCodeDelete = function(start) { | 108 SnapshotLogProcessor.prototype.processCodeDelete = function(start) { |
107 this.profile_.deleteCode(start); | 109 this.profile_.deleteCode(start); |
(...skipping 16 matching lines...) Expand all Loading... |
124 return entry ? entry.getRawName() : null; | 126 return entry ? entry.getRawName() : null; |
125 }; | 127 }; |
126 | 128 |
127 | 129 |
128 function TickProcessor( | 130 function TickProcessor( |
129 cppEntriesProvider, separateIc, ignoreUnknown, stateFilter, snapshotLogProce
ssor) { | 131 cppEntriesProvider, separateIc, ignoreUnknown, stateFilter, snapshotLogProce
ssor) { |
130 devtools.profiler.LogReader.call(this, { | 132 devtools.profiler.LogReader.call(this, { |
131 'shared-library': { parsers: [null, parseInt, parseInt], | 133 'shared-library': { parsers: [null, parseInt, parseInt], |
132 processor: this.processSharedLibrary }, | 134 processor: this.processSharedLibrary }, |
133 'code-creation': { | 135 'code-creation': { |
134 parsers: [null, parseInt, parseInt, null], | 136 parsers: [null, this.createAddressParser('code'), parseInt, null], |
135 processor: this.processCodeCreation }, | 137 processor: this.processCodeCreation, backrefs: true }, |
136 'code-move': { parsers: [parseInt, parseInt], | 138 'code-move': { parsers: [this.createAddressParser('code'), |
137 processor: this.processCodeMove }, | 139 this.createAddressParser('code-move-to')], |
138 'code-delete': { parsers: [parseInt], | 140 processor: this.processCodeMove, backrefs: true }, |
139 processor: this.processCodeDelete }, | 141 'code-delete': { parsers: [this.createAddressParser('code')], |
140 'function-creation': { parsers: [parseInt, parseInt], | 142 processor: this.processCodeDelete, backrefs: true }, |
141 processor: this.processFunctionCreation }, | 143 'function-creation': { parsers: [this.createAddressParser('code'), |
142 'function-move': { parsers: [parseInt, parseInt], | 144 this.createAddressParser('function-obj')], |
143 processor: this.processFunctionMove }, | 145 processor: this.processFunctionCreation, backrefs: true }, |
144 'function-delete': { parsers: [parseInt], | 146 'function-move': { parsers: [this.createAddressParser('code'), |
145 processor: this.processFunctionDelete }, | 147 this.createAddressParser('code-move-to')], |
146 'snapshot-pos': { parsers: [parseInt, parseInt], | 148 processor: this.processFunctionMove, backrefs: true }, |
147 processor: this.processSnapshotPosition }, | 149 'function-delete': { parsers: [this.createAddressParser('code')], |
148 'tick': { parsers: [parseInt, parseInt, parseInt, parseInt, 'var-args'], | 150 processor: this.processFunctionDelete, backrefs: true }, |
149 processor: this.processTick }, | 151 'snapshot-pos': { parsers: [this.createAddressParser('code'), parseInt], |
| 152 processor: this.processSnapshotPosition, backrefs: true }, |
| 153 'tick': { parsers: [this.createAddressParser('code'), |
| 154 this.createAddressParser('stack'), |
| 155 this.createAddressParser('func'), parseInt, 'var-args'], |
| 156 processor: this.processTick, backrefs: true }, |
150 'heap-sample-begin': { parsers: [null, null, parseInt], | 157 'heap-sample-begin': { parsers: [null, null, parseInt], |
151 processor: this.processHeapSampleBegin }, | 158 processor: this.processHeapSampleBegin }, |
152 'heap-sample-end': { parsers: [null, null], | 159 'heap-sample-end': { parsers: [null, null], |
153 processor: this.processHeapSampleEnd }, | 160 processor: this.processHeapSampleEnd }, |
154 'heap-js-prod-item': { parsers: [null, 'var-args'], | 161 'heap-js-prod-item': { parsers: [null, 'var-args'], |
155 processor: this.processJSProducer }, | 162 processor: this.processJSProducer, backrefs: true }, |
156 // Ignored events. | 163 // Ignored events. |
157 'profiler': null, | 164 'profiler': null, |
158 'heap-sample-stats': null, | 165 'heap-sample-stats': null, |
159 'heap-sample-item': null, | 166 'heap-sample-item': null, |
160 'heap-js-cons-item': null, | 167 'heap-js-cons-item': null, |
161 'heap-js-ret-item': null, | 168 'heap-js-ret-item': null, |
162 // Obsolete row types. | 169 // Obsolete row types. |
163 'code-allocate': null, | 170 'code-allocate': null, |
164 'begin-code-region': null, | 171 'begin-code-region': null, |
165 'end-code-region': null }); | 172 'end-code-region': null }); |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 name, startAddr, endAddr, function(fName, fStart, fEnd) { | 287 name, startAddr, endAddr, function(fName, fStart, fEnd) { |
281 self.profile_.addStaticCode(fName, fStart, fEnd); | 288 self.profile_.addStaticCode(fName, fStart, fEnd); |
282 self.setCodeType(fName, 'CPP'); | 289 self.setCodeType(fName, 'CPP'); |
283 }); | 290 }); |
284 }; | 291 }; |
285 | 292 |
286 | 293 |
287 TickProcessor.prototype.processCodeCreation = function( | 294 TickProcessor.prototype.processCodeCreation = function( |
288 type, start, size, name) { | 295 type, start, size, name) { |
289 name = this.deserializedEntriesNames_[start] || name; | 296 name = this.deserializedEntriesNames_[start] || name; |
290 var entry = this.profile_.addCode(type, name, start, size); | 297 var entry = this.profile_.addCode( |
| 298 this.expandAlias(type), name, start, size); |
291 }; | 299 }; |
292 | 300 |
293 | 301 |
294 TickProcessor.prototype.processCodeMove = function(from, to) { | 302 TickProcessor.prototype.processCodeMove = function(from, to) { |
295 this.profile_.moveCode(from, to); | 303 this.profile_.moveCode(from, to); |
296 }; | 304 }; |
297 | 305 |
298 | 306 |
299 TickProcessor.prototype.processCodeDelete = function(start) { | 307 TickProcessor.prototype.processCodeDelete = function(start) { |
300 this.profile_.deleteCode(start); | 308 this.profile_.deleteCode(start); |
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
845 if (arg !== synArg && dispatch === this.argsDispatch_[synArg]) { | 853 if (arg !== synArg && dispatch === this.argsDispatch_[synArg]) { |
846 synonims.push(synArg); | 854 synonims.push(synArg); |
847 delete this.argsDispatch_[synArg]; | 855 delete this.argsDispatch_[synArg]; |
848 } | 856 } |
849 } | 857 } |
850 print(' ' + padRight(synonims.join(', '), 20) + dispatch[2]); | 858 print(' ' + padRight(synonims.join(', '), 20) + dispatch[2]); |
851 } | 859 } |
852 quit(2); | 860 quit(2); |
853 }; | 861 }; |
854 | 862 |
OLD | NEW |