Bug 1072903 - TraceLogger: Part 1.5: Fix iterations of stack when getting enabled, r=nbp
authorHannes Verschore <hv1989@gmail.com>
Thu, 20 Nov 2014 17:43:59 +0100
changeset 247491 37770c7a3f0ffe52968c2011a29ebf2611b5fa25
parent 247490 16aa61577e9536dcd1c328e43c22743840c9f921
child 247492 63b734ac95b2f1f3c7ca2cf83d8f511599d7ab8d
push id4489
push userraliiev@mozilla.com
push dateMon, 23 Feb 2015 15:17:55 +0000
treeherdermozilla-beta@fd7c3dc24146 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnbp
bugs1072903
milestone37.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 1072903 - TraceLogger: Part 1.5: Fix iterations of stack when getting enabled, r=nbp
js/src/vm/TraceLogging.cpp
--- a/js/src/vm/TraceLogging.cpp
+++ b/js/src/vm/TraceLogging.cpp
@@ -188,51 +188,36 @@ TraceLogger::enable()
 bool
 TraceLogger::enable(JSContext *cx)
 {
     if (!enable())
         return false;
 
     if (enabled == 1) {
         // Get the top Activation to log the top script/pc (No inlined frames).
-        Activation *act = cx->mainThread().activation();
-        while (act && (act->cx() != cx || (act->isJit() && !act->asJit()->isActive())))
-            act = act->prev();
+        ActivationIterator iter(cx->runtime());
+        Activation *act = iter.activation();
 
         if (!act) {
             failed = true;
             enabled = 0;
             return false;
         }
 
         JSScript *script = nullptr;
         int32_t engine = 0;
 
         if (act->isJit()) {
-            JSRuntime *rt = cx->runtime();
-
-            JitFrameIterator it(rt->mainThread.jitTop, SequentialExecution);
+            JitFrameIterator it(iter);
 
-            MOZ_ASSERT(it.type() == JitFrame_Exit);
-            ++it;
-
-            if (it.type() == JitFrame_Rectifier ||
-                it.type() == JitFrame_Unwound_Rectifier)
-            {
+            while (!it.isScripted() && !it.done())
                 ++it;
-                MOZ_ASSERT(it.type() == JitFrame_BaselineStub ||
-                           it.type() == JitFrame_BaselineJS ||
-                           it.type() == JitFrame_IonJS);
-            }
-            if (it.type() == JitFrame_BaselineStub ||
-                it.type() == JitFrame_Unwound_BaselineStub)
-            {
-                ++it;
-                MOZ_ASSERT(it.type() == JitFrame_BaselineJS);
-            }
+
+            MOZ_ASSERT(!it.done());
+            MOZ_ASSERT(it.isIonJS() || it.isBaselineJS());
 
             script = it.script();
             engine = it.isIonJS() ? IonMonkey : Baseline;
         } else {
             MOZ_ASSERT(act->isInterpreter());
             InterpreterFrame *fp = act->asInterpreter()->current();
             MOZ_ASSERT(!fp->runningInJit());