Add initialization for has_external_callback field.

It looks like we initialize TickSample values twice in some
situations, but I will fix this in a separate change list.

R=sgjesse@chromium.org
BUG=1292
TEST=none

Review URL: http://codereview.chromium.org/6756031

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7434 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent d919609b
......@@ -70,6 +70,7 @@ TickSampleEventRecord* TickSampleEventRecord::init(void* value) {
// Init the required fields only.
result->sample.pc = NULL;
result->sample.frames_count = 0;
result->sample.has_external_callback = false;
return result;
}
......
......@@ -187,6 +187,7 @@ void ProfilerEventsProcessor::AddCurrentStack() {
sample->state = Isolate::Current()->current_vm_state();
sample->pc = reinterpret_cast<Address>(sample); // Not NULL.
sample->tos = NULL;
sample->has_external_callback = false;
sample->frames_count = 0;
for (StackTraceFrameIterator it;
!it.done() && sample->frames_count < TickSample::kMaxFramesCount;
......
......@@ -150,6 +150,7 @@ void StackTracer::Trace(Isolate* isolate, TickSample* sample) {
sample->tos = NULL;
sample->frames_count = 0;
sample->has_external_callback = false;
// Avoid collecting traces while doing GC.
if (sample->state == GC) return;
......
......@@ -596,7 +596,8 @@ class TickSample {
sp(NULL),
fp(NULL),
tos(NULL),
frames_count(0) {}
frames_count(0),
has_external_callback(false) {}
StateTag state; // The state of the VM.
Address pc; // Instruction pointer.
Address sp; // Stack pointer.
......
......@@ -345,7 +345,6 @@ TickProcessor.prototype.includeTick = function(vmState) {
return this.stateFilter_ == null || this.stateFilter_ == vmState;
};
TickProcessor.prototype.processTick = function(pc,
sp,
is_external_callback,
......@@ -361,8 +360,10 @@ TickProcessor.prototype.processTick = function(pc,
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;
// that a callback calls itself. Instead we use tos_or_external_callback,
// as simply resetting PC will produce unaccounted ticks.
pc = tos_or_external_callback;
tos_or_external_callback = 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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment