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 |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
163 'code-move': { parsers: [parseInt, parseInt], | 163 'code-move': { parsers: [parseInt, parseInt], |
164 processor: this.processCodeMove }, | 164 processor: this.processCodeMove }, |
165 'code-delete': { parsers: [parseInt], | 165 'code-delete': { parsers: [parseInt], |
166 processor: this.processCodeDelete }, | 166 processor: this.processCodeDelete }, |
167 'sfi-move': { parsers: [parseInt, parseInt], | 167 'sfi-move': { parsers: [parseInt, parseInt], |
168 processor: this.processFunctionMove }, | 168 processor: this.processFunctionMove }, |
169 'snapshot-pos': { parsers: [parseInt, parseInt], | 169 'snapshot-pos': { parsers: [parseInt, parseInt], |
170 processor: this.processSnapshotPosition }, | 170 processor: this.processSnapshotPosition }, |
171 'tick': { | 171 'tick': { |
172 parsers: [parseInt, parseInt, parseInt, parseInt, | 172 parsers: [parseInt, parseInt, parseInt, parseInt, |
173 parseInt, parseInt, 'var-args'], | 173 parseInt, 'var-args'], |
174 processor: this.processTick }, | 174 processor: this.processTick }, |
175 'heap-sample-begin': { parsers: [null, null, parseInt], | 175 'heap-sample-begin': { parsers: [null, null, parseInt], |
176 processor: this.processHeapSampleBegin }, | 176 processor: this.processHeapSampleBegin }, |
177 'heap-sample-end': { parsers: [null, null], | 177 'heap-sample-end': { parsers: [null, null], |
178 processor: this.processHeapSampleEnd }, | 178 processor: this.processHeapSampleEnd }, |
179 'timer-event-start' : { parsers: [null, null, null], | 179 'timer-event-start' : { parsers: [null, null, null], |
180 processor: this.advanceDistortion }, | 180 processor: this.advanceDistortion }, |
181 'timer-event-end' : { parsers: [null, null, null], | 181 'timer-event-end' : { parsers: [null, null, null], |
182 processor: this.advanceDistortion }, | 182 processor: this.advanceDistortion }, |
183 // Ignored events. | 183 // Ignored events. |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
361 }; | 361 }; |
362 | 362 |
363 | 363 |
364 TickProcessor.prototype.includeTick = function(vmState) { | 364 TickProcessor.prototype.includeTick = function(vmState) { |
365 return this.stateFilter_ == null || this.stateFilter_ == vmState; | 365 return this.stateFilter_ == null || this.stateFilter_ == vmState; |
366 }; | 366 }; |
367 | 367 |
368 TickProcessor.prototype.processTick = function(pc, | 368 TickProcessor.prototype.processTick = function(pc, |
369 sp, | 369 sp, |
370 ns_since_start, | 370 ns_since_start, |
371 is_external_callback, | 371 external_callback, |
372 tos_or_external_callback, | |
373 vmState, | 372 vmState, |
374 stack) { | 373 stack) { |
375 this.distortion += this.distortion_per_entry; | 374 this.distortion += this.distortion_per_entry; |
376 ns_since_start -= this.distortion; | 375 ns_since_start -= this.distortion; |
377 if (ns_since_start < this.range_start || ns_since_start > this.range_end) { | 376 if (ns_since_start < this.range_start || ns_since_start > this.range_end) { |
378 return; | 377 return; |
379 } | 378 } |
380 this.ticks_.total++; | 379 this.ticks_.total++; |
381 if (vmState == TickProcessor.VmStates.GC) this.ticks_.gc++; | 380 if (vmState == TickProcessor.VmStates.GC) this.ticks_.gc++; |
382 if (!this.includeTick(vmState)) { | 381 if (!this.includeTick(vmState)) { |
383 this.ticks_.excluded++; | 382 this.ticks_.excluded++; |
384 return; | 383 return; |
385 } | 384 } |
386 if (is_external_callback) { | 385 if (external_callback) { |
387 // Don't use PC when in external callback code, as it can point | 386 // Don't use PC when in external callback code, as it can point |
388 // inside callback's code, and we will erroneously report | 387 // inside callback's code, and we will erroneously report |
389 // that a callback calls itself. Instead we use tos_or_external_callback, | 388 // that a callback calls itself. Instead we use tos_or_external_callback, |
390 // as simply resetting PC will produce unaccounted ticks. | 389 // as simply resetting PC will produce unaccounted ticks. |
391 pc = tos_or_external_callback; | 390 pc = 0; |
392 tos_or_external_callback = 0; | 391 } |
393 } else if (tos_or_external_callback) { | |
394 // Find out, if top of stack was pointing inside a JS function | |
395 // meaning that we have encountered a frameless invocation. | |
396 var funcEntry = this.profile_.findEntry(tos_or_external_callback); | |
397 if (!funcEntry || !funcEntry.isJSFunction || !funcEntry.isJSFunction()) { | |
398 tos_or_external_callback = 0; | |
399 } | |
400 } | |
401 | 392 |
402 this.profile_.recordTick(this.processStack(pc, tos_or_external_callback, stack )); | 393 this.profile_.recordTick(this.processStack(pc, external_callback, stack)); |
loislo
2013/04/12 10:49:26
old version passed PC and 0 if we have external ca
yurys
2013/04/12 10:54:50
This is fine. It basically reverts this change: ht
| |
403 }; | 394 }; |
404 | 395 |
405 | 396 |
406 TickProcessor.prototype.advanceDistortion = function() { | 397 TickProcessor.prototype.advanceDistortion = function() { |
407 this.distortion += this.distortion_per_entry; | 398 this.distortion += this.distortion_per_entry; |
408 } | 399 } |
409 | 400 |
410 | 401 |
411 TickProcessor.prototype.processHeapSampleBegin = function(space, state, ticks) { | 402 TickProcessor.prototype.processHeapSampleBegin = function(space, state, ticks) { |
412 if (space != 'Heap') return; | 403 if (space != 'Heap') return; |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
905 if (arg !== synArg && dispatch === this.argsDispatch_[synArg]) { | 896 if (arg !== synArg && dispatch === this.argsDispatch_[synArg]) { |
906 synonims.push(synArg); | 897 synonims.push(synArg); |
907 delete this.argsDispatch_[synArg]; | 898 delete this.argsDispatch_[synArg]; |
908 } | 899 } |
909 } | 900 } |
910 print(' ' + padRight(synonims.join(', '), 20) + dispatch[2]); | 901 print(' ' + padRight(synonims.join(', '), 20) + dispatch[2]); |
911 } | 902 } |
912 quit(2); | 903 quit(2); |
913 }; | 904 }; |
914 | 905 |
OLD | NEW |