Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Unified Diff: tools/tickprocessor.js

Issue 6708056: Change the way sampler / profiler handle external callbacks. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/mjsunit/tools/tickprocessor-test-func-info.log ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/tickprocessor.js
diff --git a/tools/tickprocessor.js b/tools/tickprocessor.js
index f105a21c197143170b5284db08b22fd128878b39..7a05ef1e1f29bb021232084f783f6fd2f57f7681 100644
--- a/tools/tickprocessor.js
+++ b/tools/tickprocessor.js
@@ -161,7 +161,9 @@ function TickProcessor(
processor: this.processFunctionMove },
'snapshot-pos': { parsers: [parseInt, parseInt],
processor: this.processSnapshotPosition },
- 'tick': { parsers: [parseInt, parseInt, parseInt, parseInt, 'var-args'],
+ 'tick': {
+ parsers: [parseInt, parseInt, parseInt,
+ parseInt, parseInt, 'var-args'],
processor: this.processTick },
'heap-sample-begin': { parsers: [null, null, parseInt],
processor: this.processHeapSampleBegin },
@@ -344,22 +346,33 @@ TickProcessor.prototype.includeTick = function(vmState) {
};
-TickProcessor.prototype.processTick = function(pc, sp, tos, vmState, stack) {
+TickProcessor.prototype.processTick = function(pc,
+ sp,
+ is_external_callback,
+ tos_or_external_callback,
+ vmState,
+ stack) {
this.ticks_.total++;
if (vmState == TickProcessor.VmStates.GC) this.ticks_.gc++;
if (!this.includeTick(vmState)) {
this.ticks_.excluded++;
return;
}
-
- if (tos) {
- var funcEntry = this.profile_.findEntry(tos);
+ if (is_external_callback) {
+ // Don't use PC when in external callback code, as it can point
+ // inside callback's code, and we will erroneously report
+ // that a callback calls itself.
+ pc = 0;
+ } else if (tos_or_external_callback) {
+ // Find out, if top of stack was pointing inside a JS function
+ // meaning that we have encountered a frameless invocation.
+ var funcEntry = this.profile_.findEntry(tos_or_external_callback);
if (!funcEntry || !funcEntry.isJSFunction || !funcEntry.isJSFunction()) {
- tos = 0;
+ tos_or_external_callback = 0;
}
}
- this.profile_.recordTick(this.processStack(pc, tos, stack));
+ this.profile_.recordTick(this.processStack(pc, tos_or_external_callback, stack));
};
« no previous file with comments | « test/mjsunit/tools/tickprocessor-test-func-info.log ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698