Reviewers: fschneider,

Description:
Fix bug that disabled optimization when profiling.


Please review this at http://codereview.chromium.org/5720003/

SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/

Affected files:
  M     src/runtime-profiler.cc


Index: src/runtime-profiler.cc
===================================================================
--- src/runtime-profiler.cc     (revision 5961)
+++ src/runtime-profiler.cc     (working copy)
@@ -424,17 +424,22 @@

 bool RuntimeProfilerRateLimiter::SuspendIfNecessary() {
   static const int kNonJSTicksThreshold = 100;
+  bool top_is_in_js_state = Top::IsInJSState();
+  // Record state sample.
+  if (top_is_in_js_state) {
+    AddStateSample(IN_JS_STATE);
+  } else {
+    AddStateSample(IN_NON_JS_STATE);
+  }
   // We suspend the runtime profiler thread when not running
   // JavaScript. If the CPU profiler is active we must not do this
   // because it samples both JavaScript and C++ code.
   if (RuntimeProfiler::IsEnabled() &&
       !CpuProfiler::is_profiling() &&
       !(FLAG_prof && FLAG_prof_auto)) {
-    if (Top::IsInJSState()) {
-      AddStateSample(IN_JS_STATE);
+    if (top_is_in_js_state) {
       non_js_ticks_ = 0;
     } else {
-      AddStateSample(IN_NON_JS_STATE);
       if (non_js_ticks_ < kNonJSTicksThreshold) {
         ++non_js_ticks_;
       } else {


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

Reply via email to