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