Revision: 7434
Author:   [email protected]
Date:     Wed Mar 30 06:30:52 2011
Log:      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.

[email protected]
BUG=1292
TEST=none

Review URL: http://codereview.chromium.org/6756031
http://code.google.com/p/v8/source/detail?r=7434

Modified:
 /branches/bleeding_edge/src/cpu-profiler-inl.h
 /branches/bleeding_edge/src/cpu-profiler.cc
 /branches/bleeding_edge/src/log.cc
 /branches/bleeding_edge/src/platform.h
 /branches/bleeding_edge/tools/tickprocessor.js

=======================================
--- /branches/bleeding_edge/src/cpu-profiler-inl.h      Thu Mar 10 04:00:27 2011
+++ /branches/bleeding_edge/src/cpu-profiler-inl.h      Wed Mar 30 06:30:52 2011
@@ -70,6 +70,7 @@
   // Init the required fields only.
   result->sample.pc = NULL;
   result->sample.frames_count = 0;
+  result->sample.has_external_callback = false;
   return result;
 }

=======================================
--- /branches/bleeding_edge/src/cpu-profiler.cc Tue Mar 29 06:41:06 2011
+++ /branches/bleeding_edge/src/cpu-profiler.cc Wed Mar 30 06:30:52 2011
@@ -187,6 +187,7 @@
   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;
=======================================
--- /branches/bleeding_edge/src/log.cc  Tue Mar 29 02:18:08 2011
+++ /branches/bleeding_edge/src/log.cc  Wed Mar 30 06:30:52 2011
@@ -150,6 +150,7 @@

   sample->tos = NULL;
   sample->frames_count = 0;
+  sample->has_external_callback = false;

   // Avoid collecting traces while doing GC.
   if (sample->state == GC) return;
=======================================
--- /branches/bleeding_edge/src/platform.h      Mon Mar 28 06:05:36 2011
+++ /branches/bleeding_edge/src/platform.h      Wed Mar 30 06:30:52 2011
@@ -596,7 +596,8 @@
         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.
=======================================
--- /branches/bleeding_edge/tools/tickprocessor.js      Mon Mar 21 11:13:27 2011
+++ /branches/bleeding_edge/tools/tickprocessor.js      Wed Mar 30 06:30:52 2011
@@ -345,7 +345,6 @@
   return this.stateFilter_ == null || this.stateFilter_ == vmState;
 };

-
 TickProcessor.prototype.processTick = function(pc,
                                                sp,
                                                is_external_callback,
@@ -361,8 +360,10 @@
   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.

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to