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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 'shared-library': { parsers: [null, parseInt, parseInt], | 130 'shared-library': { parsers: [null, parseInt, parseInt], |
131 processor: this.processSharedLibrary }, | 131 processor: this.processSharedLibrary }, |
132 'code-creation': { | 132 'code-creation': { |
133 parsers: [null, this.createAddressParser('code'), parseInt, null], | 133 parsers: [null, this.createAddressParser('code'), parseInt, null], |
134 processor: this.processCodeCreation, backrefs: true }, | 134 processor: this.processCodeCreation, backrefs: true }, |
135 'code-move': { parsers: [this.createAddressParser('code'), | 135 'code-move': { parsers: [this.createAddressParser('code'), |
136 this.createAddressParser('code-move-to')], | 136 this.createAddressParser('code-move-to')], |
137 processor: this.processCodeMove, backrefs: true }, | 137 processor: this.processCodeMove, backrefs: true }, |
138 'code-delete': { parsers: [this.createAddressParser('code')], | 138 'code-delete': { parsers: [this.createAddressParser('code')], |
139 processor: this.processCodeDelete, backrefs: true }, | 139 processor: this.processCodeDelete, backrefs: true }, |
| 140 'function-creation': { parsers: [this.createAddressParser('code'), |
| 141 this.createAddressParser('function-obj')], |
| 142 processor: this.processFunctionCreation, backrefs: true }, |
| 143 'function-move': { parsers: [this.createAddressParser('code'), |
| 144 this.createAddressParser('code-move-to')], |
| 145 processor: this.processFunctionMove, backrefs: true }, |
| 146 'function-delete': { parsers: [this.createAddressParser('code')], |
| 147 processor: this.processFunctionDelete, backrefs: true }, |
140 'snapshot-pos': { parsers: [this.createAddressParser('code'), parseInt], | 148 'snapshot-pos': { parsers: [this.createAddressParser('code'), parseInt], |
141 processor: this.processSnapshotPosition, backrefs: true }, | 149 processor: this.processSnapshotPosition, backrefs: true }, |
142 'tick': { parsers: [this.createAddressParser('code'), | 150 'tick': { parsers: [this.createAddressParser('code'), |
143 this.createAddressParser('stack'), parseInt, 'var-args'], | 151 this.createAddressParser('stack'), |
| 152 this.createAddressParser('func'), parseInt, 'var-args'], |
144 processor: this.processTick, backrefs: true }, | 153 processor: this.processTick, backrefs: true }, |
145 'heap-sample-begin': { parsers: [null, null, parseInt], | 154 'heap-sample-begin': { parsers: [null, null, parseInt], |
146 processor: this.processHeapSampleBegin }, | 155 processor: this.processHeapSampleBegin }, |
147 'heap-sample-end': { parsers: [null, null], | 156 'heap-sample-end': { parsers: [null, null], |
148 processor: this.processHeapSampleEnd }, | 157 processor: this.processHeapSampleEnd }, |
149 'heap-js-prod-item': { parsers: [null, 'var-args'], | 158 'heap-js-prod-item': { parsers: [null, 'var-args'], |
150 processor: this.processJSProducer, backrefs: true }, | 159 processor: this.processJSProducer, backrefs: true }, |
151 // Ignored events. | 160 // Ignored events. |
152 'profiler': null, | 161 'profiler': null, |
153 'heap-sample-stats': null, | 162 'heap-sample-stats': null, |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 TickProcessor.prototype.processCodeMove = function(from, to) { | 289 TickProcessor.prototype.processCodeMove = function(from, to) { |
281 this.profile_.moveCode(from, to); | 290 this.profile_.moveCode(from, to); |
282 }; | 291 }; |
283 | 292 |
284 | 293 |
285 TickProcessor.prototype.processCodeDelete = function(start) { | 294 TickProcessor.prototype.processCodeDelete = function(start) { |
286 this.profile_.deleteCode(start); | 295 this.profile_.deleteCode(start); |
287 }; | 296 }; |
288 | 297 |
289 | 298 |
| 299 TickProcessor.prototype.processFunctionCreation = function( |
| 300 functionAddr, codeAddr) { |
| 301 this.profile_.addCodeAlias(functionAddr, codeAddr); |
| 302 }; |
| 303 |
| 304 |
| 305 TickProcessor.prototype.processFunctionMove = function(from, to) { |
| 306 this.profile_.safeMoveDynamicCode(from, to); |
| 307 }; |
| 308 |
| 309 |
| 310 TickProcessor.prototype.processFunctionDelete = function(start) { |
| 311 this.profile_.safeDeleteDynamicCode(start); |
| 312 }; |
| 313 |
| 314 |
290 TickProcessor.prototype.processSnapshotPosition = function(addr, pos) { | 315 TickProcessor.prototype.processSnapshotPosition = function(addr, pos) { |
291 if (this.snapshotLogProcessor_) { | 316 if (this.snapshotLogProcessor_) { |
292 this.deserializedEntriesNames_[addr] = | 317 this.deserializedEntriesNames_[addr] = |
293 this.snapshotLogProcessor_.getSerializedEntryName(pos); | 318 this.snapshotLogProcessor_.getSerializedEntryName(pos); |
294 } | 319 } |
295 }; | 320 }; |
296 | 321 |
297 | 322 |
298 TickProcessor.prototype.includeTick = function(vmState) { | 323 TickProcessor.prototype.includeTick = function(vmState) { |
299 return this.stateFilter_ == null || this.stateFilter_ == vmState; | 324 return this.stateFilter_ == null || this.stateFilter_ == vmState; |
300 }; | 325 }; |
301 | 326 |
302 | 327 |
303 TickProcessor.prototype.processTick = function(pc, sp, vmState, stack) { | 328 TickProcessor.prototype.processTick = function(pc, sp, func, vmState, stack) { |
304 this.ticks_.total++; | 329 this.ticks_.total++; |
305 if (vmState == TickProcessor.VmStates.GC) this.ticks_.gc++; | 330 if (vmState == TickProcessor.VmStates.GC) this.ticks_.gc++; |
306 if (!this.includeTick(vmState)) { | 331 if (!this.includeTick(vmState)) { |
307 this.ticks_.excluded++; | 332 this.ticks_.excluded++; |
308 return; | 333 return; |
309 } | 334 } |
310 | 335 |
311 this.profile_.recordTick(this.processStack(pc, stack)); | 336 if (func) { |
| 337 var funcEntry = this.profile_.findEntry(func); |
| 338 if (!funcEntry || !funcEntry.isJSFunction || !funcEntry.isJSFunction()) { |
| 339 func = 0; |
| 340 } else { |
| 341 var currEntry = this.profile_.findEntry(pc); |
| 342 if (!currEntry || !currEntry.isJSFunction || currEntry.isJSFunction()) { |
| 343 func = 0; |
| 344 } |
| 345 } |
| 346 } |
| 347 |
| 348 this.profile_.recordTick(this.processStack(pc, func, stack)); |
312 }; | 349 }; |
313 | 350 |
314 | 351 |
315 TickProcessor.prototype.processHeapSampleBegin = function(space, state, ticks) { | 352 TickProcessor.prototype.processHeapSampleBegin = function(space, state, ticks) { |
316 if (space != 'Heap') return; | 353 if (space != 'Heap') return; |
317 this.currentProducerProfile_ = new devtools.profiler.CallTree(); | 354 this.currentProducerProfile_ = new devtools.profiler.CallTree(); |
318 }; | 355 }; |
319 | 356 |
320 | 357 |
321 TickProcessor.prototype.processHeapSampleEnd = function(space, state) { | 358 TickProcessor.prototype.processHeapSampleEnd = function(space, state) { |
(...skipping 12 matching lines...) Expand all Loading... |
334 this.currentProducerProfile_ = null; | 371 this.currentProducerProfile_ = null; |
335 this.generation_++; | 372 this.generation_++; |
336 }; | 373 }; |
337 | 374 |
338 | 375 |
339 TickProcessor.prototype.processJSProducer = function(constructor, stack) { | 376 TickProcessor.prototype.processJSProducer = function(constructor, stack) { |
340 if (!this.currentProducerProfile_) return; | 377 if (!this.currentProducerProfile_) return; |
341 if (stack.length == 0) return; | 378 if (stack.length == 0) return; |
342 var first = stack.shift(); | 379 var first = stack.shift(); |
343 var processedStack = | 380 var processedStack = |
344 this.profile_.resolveAndFilterFuncs_(this.processStack(first, stack)); | 381 this.profile_.resolveAndFilterFuncs_(this.processStack(first, 0, stack)); |
345 processedStack.unshift(constructor); | 382 processedStack.unshift(constructor); |
346 this.currentProducerProfile_.addPath(processedStack); | 383 this.currentProducerProfile_.addPath(processedStack); |
347 }; | 384 }; |
348 | 385 |
349 | 386 |
350 TickProcessor.prototype.printStatistics = function() { | 387 TickProcessor.prototype.printStatistics = function() { |
351 print('Statistical profiling result from ' + this.lastLogFileName_ + | 388 print('Statistical profiling result from ' + this.lastLogFileName_ + |
352 ', (' + this.ticks_.total + | 389 ', (' + this.ticks_.total + |
353 ' ticks, ' + this.ticks_.unaccounted + ' unaccounted, ' + | 390 ' ticks, ' + this.ticks_.unaccounted + ' unaccounted, ' + |
354 this.ticks_.excluded + ' excluded).'); | 391 this.ticks_.excluded + ' excluded).'); |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
803 if (arg !== synArg && dispatch === this.argsDispatch_[synArg]) { | 840 if (arg !== synArg && dispatch === this.argsDispatch_[synArg]) { |
804 synonims.push(synArg); | 841 synonims.push(synArg); |
805 delete this.argsDispatch_[synArg]; | 842 delete this.argsDispatch_[synArg]; |
806 } | 843 } |
807 } | 844 } |
808 print(' ' + padRight(synonims.join(', '), 20) + dispatch[2]); | 845 print(' ' + padRight(synonims.join(', '), 20) + dispatch[2]); |
809 } | 846 } |
810 quit(2); | 847 quit(2); |
811 }; | 848 }; |
812 | 849 |
OLD | NEW |