From 09041848f2b9957c0cd6c8f0cdf3fbe6584ff9a9 Mon Sep 17 00:00:00 2001 From: Ginn Chen Date: Tue, 21 Sep 2010 16:12:20 +0800 Subject: [PATCH] Bug 597976 Make it able to build TraceJIT w/o MethodJIT r=dvander --- js/src/configure.in | 2 -- js/src/jsinterp.cpp | 12 +++++------- js/src/jstracer.cpp | 6 +++++- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/js/src/configure.in b/js/src/configure.in index 8b35d4ecdae7..8f703aacdc79 100644 --- a/js/src/configure.in +++ b/js/src/configure.in @@ -2648,8 +2648,6 @@ AC_SUBST(ENABLE_METHODJIT) if test "$ENABLE_METHODJIT"; then AC_DEFINE(JS_METHODJIT) -else - ENABLE_TRACEJIT= fi if test "$ENABLE_MONOIC"; then diff --git a/js/src/jsinterp.cpp b/js/src/jsinterp.cpp index a17339227a86..506586949921 100644 --- a/js/src/jsinterp.cpp +++ b/js/src/jsinterp.cpp @@ -2139,7 +2139,7 @@ Interpret(JSContext *cx, JSStackFrame *entryFrame, uintN inlineCallCount, uintN #define TRACE_RECORDER(cx) (false) #endif -#ifdef JS_METHODJIT +#if defined(JS_TRACER) && defined(JS_METHODJIT) # define LEAVE_ON_SAFE_POINT() \ do { \ JS_ASSERT_IF(leaveOnSafePoint, !TRACE_RECORDER(cx)); \ @@ -2202,8 +2202,6 @@ Interpret(JSContext *cx, JSStackFrame *entryFrame, uintN inlineCallCount, uintN #if defined(JS_TRACER) && defined(JS_METHODJIT) bool leaveOnSafePoint = !!(interpFlags & JSINTERP_SAFEPOINT); -#endif -#ifdef JS_METHODJIT # define CLEAR_LEAVE_ON_TRACE_POINT() ((void) (leaveOnSafePoint = false)) #else # define CLEAR_LEAVE_ON_TRACE_POINT() ((void) 0) @@ -2344,8 +2342,10 @@ Interpret(JSContext *cx, JSStackFrame *entryFrame, uintN inlineCallCount, uintN case ARECORD_ABORTED: case ARECORD_COMPLETED: case ARECORD_STOP: +#ifdef JS_METHODJIT leaveOnSafePoint = true; LEAVE_ON_SAFE_POINT(); +#endif break; default: break; @@ -2404,9 +2404,7 @@ ADD_EMPTY_CASE(JSOP_UNUSED180) END_EMPTY_CASES BEGIN_CASE(JSOP_TRACE) -#ifdef JS_METHODJIT LEAVE_ON_SAFE_POINT(); -#endif END_CASE(JSOP_TRACE) /* ADD_EMPTY_CASE is not used here as JSOP_LINENO_LENGTH == 3. */ @@ -2557,7 +2555,7 @@ BEGIN_CASE(JSOP_STOP) if (regs.fp->isConstructing() && regs.fp->returnValue().isPrimitive()) regs.fp->setReturnValue(ObjectValue(regs.fp->constructorThis())); -#ifdef JS_TRACER +#if defined(JS_TRACER) && defined(JS_METHODJIT) /* Hack: re-push rval so either JIT will read it properly. */ regs.fp->setBailedAtReturn(); if (TRACE_RECORDER(cx)) { @@ -6734,7 +6732,7 @@ END_CASE(JSOP_ARRAYPUSH) goto error; } -#ifdef JS_METHODJIT +#if defined(JS_TRACER) && defined(JS_METHODJIT) stop_recording: #endif JS_ASSERT(cx->regs == ®s); diff --git a/js/src/jstracer.cpp b/js/src/jstracer.cpp index def983846f45..f5e8acceaa2a 100644 --- a/js/src/jstracer.cpp +++ b/js/src/jstracer.cpp @@ -2505,6 +2505,7 @@ TraceRecorder::TraceRecorder(JSContext* cx, VMSideExit* anchor, VMFragment* frag * 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) { LIns* counterPtr = INS_CONSTPTR((void *) &JS_THREAD_DATA(cx)->iterationCounter); LIns* counterValue = lir->insLoad(LIR_ldi, counterPtr, 0, ACCSET_OTHER, LOAD_VOLATILE); @@ -2514,6 +2515,7 @@ TraceRecorder::TraceRecorder(JSContext* cx, VMSideExit* anchor, VMFragment* frag lir->insStore(counterValue, counterPtr, 0, ACCSET_OTHER); branch->setTarget(lir->ins0(LIR_label)); } +#endif } /* @@ -4497,7 +4499,7 @@ ProhibitFlush(JSContext* cx) static void ResetJITImpl(JSContext* cx) { - if (!(cx->traceJitEnabled || cx->methodJitEnabled)) + if (!cx->traceJitEnabled) return; TraceMonitor* tm = &JS_TRACE_MONITOR(cx); debug_only_print0(LC_TMTracer, "Flushing cache.\n"); @@ -6653,6 +6655,7 @@ ExecuteTree(JSContext* cx, TreeFragment* f, uintN& inlineCallCount, bool ok = !(state.builtinStatus & BUILTIN_ERROR); JS_ASSERT_IF(cx->throwing, !ok); +#ifdef JS_METHODJIT if (cx->methodJitEnabled) { if (lr->exitType == LOOP_EXIT && JS_THREAD_DATA(cx)->iterationCounter < MIN_LOOP_ITERS) { debug_only_printf(LC_TMTracer, "tree %p executed only %d iterations, blacklisting\n", @@ -6660,6 +6663,7 @@ ExecuteTree(JSContext* cx, TreeFragment* f, uintN& inlineCallCount, Blacklist((jsbytecode *)f->ip); } } +#endif return ok; }