Fixing regexp compiler nanojit spew to conform with TM
authorDavid Mandelin <dmandelin@mozilla.com>
Tue, 04 Nov 2008 16:10:38 -0800
changeset 21498 82f0753225094a5791ee37f3b8c93233e911f899
parent 21497 547bddde328a0f568237bf691acbc4190221b1df
child 21499 5712af41e2045d9fe389ea60144def55b482519f
push id3558
push userrsayre@mozilla.com
push dateSat, 08 Nov 2008 09:06:43 +0000
treeherdermozilla-central@17747605490c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone1.9.1b2pre
Fixing regexp compiler nanojit spew to conform with TM
js/src/jsregexp.cpp
--- a/js/src/jsregexp.cpp
+++ b/js/src/jsregexp.cpp
@@ -65,16 +65,25 @@
 #include "jsscan.h"
 #include "jsscope.h"
 #include "jsstr.h"
 
 #ifdef JS_TRACER
 #include "jstracer.h"
 using namespace avmplus;
 using namespace nanojit;
+
+/* FIXME  Duplicated with jstracer.cpp, doing it this way for now
+ *        to keep it private to files that need it. */
+#ifdef JS_JIT_SPEW
+static bool verbose_debug = getenv("TRACEMONKEY") && strstr(getenv("TRACEMONKEY"), "verbose");
+#define debug_only_v(x) if (verbose_debug) { x; }
+#else
+#define debug_only_v(x)
+#endif
 #endif
 
 typedef enum REOp {
 #define REOP_DEF(opcode, name) opcode,
 #include "jsreops.tbl"
 #undef REOP_DEF
     REOP_LIMIT /* META: no operator >= to this */
 } REOp;
@@ -2122,19 +2131,17 @@ class RegExpNativeCompiler {
         
         return JS_TRUE;
     }
 
     /* FIXME  Partial duplication with TraceRecorder::addName */
     inline LIns*
     addName(LirBuffer *lirbuf, LIns* ins, const char* name)
     {
-    #ifdef DEBUG
-        lirbuf->names->addName(ins, name);
-    #endif
+        debug_only_v(lirbuf->names->addName(ins, name);)
         return ins;
     }
 
  public:
     RegExpNativeCompiler(JSRegExp *re, CompilerState *cs) 
         : re(re), cs(cs), fragment(NULL) {  }
 
     JSBool compile(JSContext *cx) {
@@ -2149,19 +2156,19 @@ class RegExpNativeCompiler {
          * the lirbuf. */
         fragment->root = fragment;
         LirBuffer *lirbuf = fragment->lirbuf;
         LirBufWriter *lirb;
         /* FIXME  Use smart pointer instead. */
         lir = lirb = new (&gc) LirBufWriter(lirbuf);
 
         /* FIXME  Use smart pointer instead. */
-        verbose_only(fragment->lirbuf->names = new (&gc) LirNameMap(&gc, NULL, fragmento->labels);)
+        debug_only_v(fragment->lirbuf->names = new (&gc) LirNameMap(&gc, NULL, fragmento->labels);)
         /* FIXME  Use smart pointer instead. */
-        verbose_only(lir = new (&gc) VerboseWriter(&gc, lir, lirbuf->names);)
+        debug_only_v(lir = new (&gc) VerboseWriter(&gc, lir, lirbuf->names);)
 
         lir->ins0(LIR_start);
         lirbuf->state = state = addName(lirbuf, lir->insParam(0, 0), "state");
         lirbuf->param1 = gdata = addName(lirbuf, lir->insParam(1, 0), "gdata");
         start = addName(lirbuf, lir->insLoad(LIR_ldp, lirbuf->param1, (int) offsetof(REGlobalData, skipped)), "start");
         cpend = addName(lirbuf, lir->insLoad(LIR_ldp, lirbuf->param1, offsetof(REGlobalData, cpend)), "cpend");
 
         if (cs->flags & JSREG_STICKY) {
@@ -2176,21 +2183,21 @@ class RegExpNativeCompiler {
         memset(guard, 0, sizeof(*guard));
         guard->exit = (SideExit *) &guard->guards;
         guard->from = guard->target = fragment;
         fragment->lastIns = lir->insGuard(LIR_loop, lir->insImm(1), skip);
 
         ::compile(fragmento->assm(), fragment);
 
         delete lirb;
-        verbose_only(delete lir;)
+        debug_only_v(delete lir;)
         return JS_TRUE;
     fail:
         delete lirb;
-        verbose_only(delete lir;)
+        debug_only_v(delete lir;)
         fragmento->clearFrag(re);
         return JS_FALSE;
     }
 };
 
 static inline JSBool
 js_CompileRegExpToNative(JSContext *cx, JSRegExp *re, CompilerState *cs)
 {