Bug 621032 - Move iterationCounter from JSThreadData to TraceMonitor (r=igor)
authorBill McCloskey <wmccloskey@mozilla.com>
Thu, 23 Dec 2010 15:10:36 -0800
changeset 59923 74c70b60cf8b1ff4e88512b7565d1f0b4ac8333e
parent 59922 acb3e091eb25bff6dcea3d0b7646ed07a22513da
child 59924 6255a0255dc2565b5b4210c00090fa8bdc8d2dfd
push id17820
push usercleary@mozilla.com
push dateTue, 04 Jan 2011 21:40:57 +0000
treeherdermozilla-central@969691cfe40e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersigor
bugs621032
milestone2.0b8pre
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 621032 - Move iterationCounter from JSThreadData to TraceMonitor (r=igor)
js/src/jscntxt.h
js/src/jscompartment.h
js/src/jstracer.cpp
--- a/js/src/jscntxt.h
+++ b/js/src/jscntxt.h
@@ -955,19 +955,16 @@ struct JSThreadData {
      * do not interleave js_GetSrcNote calls.
      */
     JSGSNCache          gsnCache;
 
     /* Property cache for faster call/get/set invocation. */
     js::PropertyCache   propertyCache;
 
 #ifdef JS_TRACER
-    /* Counts the number of iterations run by a trace. */
-    unsigned            iterationCounter;
-
     /* Maximum size of the tracer's code cache before we start flushing. */
     uint32              maxCodeCacheBytes;
 #endif
 
     /* State used by dtoa.c. */
     DtoaState           *dtoaState;
 
     /*
--- a/js/src/jscompartment.h
+++ b/js/src/jscompartment.h
@@ -87,16 +87,19 @@ struct TraceMonitor {
      *
      * !tracecx && !recorder: not on trace
      * !tracecx && recorder: recording
      * tracecx && !recorder: executing a trace
      * tracecx && recorder: executing inner loop, recording outer loop
      */
     JSContext               *tracecx;
 
+    /* Counts the number of iterations run by the currently executing trace. */
+    unsigned                iterationCounter;
+
     /*
      * Cached storage to use when executing on trace. While we may enter nested
      * traces, we always reuse the outer trace's storage, so never need more
      * than of these.
      */
     TraceNativeStorage      *storage;
 
     /*
--- a/js/src/jstracer.cpp
+++ b/js/src/jstracer.cpp
@@ -2358,17 +2358,17 @@ TraceRecorder::TraceRecorder(JSContext* 
         /*
          * Count the number of iterations run by a trace, so that we can blacklist if
          * the trace runs too few iterations to be worthwhile. Do this only if the methodjit
          * is on--otherwise we must try to trace as much as possible.
          */
 #ifdef JS_METHODJIT
         if (cx->methodJitEnabled) {
             w.comment("begin-count-loop-iterations");
-            LIns* counterPtr = w.nameImmpNonGC((void *) &JS_THREAD_DATA(cx)->iterationCounter);
+            LIns* counterPtr = w.nameImmpNonGC((void *) &traceMonitor->iterationCounter);
             LIns* counterValue = w.ldiVolatile(counterPtr);
             LIns* test = w.ltiN(counterValue, LOOP_COUNT_MAX);
             LIns *branch = w.jfUnoptimizable(test);
             /* 
              * stiVolatile() uses ACCSET_STORE_ANY;  If LICM is implemented
              * (bug 545406) this counter will need its own region.
              */
             w.stiVolatile(w.addi(counterValue, w.immi(1)), counterPtr);
@@ -6519,17 +6519,17 @@ ExecuteTree(JSContext* cx, TreeFragment*
                       FramePCOffset(cx, cx->fp()),
            f->execs,
            f->code());
 
     debug_only_stmt(uint32 globalSlots = globalObj->numSlots();)
     debug_only_stmt(*(uint64*)&tm->storage->global()[globalSlots] = 0xdeadbeefdeadbeefLL;)
 
     /* Execute trace. */
-    JS_THREAD_DATA(cx)->iterationCounter = 0;
+    tm->iterationCounter = 0;
     debug_only(int64 t0 = PRMJ_Now();)
 #ifdef MOZ_TRACEVIS
     VMSideExit* lr = (TraceVisStateObj(cx, S_NATIVE), ExecuteTrace(cx, f, state));
 #else
     VMSideExit* lr = ExecuteTrace(cx, f, state);
 #endif
     debug_only(int64 t1 = PRMJ_Now();)
 
@@ -6538,17 +6538,17 @@ ExecuteTree(JSContext* cx, TreeFragment*
 
     /* Restore interpreter state. */
     LeaveTree(tm, state, lr);
 
     *lrp = state.innermost;
     bool ok = !(state.builtinStatus & BUILTIN_ERROR);
     JS_ASSERT_IF(cx->throwing, !ok);
 
-    size_t iters = JS_THREAD_DATA(cx)->iterationCounter;
+    size_t iters = tm->iterationCounter;
 
     f->execs++;
     f->iters += iters;
 
 #ifdef DEBUG
     JSStackFrame *fp = cx->fp();
     const char *prefix = "";
     if (iters == LOOP_COUNT_MAX)