Bug 987442 - Correctly clear compile-time tracking frame for SPS when emitting OOL code. r=sstangl
authorKannan Vijayan <kvijayan@mozilla.com>
Wed, 26 Mar 2014 13:06:04 -0400
changeset 175392 e2e511a35e67d0823988d01a879cd59ea92e2d67
parent 175391 28449be5399d0929548ef1419c1a6c0779c9df3a
child 175393 76c310344c00ef9a9b3029d47439649a985497e2
push id41526
push userkvijayan@mozilla.com
push dateWed, 26 Mar 2014 17:06:21 +0000
treeherdermozilla-inbound@e2e511a35e67 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssstangl
bugs987442
milestone31.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 987442 - Correctly clear compile-time tracking frame for SPS when emitting OOL code. r=sstangl
js/src/vm/SPSProfiler.h
--- a/js/src/vm/SPSProfiler.h
+++ b/js/src/vm/SPSProfiler.h
@@ -286,16 +286,23 @@ class SPSInstrumentation
         int  left;        // number of leave() calls made without a matching reenter()
     };
 
     SPSProfiler *profiler_; // Instrumentation location management
 
     Vector<FrameState, 1, SystemAllocPolicy> frames;
     FrameState *frame;
 
+    static void clearFrame(FrameState *frame) {
+        frame->script = nullptr;
+        frame->pc = nullptr;
+        frame->skipNext = false;
+        frame->left = 0;
+    }
+
   public:
     /*
      * Creates instrumentation which writes information out the the specified
      * profiler's stack and constituent fields.
      */
     SPSInstrumentation(SPSProfiler *profiler)
       : profiler_(profiler), frame(nullptr)
     {
@@ -328,20 +335,17 @@ class SPSInstrumentation
         JS_ASSERT_IF(frame != nullptr, frame->left == 1);
         if (!frames.empty()) {
             JS_ASSERT(frame == &frames[frames.length() - 1]);
             frame->pc = callerPC;
         }
         if (!frames.growBy(1))
             return false;
         frame = &frames[frames.length() - 1];
-        frame->script = nullptr;
-        frame->pc = nullptr;
-        frame->skipNext = false;
-        frame->left = 0;
+        clearFrame(frame);
         return true;
     }
 
     /* Prepares the instrumenter state for generating OOL code, by
      * setting up the frame state to seem as if there are exactly
      * two pushed frames: a frame for the top-level script, and
      * a frame for the OOL code being generated.  Any
      * vm-calls from the OOL code will "leave" the OOL frame and
@@ -355,16 +359,17 @@ class SPSInstrumentation
             frames.shrinkBy(frames.length() - 2);
 
         } else { // frames.length() == 1
             if (!frames.growBy(1))
                 return false;
         }
         frames[0].pc = frames[0].script->code();
         frame = &frames[1];
+        clearFrame(frame);
         return true;
     }
     void finishOOL() {
         if (!enabled())
             return;
         JS_ASSERT(!frames.empty());
         frames.shrinkBy(frames.length() - 1);
     }