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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « test/mjsunit/tools/tickprocessor-test-func-info.log ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 parsers: [null, parseInt, parseInt, null, 'var-args'], 154 parsers: [null, parseInt, parseInt, null, 'var-args'],
155 processor: this.processCodeCreation }, 155 processor: this.processCodeCreation },
156 'code-move': { parsers: [parseInt, parseInt], 156 'code-move': { parsers: [parseInt, parseInt],
157 processor: this.processCodeMove }, 157 processor: this.processCodeMove },
158 'code-delete': { parsers: [parseInt], 158 'code-delete': { parsers: [parseInt],
159 processor: this.processCodeDelete }, 159 processor: this.processCodeDelete },
160 'sfi-move': { parsers: [parseInt, parseInt], 160 'sfi-move': { parsers: [parseInt, parseInt],
161 processor: this.processFunctionMove }, 161 processor: this.processFunctionMove },
162 'snapshot-pos': { parsers: [parseInt, parseInt], 162 'snapshot-pos': { parsers: [parseInt, parseInt],
163 processor: this.processSnapshotPosition }, 163 processor: this.processSnapshotPosition },
164 'tick': { parsers: [parseInt, parseInt, parseInt, parseInt, 'var-args'], 164 'tick': {
165 parsers: [parseInt, parseInt, parseInt,
166 parseInt, parseInt, 'var-args'],
165 processor: this.processTick }, 167 processor: this.processTick },
166 'heap-sample-begin': { parsers: [null, null, parseInt], 168 'heap-sample-begin': { parsers: [null, null, parseInt],
167 processor: this.processHeapSampleBegin }, 169 processor: this.processHeapSampleBegin },
168 'heap-sample-end': { parsers: [null, null], 170 'heap-sample-end': { parsers: [null, null],
169 processor: this.processHeapSampleEnd }, 171 processor: this.processHeapSampleEnd },
170 'heap-js-prod-item': { parsers: [null, 'var-args'], 172 'heap-js-prod-item': { parsers: [null, 'var-args'],
171 processor: this.processJSProducer }, 173 processor: this.processJSProducer },
172 // Ignored events. 174 // Ignored events.
173 'profiler': null, 175 'profiler': null,
174 'function-creation': null, 176 'function-creation': null,
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 this.snapshotLogProcessor_.getSerializedEntryName(pos); 339 this.snapshotLogProcessor_.getSerializedEntryName(pos);
338 } 340 }
339 }; 341 };
340 342
341 343
342 TickProcessor.prototype.includeTick = function(vmState) { 344 TickProcessor.prototype.includeTick = function(vmState) {
343 return this.stateFilter_ == null || this.stateFilter_ == vmState; 345 return this.stateFilter_ == null || this.stateFilter_ == vmState;
344 }; 346 };
345 347
346 348
347 TickProcessor.prototype.processTick = function(pc, sp, tos, vmState, stack) { 349 TickProcessor.prototype.processTick = function(pc,
350 sp,
351 is_external_callback,
352 tos_or_external_callback,
353 vmState,
354 stack) {
348 this.ticks_.total++; 355 this.ticks_.total++;
349 if (vmState == TickProcessor.VmStates.GC) this.ticks_.gc++; 356 if (vmState == TickProcessor.VmStates.GC) this.ticks_.gc++;
350 if (!this.includeTick(vmState)) { 357 if (!this.includeTick(vmState)) {
351 this.ticks_.excluded++; 358 this.ticks_.excluded++;
352 return; 359 return;
353 } 360 }
354 361 if (is_external_callback) {
355 if (tos) { 362 // Don't use PC when in external callback code, as it can point
356 var funcEntry = this.profile_.findEntry(tos); 363 // inside callback's code, and we will erroneously report
364 // that a callback calls itself.
365 pc = 0;
366 } else if (tos_or_external_callback) {
367 // Find out, if top of stack was pointing inside a JS function
368 // meaning that we have encountered a frameless invocation.
369 var funcEntry = this.profile_.findEntry(tos_or_external_callback);
357 if (!funcEntry || !funcEntry.isJSFunction || !funcEntry.isJSFunction()) { 370 if (!funcEntry || !funcEntry.isJSFunction || !funcEntry.isJSFunction()) {
358 tos = 0; 371 tos_or_external_callback = 0;
359 } 372 }
360 } 373 }
361 374
362 this.profile_.recordTick(this.processStack(pc, tos, stack)); 375 this.profile_.recordTick(this.processStack(pc, tos_or_external_callback, stack ));
363 }; 376 };
364 377
365 378
366 TickProcessor.prototype.processHeapSampleBegin = function(space, state, ticks) { 379 TickProcessor.prototype.processHeapSampleBegin = function(space, state, ticks) {
367 if (space != 'Heap') return; 380 if (space != 'Heap') return;
368 this.currentProducerProfile_ = new CallTree(); 381 this.currentProducerProfile_ = new CallTree();
369 }; 382 };
370 383
371 384
372 TickProcessor.prototype.processHeapSampleEnd = function(space, state) { 385 TickProcessor.prototype.processHeapSampleEnd = function(space, state) {
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
854 if (arg !== synArg && dispatch === this.argsDispatch_[synArg]) { 867 if (arg !== synArg && dispatch === this.argsDispatch_[synArg]) {
855 synonims.push(synArg); 868 synonims.push(synArg);
856 delete this.argsDispatch_[synArg]; 869 delete this.argsDispatch_[synArg];
857 } 870 }
858 } 871 }
859 print(' ' + padRight(synonims.join(', '), 20) + dispatch[2]); 872 print(' ' + padRight(synonims.join(', '), 20) + dispatch[2]);
860 } 873 }
861 quit(2); 874 quit(2);
862 }; 875 };
863 876
OLDNEW
« 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