Revision: 4017
Author: [email protected]
Date: Thu Mar  4 04:32:03 2010
Log: Assign to "sample.state" before reading it.

I noticed a funny thing: in StackTracer::Trace "sample.state" is
checked, but it is only assigned after the check. I've put assignment
before the check.

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

Modified:
 /branches/bleeding_edge/src/platform-freebsd.cc
 /branches/bleeding_edge/src/platform-linux.cc
 /branches/bleeding_edge/src/platform-macos.cc
 /branches/bleeding_edge/src/platform-win32.cc

=======================================
--- /branches/bleeding_edge/src/platform-freebsd.cc     Mon Jan 25 04:37:31 2010
+++ /branches/bleeding_edge/src/platform-freebsd.cc     Thu Mar  4 04:32:03 2010
@@ -567,6 +567,9 @@

   TickSample sample;

+  // We always sample the VM state.
+  sample.state = Logger::state();
+
   // If profiling, we extract the current pc and sp.
   if (active_sampler_->IsProfiling()) {
// Extracting the sample from the context is extremely machine dependent.
@@ -587,9 +590,6 @@
 #endif
     active_sampler_->SampleStack(&sample);
   }
-
-  // We always sample the VM state.
-  sample.state = Logger::state();

   active_sampler_->Tick(&sample);
 }
=======================================
--- /branches/bleeding_edge/src/platform-linux.cc       Fri Feb  5 00:46:41 2010
+++ /branches/bleeding_edge/src/platform-linux.cc       Thu Mar  4 04:32:03 2010
@@ -728,6 +728,9 @@

   TickSample sample;

+  // We always sample the VM state.
+  sample.state = Logger::state();
+
   // If profiling, we extract the current pc and sp.
   if (active_sampler_->IsProfiling()) {
// Extracting the sample from the context is extremely machine dependent.
@@ -759,9 +762,6 @@
     if (IsVmThread())
       active_sampler_->SampleStack(&sample);
   }
-
-  // We always sample the VM state.
-  sample.state = Logger::state();

   active_sampler_->Tick(&sample);
 #endif
=======================================
--- /branches/bleeding_edge/src/platform-macos.cc       Mon Jan 25 04:37:31 2010
+++ /branches/bleeding_edge/src/platform-macos.cc       Thu Mar  4 04:32:03 2010
@@ -548,6 +548,9 @@
     while (sampler_->IsActive()) {
       TickSample sample;

+      // We always sample the VM state.
+      sample.state = Logger::state();
+
       // If profiling, we record the pc and sp of the profiled thread.
       if (sampler_->IsProfiling()
           && KERN_SUCCESS == thread_suspend(profiled_thread_)) {
@@ -585,8 +588,6 @@
         thread_resume(profiled_thread_);
       }

-      // We always sample the VM state.
-      sample.state = Logger::state();
       // Invoke tick handler with program counter and stack pointer.
       sampler_->Tick(&sample);

=======================================
--- /branches/bleeding_edge/src/platform-win32.cc       Thu Jan 21 08:42:41 2010
+++ /branches/bleeding_edge/src/platform-win32.cc       Thu Mar  4 04:32:03 2010
@@ -1807,6 +1807,9 @@
     while (sampler_->IsActive()) {
       TickSample sample;

+      // We always sample the VM state.
+      sample.state = Logger::state();
+
       // If profiling, we record the pc and sp of the profiled thread.
       if (sampler_->IsProfiling()
           && SuspendThread(profiled_thread_) != (DWORD)-1) {
@@ -1826,8 +1829,6 @@
         ResumeThread(profiled_thread_);
       }

-      // We always sample the VM state.
-      sample.state = Logger::state();
       // Invoke tick handler with program counter and stack pointer.
       sampler_->Tick(&sample);

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

Reply via email to