Remove LeaveTrace and related structures (bug 698201 part 5, r=luke).
authorDavid Anderson <dvander@alliedmods.net>
Tue, 22 Nov 2011 17:41:43 -0500
changeset 82297 b02f12cc9656a7c45243c6b0116b04d00f4c74c2
parent 82296 b1c5b23aa0fae2efd9a053c1a0f536c15815fa1f
child 82298 37cbe2c24ecd55d81767386f94a8fb40433a5da3
push idunknown
push userunknown
push dateunknown
reviewersluke
bugs698201
milestone11.0a1
Remove LeaveTrace and related structures (bug 698201 part 5, r=luke).
js/src/Makefile.in
js/src/config/autoconf.mk.in
js/src/configure.in
js/src/jit-test/jit_test.py
js/src/jsapi.cpp
js/src/jsapi.h
js/src/jsarray.cpp
js/src/jscntxt.cpp
js/src/jscntxt.h
js/src/jscntxtinlines.h
js/src/jscompartment.h
js/src/jsdate.cpp
js/src/jsdbgapi.cpp
js/src/jsdbgapi.h
js/src/jsfun.cpp
js/src/jsgc.cpp
js/src/jsinterp.cpp
js/src/jsiter.cpp
js/src/jsobj.cpp
js/src/jsobj.h
js/src/json.cpp
js/src/jsopcode.cpp
js/src/jsprvtd.h
js/src/jsscope.cpp
js/src/jsscopeinlines.h
js/src/jsutil.h
js/src/jswrapper.cpp
js/src/jsxml.cpp
js/src/methodjit/MonoIC.cpp
js/src/shell/js.cpp
js/src/tests/browser.js
js/src/tests/shell.js
js/src/tests/user.js
js/src/vm/ArgumentsObject-inl.h
js/src/vm/ArgumentsObject.h
js/src/vm/RegExpObject-inl.h
js/src/vm/Stack-inl.h
js/src/vm/Stack.cpp
js/src/vm/String-inl.h
--- a/js/src/Makefile.in
+++ b/js/src/Makefile.in
@@ -638,17 +638,17 @@ check-malloc-function-usage: $(filter-ou
 	# This should go to zero, if possible.
 	$(srcdir)/config/check_source_count.py UnwantedForeground:: 31 \
 		"in Makefile.in" "{cx,rt}->{free_,delete_,array_delete}" $^
 
 ifneq ($(OS_ARCH),WINNT) # FIXME: this should be made work on Windows too.
 #check:: check-malloc-function-usage FIXME: disable on JM until closer to merge time.
 endif
 
-JITFLAGS = ,m,j,mj,mjp,am,amj,amjp,amd,n,mn,jn,mjn,mjpn,amn,amjn,amjpn,amdn
+JITFLAGS = ,m,am,amd,n,mn,amn,amdn,mdn
 check-jit-test::
 	$(wildcard $(RUN_TEST_PROGRAM)) $(PYTHON) -u $(srcdir)/jit-test/jit_test.py \
 	        --valgrind --no-slow --no-progress --tinderbox --jitflags=$(JITFLAGS) $(DIST)/bin/js$(BIN_SUFFIX)
 
 check:: check-jit-test
 
 # jstests doesn't have a --jitflags option, so we need to loop, updating the
 # exit code (RC) after each invocation.
--- a/js/src/config/autoconf.mk.in
+++ b/js/src/config/autoconf.mk.in
@@ -326,19 +326,17 @@ NEXT_ROOT	= @NEXT_ROOT@
 GCC_VERSION	= @GCC_VERSION@
 UNIVERSAL_BINARY= @UNIVERSAL_BINARY@
 MOZ_CAN_RUN_PROGRAMS = @MOZ_CAN_RUN_PROGRAMS@
 HAVE_DTRACE= @HAVE_DTRACE@
 
 VISIBILITY_FLAGS = @VISIBILITY_FLAGS@
 WRAP_SYSTEM_INCLUDES = @WRAP_SYSTEM_INCLUDES@
 
-ENABLE_TRACEJIT = @ENABLE_TRACEJIT@
 ENABLE_METHODJIT = @ENABLE_METHODJIT@
-NANOJIT_ARCH = @NANOJIT_ARCH@
 HAVE_ARM_SIMD= @HAVE_ARM_SIMD@
 
 JS_SHARED_LIBRARY = @JS_SHARED_LIBRARY@
 HAVE_LINUX_PERF_EVENT_H = @HAVE_LINUX_PERF_EVENT_H@
 
 # We only want to do the pymake sanity on Windows, other os's can cope
 ifeq ($(HOST_OS_ARCH),WINNT)
 # Ensure invariants between GNU Make and pymake
--- a/js/src/configure.in
+++ b/js/src/configure.in
@@ -2862,18 +2862,16 @@ fi
 if test "$ENABLE_METHODJIT_TYPED_ARRAY"; then
     AC_DEFINE(JS_METHODJIT_TYPED_ARRAY)
 fi
 
 if test "$ENABLE_METHODJIT_SPEW"; then
     AC_DEFINE(JS_METHODJIT_SPEW)
 fi
 
-AC_SUBST(ENABLE_TRACEJIT)
-
 if test -z "$SKIP_COMPILER_CHECKS"; then
 dnl Checks for typedefs, structures, and compiler characteristics.
 dnl ========================================================
 AC_HEADER_STDC
 AC_C_CONST
 AC_TYPE_MODE_T
 AC_TYPE_OFF_T
 AC_TYPE_PID_T
--- a/js/src/jit-test/jit_test.py
+++ b/js/src/jit-test/jit_test.py
@@ -351,17 +351,17 @@ def run_tests(tests, test_dir, lib_dir, 
         print('PASSED ALL' + ('' if complete else ' (partial run -- interrupted by user %s)'%doing))
         return True
 
 def parse_jitflags():
     jitflags = [ [ '-' + flag for flag in flags ] 
                  for flags in OPTIONS.jitflags.split(',') ]
     for flags in jitflags:
         for flag in flags:
-            if flag not in ('-j', '-m', '-a', '-p', '-d', '-n'):
+            if flag not in ('-m', '-a', '-p', '-d', '-n'):
                 print('Invalid jit flag: "%s"'%flag)
                 sys.exit(1)
     return jitflags
 
 def platform_might_be_android():
     try:
         # The python package for SL4A provides an |android| module.
         # If that module is present, we're likely in SL4A-python on
@@ -415,18 +415,18 @@ def main(argv):
     op.add_option('-R', '--retest', dest='retest', metavar='FILE',
                   help='Retest using test list file [FILE]')
     op.add_option('-g', '--debug', dest='debug', action='store_true',
                   help='Run test in gdb')
     op.add_option('--valgrind', dest='valgrind', action='store_true',
                   help='Enable the |valgrind| flag, if valgrind is in $PATH.')
     op.add_option('--valgrind-all', dest='valgrind_all', action='store_true',
                   help='Run all tests with valgrind, if valgrind is in $PATH.')
-    op.add_option('--jitflags', dest='jitflags', default='mjp',
-                  help='Example: --jitflags=j,mj,mjp to run each test with -j, -m -j, -m -j -p [default=%default]')
+    op.add_option('--jitflags', dest='jitflags', default='m,mn',
+                  help='Example: --jitflags=m,mn to run each test with -m, -m -n [default=%default]')
     op.add_option('--avoid-stdio', dest='avoid_stdio', action='store_true',
                   help='Use js-shell file indirection instead of piping stdio.')
     op.add_option('--write-failure-output', dest='write_failure_output', action='store_true',
                   help='With --write-failures=FILE, additionally write the output of failed tests to [FILE]')
     (OPTIONS, args) = op.parse_args(argv)
     if len(args) < 1:
         op.error('missing JS_SHELL argument')
     # We need to make sure we are using backslashes on Windows.
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -903,20 +903,16 @@ JS_DestroyRuntime(JSRuntime *rt)
     Foreground::delete_(rt);
 }
 
 JS_PUBLIC_API(void)
 JS_ShutDown(void)
 {
     Probes::shutdown();
 
-#ifdef MOZ_TRACEVIS
-    StopTraceVis();
-#endif
-
 #ifdef JS_THREADSAFE
     js_CleanupLocks();
 #endif
     PRMJ_NowShutdown();
 }
 
 JS_PUBLIC_API(void *)
 JS_GetRuntimePrivate(JSRuntime *rt)
@@ -969,18 +965,16 @@ static void
 StopRequest(JSContext *cx)
 {
     JSThread *t = cx->thread();
     JS_ASSERT(CURRENT_THREAD_IS_ME(t));
     JS_ASSERT(t->data.requestDepth != 0);
     if (t->data.requestDepth != 1) {
         t->data.requestDepth--;
     } else {
-        LeaveTrace(cx);  /* for GC safety */
-
         t->data.conservativeGC.updateForRequestEnd(t->suspendCount);
 
         /* Lock before clearing to interlock with ClaimScope, in jslock.c. */
         JSRuntime *rt = cx->runtime;
         AutoLockGC lock(rt);
 
         t->data.requestDepth = 0;
 
@@ -2733,33 +2727,29 @@ JS_IsGCMarkingTracer(JSTracer *trc)
 }
 
 JS_PUBLIC_API(void)
 JS_CompartmentGC(JSContext *cx, JSCompartment *comp)
 {
     /* We cannot GC the atoms compartment alone; use a full GC instead. */
     JS_ASSERT(comp != cx->runtime->atomsCompartment);
 
-    LeaveTrace(cx);
-
     js::gc::VerifyBarriers(cx, true);
     js_GC(cx, comp, GC_NORMAL, gcstats::PUBLIC_API);
 }
 
 JS_PUBLIC_API(void)
 JS_GC(JSContext *cx)
 {
     JS_CompartmentGC(cx, NULL);
 }
 
 JS_PUBLIC_API(void)
 JS_MaybeGC(JSContext *cx)
 {
-    LeaveTrace(cx);
-
     MaybeGC(cx);
 }
 
 JS_PUBLIC_API(JSGCCallback)
 JS_SetGCCallback(JSContext *cx, JSGCCallback cb)
 {
     CHECK_REQUEST(cx);
     return JS_SetGCCallbackRT(cx->runtime, cb);
@@ -5303,25 +5293,23 @@ JS_IsRunning(JSContext *cx)
         fp = fp->prev();
     return fp != NULL;
 }
 
 JS_PUBLIC_API(JSBool)
 JS_SaveFrameChain(JSContext *cx)
 {
     CHECK_REQUEST(cx);
-    LeaveTrace(cx);
     return cx->stack.saveFrameChain();
 }
 
 JS_PUBLIC_API(void)
 JS_RestoreFrameChain(JSContext *cx)
 {
     CHECK_REQUEST(cx);
-    JS_ASSERT_NOT_ON_TRACE(cx);
     cx->stack.restoreFrameChain();
 }
 
 /************************************************************************/
 JS_PUBLIC_API(JSString *)
 JS_NewStringCopyN(JSContext *cx, const char *s, size_t n)
 {
     CHECK_REQUEST(cx);
--- a/js/src/jsapi.h
+++ b/js/src/jsapi.h
@@ -2152,17 +2152,17 @@ JS_StringToVersion(const char *string);
 
 #define JSOPTION_RELIMIT        JS_BIT(9)       /* Throw exception on any
                                                    regular expression which
                                                    backtracks more than n^3
                                                    times, where n is length
                                                    of the input string */
 /* JS_BIT(10) is currently unused. */
 
-#define JSOPTION_JIT            JS_BIT(11)      /* Enable JIT compilation. */
+#define JSOPTION_JIT            JS_BIT(11)      /* Deprecated; does nothing */
 
 #define JSOPTION_NO_SCRIPT_RVAL JS_BIT(12)      /* A promise to the compiler
                                                    that a null rval out-param
                                                    will be passed to each call
                                                    to JS_ExecuteScript. */
 #define JSOPTION_UNROOTED_GLOBAL JS_BIT(13)     /* The GC will not root the
                                                    contexts' global objects
                                                    (see JS_GetGlobalObject),
--- a/js/src/jsarray.cpp
+++ b/js/src/jsarray.cpp
@@ -1692,17 +1692,16 @@ array_toString(JSContext *cx, uintN argc
     if (!js_IsCallable(join)) {
         JSString *str = obj_toStringHelper(cx, obj);
         if (!str)
             return false;
         args.rval().setString(str);
         return true;
     }
 
-    LeaveTrace(cx);
     InvokeArgsGuard ag;
     if (!cx->stack.pushInvokeArgs(cx, 0, &ag))
         return false;
 
     ag.calleev() = join;
     ag.thisv().setObject(*obj);
 
     /* Do the call. */
--- a/js/src/jscntxt.cpp
+++ b/js/src/jscntxt.cpp
@@ -1389,17 +1389,16 @@ JSContext::JSContext(JSRuntime *rt)
     autoGCRooters(NULL),
     debugHooks(&rt->globalDebugHooks),
     securityCallbacks(NULL),
     resolveFlags(0),
     rngSeed(0),
     iterValue(MagicValue(JS_NO_ITER_VALUE)),
 #ifdef JS_METHODJIT
     methodJitEnabled(false),
-    profilingEnabled(false),
 #endif
     inferenceEnabled(false),
 #ifdef MOZ_TRACE_JSCALLS
     functionCallback(NULL),
 #endif
     enumerators(NULL),
 #ifdef JS_THREADSAFE
     gcBackgroundFree(NULL),
@@ -1653,28 +1652,16 @@ JSContext::updateJITEnabled()
                           JSC::MacroAssemblerX86Common::HasSSE2
 # endif
                         ;
 #endif
 }
 
 namespace js {
 
-JS_FORCES_STACK JS_FRIEND_API(void)
-LeaveTrace(JSContext *cx)
-{
-}
-
-bool
-CanLeaveTrace(JSContext *cx)
-{
-    JS_ASSERT(JS_ON_TRACE(cx));
-    return false;
-}
-
 AutoEnumStateRooter::~AutoEnumStateRooter()
 {
     if (!stateValue.isNull()) {
         DebugOnly<JSBool> ok =
             obj->enumerate(context, JSENUMERATE_DESTROY, &stateValue, 0);
         JS_ASSERT(ok);
     }
 }
--- a/js/src/jscntxt.h
+++ b/js/src/jscntxt.h
@@ -65,69 +65,34 @@
 
 #ifdef _MSC_VER
 #pragma warning(push)
 #pragma warning(disable:4100) /* Silence unreferenced formal parameter warnings */
 #pragma warning(push)
 #pragma warning(disable:4355) /* Silence warning about "this" used in base member initializer list */
 #endif
 
-/* Forward declarations of nanojit types. */
-namespace nanojit {
-
-class Assembler;
-class CodeAlloc;
-class Fragment;
-template<typename K> struct DefaultHash;
-template<typename K, typename V, typename H> class HashMap;
-template<typename T> class Seq;
-
-}  /* namespace nanojit */
-
 JS_BEGIN_EXTERN_C
 struct DtoaState;
 JS_END_EXTERN_C
 
 struct JSSharpObjectMap {
     jsrefcount  depth;
     uint32      sharpgen;
     JSHashTable *table;
 };
 
 namespace js {
 
-/* Tracer constants. */
-static const size_t MONITOR_N_GLOBAL_STATES = 4;
-static const size_t FRAGMENT_TABLE_SIZE = 512;
-static const size_t MAX_GLOBAL_SLOTS = 4096;
-static const size_t GLOBAL_SLOTS_BUFFER_SIZE = MAX_GLOBAL_SLOTS + 1;
-
-/* Forward declarations of tracer types. */
-class VMAllocator;
-class FrameInfoCache;
-struct FrameInfo;
-struct VMSideExit;
-struct TreeFragment;
-struct TracerState;
-template<typename T> class Queue;
-typedef Queue<uint16> SlotList;
-class TypeMap;
-class LoopProfile;
-class InterpreterFrames;
-
-#if defined(JS_JIT_SPEW) || defined(DEBUG)
-struct FragPI;
-typedef nanojit::HashMap<uint32, FragPI, nanojit::DefaultHash<uint32> > FragStatsMap;
-#endif
-
 namespace mjit {
 class JaegerCompartment;
 }
 
 class WeakMapBase;
+class InterpreterFrames;
 
 /*
  * GetSrcNote cache to avoid O(n^2) growth in finding a source note for a
  * given pc in a script. We use the script->code pointer to tag the cache,
  * instead of the script address itself, so that source notes are always found
  * by offset from the bytecode with which they were generated.
  */
 struct GSNCache {
@@ -1158,17 +1123,16 @@ struct JSContext
     /* Random number generator state, used by jsmath.cpp. */
     int64               rngSeed;
 
     /* Location to stash the iteration value between JSOP_MOREITER and JSOP_ITERNEXT. */
     js::Value           iterValue;
 
 #ifdef JS_METHODJIT
     bool                 methodJitEnabled;
-    bool                 profilingEnabled;
 
     inline js::mjit::JaegerCompartment *jaegerCompartment();
 #endif
 
     bool                 inferenceEnabled;
 
     bool typeInferenceEnabled() { return inferenceEnabled; }
 
@@ -2141,22 +2105,16 @@ js_GetScriptedCaller(JSContext *cx, js::
 extern jsbytecode*
 js_GetCurrentBytecodePC(JSContext* cx);
 
 extern JSScript *
 js_GetCurrentScript(JSContext* cx);
 
 namespace js {
 
-extern JS_FORCES_STACK JS_FRIEND_API(void)
-LeaveTrace(JSContext *cx);
-
-extern bool
-CanLeaveTrace(JSContext *cx);
-
 #ifdef JS_METHODJIT
 namespace mjit {
     void ExpandInlineFrames(JSCompartment *compartment);
 }
 #endif
 
 } /* namespace js */
 
--- a/js/src/jscntxtinlines.h
+++ b/js/src/jscntxtinlines.h
@@ -368,30 +368,16 @@ CallSetter(JSContext *cx, JSObject *obj,
     if (attrs & JSPROP_GETTER)
         return js_ReportGetterOnlyAssignment(cx);
 
     if (attrs & JSPROP_SHORTID)
         id = INT_TO_JSID(shortid);
     return CallJSPropertyOpSetter(cx, op, obj, id, strict, vp);
 }
 
-static JS_INLINE void
-LeaveTraceIfGlobalObject(JSContext *cx, JSObject *obj)
-{
-    if (!obj->getParent())
-        LeaveTrace(cx);
-}
-
-static JS_INLINE void
-LeaveTraceIfArgumentsObject(JSContext *cx, JSObject *obj)
-{
-    if (obj->isArguments())
-        LeaveTrace(cx);
-}
-
 static inline JSAtom **
 FrameAtomBase(JSContext *cx, js::StackFrame *fp)
 {
     return fp->script()->atoms;
 }
 
 }  /* namespace js */
 
@@ -506,24 +492,20 @@ JSContext::ensureParseMapPool()
         return true;
     parseMapPool_ = js::OffTheBooks::new_<js::ParseMapPool>(this);
     return parseMapPool_;
 }
 
 /*
  * Get the current frame, first lazily instantiating stack frames if needed.
  * (Do not access cx->fp() directly except in JS_REQUIRES_STACK code.)
- *
- * LeaveTrace is defined in jstracer.cpp if JS_TRACER is defined.
  */
 static JS_FORCES_STACK JS_INLINE js::StackFrame *
 js_GetTopStackFrame(JSContext *cx, FrameExpandKind expand)
 {
-    js::LeaveTrace(cx);
-
 #ifdef JS_METHODJIT
     if (expand)
         js::mjit::ExpandInlineFrames(cx->compartment);
 #endif
 
     return cx->maybefp();
 }
 
--- a/js/src/jscompartment.h
+++ b/js/src/jscompartment.h
@@ -50,248 +50,21 @@
 
 #ifdef _MSC_VER
 #pragma warning(push)
 #pragma warning(disable:4251) /* Silence warning about JS_FRIEND_API and data members. */
 #endif
 
 namespace js {
 
-/* Holds the number of recording attemps for an address. */
-typedef HashMap<jsbytecode*,
-                size_t,
-                DefaultHasher<jsbytecode*>,
-                SystemAllocPolicy> RecordAttemptMap;
-
-/* Holds the profile data for loops. */
-typedef HashMap<jsbytecode*,
-                LoopProfile*,
-                DefaultHasher<jsbytecode*>,
-                SystemAllocPolicy> LoopProfileMap;
-
-class Oracle;
-
-typedef HashSet<JSScript *,
-                DefaultHasher<JSScript *>,
-                SystemAllocPolicy> TracedScriptSet;
-
 typedef HashMap<JSFunction *,
                 JSString *,
                 DefaultHasher<JSFunction *>,
                 SystemAllocPolicy> ToSourceCache;
 
-struct TraceMonitor;
-
-/* Holds the execution state during trace execution. */
-struct TracerState
-{
-    JSContext*     cx;                  // current VM context handle
-    TraceMonitor*  traceMonitor;        // current TM
-    double*        stackBase;           // native stack base
-    double*        sp;                  // native stack pointer, stack[0] is spbase[0]
-    double*        eos;                 // first unusable word after the native stack / begin of globals
-    FrameInfo**    callstackBase;       // call stack base
-    void*          sor;                 // start of rp stack
-    FrameInfo**    rp;                  // call stack pointer
-    void*          eor;                 // first unusable word after the call stack
-    VMSideExit*    lastTreeExitGuard;   // guard we exited on during a tree call
-    VMSideExit*    lastTreeCallGuard;   // guard we want to grow from if the tree
-                                        // call exit guard mismatched
-    void*          rpAtLastTreeCall;    // value of rp at innermost tree call guard
-    VMSideExit*    outermostTreeExitGuard; // the last side exit returned by js_CallTree
-    TreeFragment*  outermostTree;       // the outermost tree we initially invoked
-    VMSideExit**   innermostNestedGuardp;
-    VMSideExit*    innermost;
-    uint64         startTime;
-    TracerState*   prev;
-
-    // Used by _FAIL builtins; see jsbuiltins.h. The builtin sets the
-    // JSBUILTIN_BAILED bit if it bails off trace and the JSBUILTIN_ERROR bit
-    // if an error or exception occurred.
-    uint32         builtinStatus;
-
-    // Used to communicate the location of the return value in case of a deep bail.
-    double*        deepBailSp;
-
-    // Used when calling natives from trace to root the vp vector.
-    uintN          nativeVpLen;
-    js::Value*     nativeVp;
-
-    TracerState(JSContext *cx, TraceMonitor *tm, TreeFragment *ti,
-                VMSideExit** innermostNestedGuardp);
-    ~TracerState();
-};
-
-/*
- * Storage for the execution state and store during trace execution. Generated
- * code depends on the fact that the globals begin |MAX_NATIVE_STACK_SLOTS|
- * doubles after the stack begins. Thus, on trace, |TracerState::eos| holds a
- * pointer to the first global.
- */
-struct TraceNativeStorage
-{
-    /* Max number of stack slots/frame that may need to be restored in LeaveTree. */
-    static const size_t MAX_NATIVE_STACK_SLOTS  = 4096;
-    static const size_t MAX_CALL_STACK_ENTRIES  = 500;
-
-    double stack_global_buf[MAX_NATIVE_STACK_SLOTS + GLOBAL_SLOTS_BUFFER_SIZE];
-    FrameInfo *callstack_buf[MAX_CALL_STACK_ENTRIES];
-
-    double *stack() { return stack_global_buf; }
-    double *global() { return stack_global_buf + MAX_NATIVE_STACK_SLOTS; }
-    FrameInfo **callstack() { return callstack_buf; }
-};
-
-/* Holds data to track a single globa. */
-struct GlobalState {
-    JSObject*               globalObj;
-    uint32                  globalShape;
-    SlotList*               globalSlots;
-};
-
-/*
- * Trace monitor. Every JSCompartment has an associated trace monitor
- * that keeps track of loop frequencies for all JavaScript code loaded
- * into that runtime.
- */
-struct TraceMonitor {
-    /*
-     * The context currently executing JIT-compiled code in this compartment, or
-     * NULL if none. Among other things, this can in certain cases prevent
-     * last-ditch GC and suppress calls to JS_ReportOutOfMemory.
-     *
-     * !tracecx && !recorder: not on trace
-     * !tracecx && recorder: recording
-     * tracecx && !recorder: executing a trace
-     * tracecx && recorder: executing inner loop, recording outer loop
-     */
-    JSContext               *tracecx;
-
-    /*
-     * State for the current tree execution.  bailExit is valid if the tree has
-     * called back into native code via a _FAIL builtin and has not yet bailed,
-     * else garbage (NULL in debug builds).
-     */
-    js::TracerState     *tracerState;
-    js::VMSideExit      *bailExit;
-
-    /* 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;
-
-    /*
-     * There are 4 allocators here.  This might seem like overkill, but they
-     * have different lifecycles, and by keeping them separate we keep the
-     * amount of retained memory down significantly.  They are flushed (ie.
-     * all the allocated memory is freed) periodically.
-     *
-     * - dataAlloc has the lifecycle of the monitor.  It's flushed only when
-     *   the monitor is flushed.  It's used for fragments.
-     *
-     * - traceAlloc has the same flush lifecycle as the dataAlloc, but it is
-     *   also *marked* when a recording starts and rewinds to the mark point
-     *   if recording aborts.  So you can put things in it that are only
-     *   reachable on a successful record/compile cycle like GuardRecords and
-     *   SideExits.
-     *
-     * - tempAlloc is flushed after each recording, successful or not.  It's
-     *   used to store LIR code and for all other elements in the LIR
-     *   pipeline.
-     *
-     * - codeAlloc has the same lifetime as dataAlloc, but its API is
-     *   different (CodeAlloc vs. VMAllocator).  It's used for native code.
-     *   It's also a good idea to keep code and data separate to avoid I-cache
-     *   vs. D-cache issues.
-     */
-    VMAllocator*            dataAlloc;
-    VMAllocator*            traceAlloc;
-    VMAllocator*            tempAlloc;
-    nanojit::CodeAlloc*     codeAlloc;
-    nanojit::Assembler*     assembler;
-    FrameInfoCache*         frameCache;
-
-    /* This gets incremented every time the monitor is flushed. */
-    uintN                   flushEpoch;
-
-    Oracle*                 oracle;
-    TraceRecorder*          recorder;
-
-    /* If we are profiling a loop, this tracks the current profile. Otherwise NULL. */
-    LoopProfile*            profile;
-
-    GlobalState             globalStates[MONITOR_N_GLOBAL_STATES];
-    TreeFragment            *vmfragments[FRAGMENT_TABLE_SIZE];
-    RecordAttemptMap*       recordAttempts;
-
-    /* A hashtable mapping PC values to loop profiles for those loops. */
-    LoopProfileMap*         loopProfiles;
-
-    /*
-     * Maximum size of the code cache before we start flushing. 1/16 of this
-     * size is used as threshold for the regular expression code cache.
-     */
-    uint32                  maxCodeCacheBytes;
-
-    /*
-     * If nonzero, do not flush the JIT cache after a deep bail. That would
-     * free JITted code pages that we will later return to. Instead, set the
-     * needFlush flag so that it can be flushed later.
-     */
-    JSBool                  needFlush;
-
-    // Cached temporary typemap to avoid realloc'ing every time we create one.
-    // This must be used in only one place at a given time. It must be cleared
-    // before use.
-    TypeMap*                cachedTempTypeMap;
-
-    /* Scripts with recorded fragments. */
-    TracedScriptSet         tracedScripts;
-
-#ifdef DEBUG
-    /* Fields needed for fragment/guard profiling. */
-    nanojit::Seq<nanojit::Fragment*>* branches;
-    uint32                  lastFragID;
-    VMAllocator*            profAlloc;
-    FragStatsMap*           profTab;
-
-    void logFragProfile();
-#endif
-
-    TraceMonitor();
-    ~TraceMonitor();
-
-    bool init(JSRuntime* rt);
-
-    bool ontrace() const {
-        return !!tracecx;
-    }
-
-    /* Flush the JIT cache. */
-    void flush();
-
-    /* Sweep any cache entry pointing to dead GC things. */
-    void sweep(JSContext *cx);
-
-    /* Mark any tracer stacks that are active. */
-    void mark(JSTracer *trc);
-
-    bool outOfMemory() const;
-
-    JS_FRIEND_API(void) getCodeAllocStats(size_t &total, size_t &frag_size, size_t &free_size) const;
-    JS_FRIEND_API(size_t) getVMAllocatorsMainSize(JSUsableSizeFun usf) const;
-    JS_FRIEND_API(size_t) getVMAllocatorsReserveSize(JSUsableSizeFun usf) const;
-    JS_FRIEND_API(size_t) getTraceMonitorSize(JSUsableSizeFun usf) const;
-};
-
 namespace mjit {
 class JaegerCompartment;
 }
 
 /* Defined in jsapi.cpp */
 extern Class dummy_class;
 
 } /* namespace js */
@@ -619,39 +392,16 @@ struct JS_FRIEND_API(JSCompartment) {
     js::GCMarker *createBarrierTracer();
 
   public:
     js::WatchpointMap *watchpointMap;
 };
 
 #define JS_PROPERTY_TREE(cx)    ((cx)->compartment->propertyTree)
 
-/*
- * N.B. JS_ON_TRACE(cx) is true if JIT code is on the stack in the current
- * thread, regardless of whether cx is the context in which that trace is
- * executing. cx must be a context on the current thread.
- */
-static inline bool
-JS_ON_TRACE(const JSContext *cx)
-{
-    return false;
-}
-
-static inline js::TraceRecorder *
-TRACE_RECORDER(JSContext *cx)
-{
-    return NULL;
-}
-
-static inline js::LoopProfile *
-TRACE_PROFILER(JSContext *cx)
-{
-    return NULL;
-}
-
 namespace js {
 static inline MathCache *
 GetMathCache(JSContext *cx)
 {
     return cx->compartment->getMathCache(cx);
 }
 }
 
--- a/js/src/jsdate.cpp
+++ b/js/src/jsdate.cpp
@@ -2142,17 +2142,16 @@ date_toJSON(JSContext *cx, uintN argc, V
     /* Step 5. */
     if (!js_IsCallable(toISO)) {
         JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR, js_GetErrorMessage, NULL,
                                      JSMSG_BAD_TOISOSTRING_PROP);
         return false;
     }
 
     /* Step 6. */
-    LeaveTrace(cx);
     InvokeArgsGuard args;
     if (!cx->stack.pushInvokeArgs(cx, 0, &args))
         return false;
 
     args.calleev() = toISO;
     args.thisv().setObject(*obj);
 
     if (!Invoke(cx, args))
--- a/js/src/jsdbgapi.cpp
+++ b/js/src/jsdbgapi.cpp
@@ -725,18 +725,16 @@ JS_SetDestroyScriptHook(JSRuntime *rt, J
 /***************************************************************************/
 
 JS_PUBLIC_API(JSBool)
 JS_EvaluateUCInStackFrame(JSContext *cx, JSStackFrame *fpArg,
                           const jschar *chars, uintN length,
                           const char *filename, uintN lineno,
                           jsval *rval)
 {
-    JS_ASSERT_NOT_ON_TRACE(cx);
-
     if (!CheckDebugMode(cx))
         return false;
 
     JSObject *scobj = JS_GetFrameScopeChain(cx, fpArg);
     if (!scobj)
         return false;
 
     js::AutoCompartment ac(cx, scobj);
@@ -1084,18 +1082,16 @@ JS_GetGlobalDebugHooks(JSRuntime *rt)
 }
 
 const JSDebugHooks js_NullDebugHooks = {};
 
 JS_PUBLIC_API(JSDebugHooks *)
 JS_SetContextDebugHooks(JSContext *cx, const JSDebugHooks *hooks)
 {
     JS_ASSERT(hooks);
-    if (hooks != &cx->runtime->globalDebugHooks && hooks != &js_NullDebugHooks)
-        LeaveTrace(cx);
 
     JSDebugHooks *old = const_cast<JSDebugHooks *>(cx->debugHooks);
     cx->debugHooks = hooks;
     return old;
 }
 
 JS_PUBLIC_API(JSDebugHooks *)
 JS_ClearContextDebugHooks(JSContext *cx)
@@ -1606,465 +1602,16 @@ bool
 js_ResumeVtune()
 {
     VTResume();
     return true;
 }
 
 #endif /* MOZ_VTUNE */
 
-#ifdef MOZ_TRACEVIS
-/*
- * Ethogram - Javascript wrapper for TraceVis state
- *
- * ethology: The scientific study of animal behavior,
- *           especially as it occurs in a natural environment.
- * ethogram: A pictorial catalog of the behavioral patterns of
- *           an organism or a species.
- *
- */
-#if defined(XP_WIN)
-#include "jswin.h"
-#else
-#include <sys/time.h>
-#endif
-
-#define ETHOGRAM_BUF_SIZE 65536
-
-static JSBool
-ethogram_construct(JSContext *cx, uintN argc, jsval *vp);
-static void
-ethogram_finalize(JSContext *cx, JSObject *obj);
-
-static JSClass ethogram_class = {
-    "Ethogram",
-    JSCLASS_HAS_PRIVATE,
-    JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
-    JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, ethogram_finalize,
-    JSCLASS_NO_OPTIONAL_MEMBERS
-};
-
-struct EthogramEvent {
-    TraceVisState s;
-    TraceVisExitReason r;
-    int ts;
-    int tus;
-    JSString *filename;
-    int lineno;
-};
-
-static int
-compare_strings(const void *k1, const void *k2)
-{
-    return strcmp((const char *) k1, (const char *) k2) == 0;
-}
-
-class EthogramEventBuffer {
-private:
-    EthogramEvent mBuf[ETHOGRAM_BUF_SIZE];
-    int mReadPos;
-    int mWritePos;
-    JSObject *mFilenames;
-    int mStartSecond;
-
-    struct EthogramScriptEntry {
-        char *filename;
-        JSString *jsfilename;
-
-        EthogramScriptEntry *next;
-    };
-    EthogramScriptEntry *mScripts;
-
-public:
-    friend JSBool
-    ethogram_construct(JSContext *cx, uintN argc, jsval *vp);
-
-    inline void push(TraceVisState s, TraceVisExitReason r, char *filename, int lineno) {
-        mBuf[mWritePos].s = s;
-        mBuf[mWritePos].r = r;
-#if defined(XP_WIN)
-        FILETIME now;
-        GetSystemTimeAsFileTime(&now);
-        unsigned long long raw_us = 0.1 *
-            (((unsigned long long) now.dwHighDateTime << 32ULL) |
-             (unsigned long long) now.dwLowDateTime);
-        unsigned int sec = raw_us / 1000000L;
-        unsigned int usec = raw_us % 1000000L;
-        mBuf[mWritePos].ts = sec - mStartSecond;
-        mBuf[mWritePos].tus = usec;
-#else
-        struct timeval tv;
-        gettimeofday(&tv, NULL);
-        mBuf[mWritePos].ts = tv.tv_sec - mStartSecond;
-        mBuf[mWritePos].tus = tv.tv_usec;
-#endif
-
-        JSString *jsfilename = findScript(filename);
-        mBuf[mWritePos].filename = jsfilename;
-        mBuf[mWritePos].lineno = lineno;
-
-        mWritePos = (mWritePos + 1) % ETHOGRAM_BUF_SIZE;
-        if (mWritePos == mReadPos) {
-            mReadPos = (mWritePos + 1) % ETHOGRAM_BUF_SIZE;
-        }
-    }
-
-    inline EthogramEvent *pop() {
-        EthogramEvent *e = &mBuf[mReadPos];
-        mReadPos = (mReadPos + 1) % ETHOGRAM_BUF_SIZE;
-        return e;
-    }
-
-    bool isEmpty() {
-        return (mReadPos == mWritePos);
-    }
-
-    EthogramScriptEntry *addScript(JSContext *cx, JSObject *obj, char *filename, JSString *jsfilename) {
-        JSHashNumber hash = JS_HashString(filename);
-        JSHashEntry **hep = JS_HashTableRawLookup(traceVisScriptTable, hash, filename);
-        if (*hep != NULL)
-            return NULL;
-
-        JS_HashTableRawAdd(traceVisScriptTable, hep, hash, filename, this);
-
-        EthogramScriptEntry * entry = (EthogramScriptEntry *) JS_malloc(cx, sizeof(EthogramScriptEntry));
-        if (entry == NULL)
-            return NULL;
-
-        entry->next = mScripts;
-        mScripts = entry;
-        entry->filename = filename;
-        entry->jsfilename = jsfilename;
-
-        return mScripts;
-    }
-
-    void removeScripts(JSContext *cx) {
-        EthogramScriptEntry *se = mScripts;
-        while (se != NULL) {
-            char *filename = se->filename;
-
-            JSHashNumber hash = JS_HashString(filename);
-            JSHashEntry **hep = JS_HashTableRawLookup(traceVisScriptTable, hash, filename);
-            JSHashEntry *he = *hep;
-            if (he) {
-                /* we hardly knew he */
-                JS_HashTableRawRemove(traceVisScriptTable, hep, he);
-            }
-
-            EthogramScriptEntry *se_head = se;
-            se = se->next;
-            JS_free(cx, se_head);
-        }
-    }
-
-    JSString *findScript(char *filename) {
-        EthogramScriptEntry *se = mScripts;
-        while (se != NULL) {
-            if (compare_strings(se->filename, filename))
-                return (se->jsfilename);
-            se = se->next;
-        }
-        return NULL;
-    }
-
-    JSObject *filenames() {
-        return mFilenames;
-    }
-
-    int length() {
-        if (mWritePos < mReadPos)
-            return (mWritePos + ETHOGRAM_BUF_SIZE) - mReadPos;
-        else
-            return mWritePos - mReadPos;
-    }
-};
-
-static char jstv_empty[] = "<null>";
-
-inline char *
-jstv_Filename(StackFrame *fp)
-{
-    while (fp && !fp->isScriptFrame())
-        fp = fp->prev();
-    return (fp && fp->maybeScript() && fp->script()->filename)
-           ? (char *)fp->script()->filename
-           : jstv_empty;
-}
-inline uintN
-jstv_Lineno(JSContext *cx, StackFrame *fp)
-{
-    while (fp && fp->pcQuadratic(cx->stack) == NULL)
-        fp = fp->prev();
-    jsbytecode *pc = fp->pcQuadratic(cx->stack);
-    return (fp && pc) ? js_FramePCToLineNumber(cx, fp, pc) : 0;
-}
-
-/* Collect states here and distribute to a matching buffer, if any */
-JS_FRIEND_API(void)
-js::StoreTraceVisState(JSContext *cx, TraceVisState s, TraceVisExitReason r)
-{
-    StackFrame *fp = cx->fp();
-
-    char *script_file = jstv_Filename(fp);
-    JSHashNumber hash = JS_HashString(script_file);
-
-    JSHashEntry **hep = JS_HashTableRawLookup(traceVisScriptTable, hash, script_file);
-    /* update event buffer, flag if overflowed */
-    JSHashEntry *he = *hep;
-    if (he) {
-        EthogramEventBuffer *p;
-        p = (EthogramEventBuffer *) he->value;
-
-        p->push(s, r, script_file, jstv_Lineno(cx, fp));
-    }
-}
-
-static JSBool
-ethogram_construct(JSContext *cx, uintN argc, jsval *vp)
-{
-    EthogramEventBuffer *p;
-
-    p = (EthogramEventBuffer *) JS_malloc(cx, sizeof(EthogramEventBuffer));
-    if (!p)
-        return JS_FALSE;
-
-    p->mReadPos = p->mWritePos = 0;
-    p->mScripts = NULL;
-    p->mFilenames = JS_NewArrayObject(cx, 0, NULL);
-
-#if defined(XP_WIN)
-    FILETIME now;
-    GetSystemTimeAsFileTime(&now);
-    unsigned long long raw_us = 0.1 *
-        (((unsigned long long) now.dwHighDateTime << 32ULL) |
-         (unsigned long long) now.dwLowDateTime);
-    unsigned int s = raw_us / 1000000L;
-    p->mStartSecond = s;
-#else
-    struct timeval tv;
-    gettimeofday(&tv, NULL);
-    p->mStartSecond = tv.tv_sec;
-#endif
-    JSObject *obj;
-    if (JS_IsConstructing(cx, vp)) {
-        obj = JS_NewObject(cx, &ethogram_class, NULL, NULL);
-        if (!obj)
-            return JS_FALSE;
-    } else {
-        obj = JS_THIS_OBJECT(cx, vp);
-    }
-
-    jsval filenames = OBJECT_TO_JSVAL(p->filenames());
-    if (!JS_DefineProperty(cx, obj, "filenames", filenames,
-                           NULL, NULL, JSPROP_READONLY|JSPROP_PERMANENT))
-        return JS_FALSE;
-
-    JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
-    JS_SetPrivate(cx, obj, p);
-    return JS_TRUE;
-}
-
-static void
-ethogram_finalize(JSContext *cx, JSObject *obj)
-{
-    EthogramEventBuffer *p;
-    p = (EthogramEventBuffer *) JS_GetInstancePrivate(cx, obj, &ethogram_class, NULL);
-    if (!p)
-        return;
-
-    p->removeScripts(cx);
-
-    JS_free(cx, p);
-}
-
-static JSBool
-ethogram_addScript(JSContext *cx, uintN argc, jsval *vp)
-{
-    JSString *str;
-    char *filename = NULL;
-    jsval *argv = JS_ARGV(cx, vp);
-    JSObject *obj = JS_THIS_OBJECT(cx, vp);
-    if (!obj)
-        return false;
-    if (argc < 1) {
-        /* silently ignore no args */
-        JS_SET_RVAL(cx, vp, JSVAL_VOID);
-        return true;
-    }
-    if (JSVAL_IS_STRING(argv[0])) {
-        str = JSVAL_TO_STRING(argv[0]);
-        filename = DeflateString(cx, str->getChars(cx), str->length());
-        if (!filename)
-            return false;
-    }
-
-    EthogramEventBuffer *p = (EthogramEventBuffer *) JS_GetInstancePrivate(cx, obj, &ethogram_class, argv);
-
-    p->addScript(cx, obj, filename, str);
-    JS_SET_RVAL(cx, vp, JSVAL_VOID);
-    jsval dummy;
-    JS_CallFunctionName(cx, p->filenames(), "push", 1, argv, &dummy);
-    return true;
-}
-
-static JSBool
-ethogram_getAllEvents(JSContext *cx, uintN argc, jsval *vp)
-{
-    EthogramEventBuffer *p;
-    jsval *argv = JS_ARGV(cx, vp);
-
-    JSObject *obj = JS_THIS_OBJECT(cx, vp);
-    if (!obj)
-        return JS_FALSE;
-
-    p = (EthogramEventBuffer *) JS_GetInstancePrivate(cx, obj, &ethogram_class, argv);
-    if (!p)
-        return JS_FALSE;
-
-    if (p->isEmpty()) {
-        JS_SET_RVAL(cx, vp, JSVAL_NULL);
-        return JS_TRUE;
-    }
-
-    JSObject *rarray = JS_NewArrayObject(cx, 0, NULL);
-    if (rarray == NULL) {
-        JS_SET_RVAL(cx, vp, JSVAL_NULL);
-        return JS_TRUE;
-    }
-
-    JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(rarray));
-
-    for (uint32 i = 0; !p->isEmpty(); i++) {
-
-        JSObject *x = JS_NewObject(cx, NULL, NULL, NULL);
-        if (x == NULL)
-            return JS_FALSE;
-
-        EthogramEvent *e = p->pop();
-
-        jsval state = INT_TO_JSVAL(e->s);
-        jsval reason = INT_TO_JSVAL(e->r);
-        jsval ts = INT_TO_JSVAL(e->ts);
-        jsval tus = INT_TO_JSVAL(e->tus);
-
-        jsval filename = STRING_TO_JSVAL(e->filename);
-        jsval lineno = INT_TO_JSVAL(e->lineno);
-
-        if (!JS_SetProperty(cx, x, "state", &state))
-            return JS_FALSE;
-        if (!JS_SetProperty(cx, x, "reason", &reason))
-            return JS_FALSE;
-        if (!JS_SetProperty(cx, x, "ts", &ts))
-            return JS_FALSE;
-        if (!JS_SetProperty(cx, x, "tus", &tus))
-            return JS_FALSE;
-
-        if (!JS_SetProperty(cx, x, "filename", &filename))
-            return JS_FALSE;
-        if (!JS_SetProperty(cx, x, "lineno", &lineno))
-            return JS_FALSE;
-
-        jsval element = OBJECT_TO_JSVAL(x);
-        JS_SetElement(cx, rarray, i, &element);
-    }
-
-    return JS_TRUE;
-}
-
-static JSBool
-ethogram_getNextEvent(JSContext *cx, uintN argc, jsval *vp)
-{
-    EthogramEventBuffer *p;
-    jsval *argv = JS_ARGV(cx, vp);
-
-    JSObject *obj = JS_THIS_OBJECT(cx, vp);
-    if (!obj)
-        return JS_FALSE;
-
-    p = (EthogramEventBuffer *) JS_GetInstancePrivate(cx, obj, &ethogram_class, argv);
-    if (!p)
-        return JS_FALSE;
-
-    JSObject *x = JS_NewObject(cx, NULL, NULL, NULL);
-    if (x == NULL)
-        return JS_FALSE;
-
-    if (p->isEmpty()) {
-        JS_SET_RVAL(cx, vp, JSVAL_NULL);
-        return JS_TRUE;
-    }
-
-    EthogramEvent *e = p->pop();
-    jsval state = INT_TO_JSVAL(e->s);
-    jsval reason = INT_TO_JSVAL(e->r);
-    jsval ts = INT_TO_JSVAL(e->ts);
-    jsval tus = INT_TO_JSVAL(e->tus);
-
-    jsval filename = STRING_TO_JSVAL(e->filename);
-    jsval lineno = INT_TO_JSVAL(e->lineno);
-
-    if (!JS_SetProperty(cx, x, "state", &state))
-        return JS_FALSE;
-    if (!JS_SetProperty(cx, x, "reason", &reason))
-        return JS_FALSE;
-    if (!JS_SetProperty(cx, x, "ts", &ts))
-        return JS_FALSE;
-    if (!JS_SetProperty(cx, x, "tus", &tus))
-        return JS_FALSE;
-    if (!JS_SetProperty(cx, x, "filename", &filename))
-        return JS_FALSE;
-
-    if (!JS_SetProperty(cx, x, "lineno", &lineno))
-        return JS_FALSE;
-
-    JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(x));
-
-    return JS_TRUE;
-}
-
-static JSFunctionSpec ethogram_methods[] = {
-    JS_FN("addScript",    ethogram_addScript,    1,0),
-    JS_FN("getAllEvents", ethogram_getAllEvents, 0,0),
-    JS_FN("getNextEvent", ethogram_getNextEvent, 0,0),
-    JS_FS_END
-};
-
-/*
- * An |Ethogram| organizes the output of a collection of files that should be
- * monitored together. A single object gets events for the group.
- */
-JS_FRIEND_API(JSBool)
-js_InitEthogram(JSContext *cx, uintN argc, jsval *vp)
-{
-    if (!traceVisScriptTable) {
-        traceVisScriptTable = JS_NewHashTable(8, JS_HashString, compare_strings,
-                                         NULL, NULL, NULL);
-    }
-
-    JS_InitClass(cx, JS_GetGlobalObject(cx), NULL, &ethogram_class,
-                 ethogram_construct, 0, NULL, ethogram_methods,
-                 NULL, NULL);
-
-    JS_SET_RVAL(cx, vp, JSVAL_VOID);
-    return true;
-}
-
-JS_FRIEND_API(JSBool)
-js_ShutdownEthogram(JSContext *cx, uintN argc, jsval *vp)
-{
-    if (traceVisScriptTable)
-        JS_HashTableDestroy(traceVisScriptTable);
-
-    JS_SET_RVAL(cx, vp, JSVAL_VOID);
-    return true;
-}
-
-#endif /* MOZ_TRACEVIS */
-
 #ifdef MOZ_TRACE_JSCALLS
 
 JS_PUBLIC_API(void)
 JS_SetFunctionCallback(JSContext *cx, JSFunctionCallback fcb)
 {
     cx->functionCallback = fcb;
 }
 
--- a/js/src/jsdbgapi.h
+++ b/js/src/jsdbgapi.h
@@ -572,23 +572,16 @@ js_StopVtune();
 extern JS_FRIEND_API(bool)
 js_PauseVtune();
 
 extern JS_FRIEND_API(bool)
 js_ResumeVtune();
 
 #endif /* MOZ_VTUNE */
 
-#ifdef MOZ_TRACEVIS
-extern JS_FRIEND_API(JSBool)
-js_InitEthogram(JSContext *cx, uintN argc, jsval *vp);
-extern JS_FRIEND_API(JSBool)
-js_ShutdownEthogram(JSContext *cx, uintN argc, jsval *vp);
-#endif /* MOZ_TRACEVIS */
-
 #ifdef MOZ_TRACE_JSCALLS
 typedef void (*JSFunctionCallback)(const JSFunction *fun,
                                    const JSScript *scr,
                                    const JSContext *cx,
                                    int entering);
 
 /*
  * The callback is expected to be quick and noninvasive. It should not
--- a/js/src/jsfun.cpp
+++ b/js/src/jsfun.cpp
@@ -257,18 +257,16 @@ args_delProperty(JSContext *cx, JSObject
         argsobj->asNormalArguments()->clearCallee();
     }
     return true;
 }
 
 static JSBool
 ArgGetter(JSContext *cx, JSObject *obj, jsid id, Value *vp)
 {
-    LeaveTrace(cx);
-
     if (!obj->isNormalArguments())
         return true;
 
     NormalArgumentsObject *argsobj = obj->asNormalArguments();
     if (JSID_IS_INT(id)) {
         /*
          * arg can exceed the number of arguments if a script changed the
          * prototype to point to another Arguments object with a bigger argc.
@@ -389,18 +387,16 @@ args_enumerate(JSContext *cx, JSObject *
             return false;
     }
     return true;
 }
 
 static JSBool
 StrictArgGetter(JSContext *cx, JSObject *obj, jsid id, Value *vp)
 {
-    LeaveTrace(cx);
-
     if (!obj->isStrictArguments())
         return true;
 
     StrictArgumentsObject *argsobj = obj->asStrictArguments();
 
     if (JSID_IS_INT(id)) {
         /*
          * arg can exceed the number of arguments if a script changed the
@@ -543,21 +539,16 @@ MaybeMarkGenerator(JSTracer *trc, JSObje
         MarkObject(trc, js_FloatingFrameToGenerator(fp)->obj, "generator object");
 #endif
 }
 
 static void
 args_trace(JSTracer *trc, JSObject *obj)
 {
     ArgumentsObject *argsobj = obj->asArguments();
-    if (argsobj->onTrace()) {
-        JS_ASSERT(!argsobj->isStrictArguments());
-        return;
-    }
-
     ArgumentsData *data = argsobj->data();
     MarkValue(trc, data->callee, js_callee_str);
     MarkValueRange(trc, argsobj->initialLength(), data->slots, js_arguments_str);
 
     MaybeMarkGenerator(trc, argsobj);
 }
 
 /*
@@ -2431,17 +2422,16 @@ js_ValueToCallableObject(JSContext *cx, 
 }
 
 void
 js_ReportIsNotFunction(JSContext *cx, const Value *vp, uintN flags)
 {
     const char *name = NULL, *source = NULL;
     AutoValueRooter tvr(cx);
     uintN error = (flags & JSV2F_CONSTRUCT) ? JSMSG_NOT_CONSTRUCTOR : JSMSG_NOT_FUNCTION;
-    LeaveTrace(cx);
 
     /*
      * We try to the print the code that produced vp if vp is a value in the
      * most recent interpreted stack frame. Note that additional values, not
      * directly produced by the script, may have been pushed onto the frame's
      * expression stack (e.g. by pushInvokeArgs) thereby incrementing sp past
      * the depth simulated by ReconstructPCStack.
      *
--- a/js/src/jsgc.cpp
+++ b/js/src/jsgc.cpp
@@ -1627,17 +1627,17 @@ RunLastDitchGC(JSContext *cx)
         cx->runtime->gcHelperThread.waitBackgroundSweepEnd();
     }
 #endif
 }
 
 inline bool
 IsGCAllowed(JSContext *cx)
 {
-    return !JS_ON_TRACE(cx) && !JS_THREAD_DATA(cx)->waiveGCQuota;
+    return !JS_THREAD_DATA(cx)->waiveGCQuota;
 }
 
 /* static */ void *
 ArenaLists::refillFreeList(JSContext *cx, AllocKind thingKind)
 {
     JS_ASSERT(cx->compartment->arenas.freeLists[thingKind].isEmpty());
 
     JSCompartment *comp = cx->compartment;
@@ -2951,21 +2951,16 @@ js_GC(JSContext *cx, JSCompartment *comp
      * Don't collect garbage if the runtime isn't up, and cx is not the last
      * context in the runtime.  The last context must force a GC, and nothing
      * should suppress that final collection or there may be shutdown leaks,
      * or runtime bloat until the next context is created.
      */
     if (rt->state != JSRTS_UP && gckind != GC_LAST_CONTEXT)
         return;
 
-    if (JS_ON_TRACE(cx)) {
-        JS_ASSERT(gckind != GC_LAST_CONTEXT);
-        return;
-    }
-
 #ifdef JS_GC_ZEAL
     struct AutoVerifyBarriers {
         JSContext *cx;
         bool inVerify;
         AutoVerifyBarriers(JSContext *cx) : cx(cx), inVerify(cx->runtime->gcVerifyData) {
             if (inVerify) EndVerifyBarriers(cx);
         }
         ~AutoVerifyBarriers() { if (inVerify) StartVerifyBarriers(cx); }
@@ -3027,17 +3022,16 @@ class AutoCopyFreeListToArenas {
             c->arenas.clearFreeListsInArenas();
     }
 };
 
 void
 TraceRuntime(JSTracer *trc)
 {
     JS_ASSERT(!IS_GC_MARKING_TRACER(trc));
-    LeaveTrace(trc->context);
 
 #ifdef JS_THREADSAFE
     {
         JSContext *cx = trc->context;
         JSRuntime *rt = cx->runtime;
         if (rt->gcThread != cx->thread()) {
             AutoLockGC lock(rt);
             AutoGCSession gcsession(cx);
@@ -3093,17 +3087,16 @@ struct IterateCellCallbackOp
 
 void
 IterateCompartmentsArenasCells(JSContext *cx, void *data,
                                IterateCompartmentCallback compartmentCallback,
                                IterateArenaCallback arenaCallback,
                                IterateCellCallback cellCallback)
 {
     CHECK_REQUEST(cx);
-    LeaveTrace(cx);
 
     JSRuntime *rt = cx->runtime;
     JS_ASSERT(!rt->gcRunning);
 
     AutoLockGC lock(rt);
     AutoGCSession gcsession(cx);
 #ifdef JS_THREADSAFE
     rt->gcHelperThread.waitBackgroundSweepEnd();
@@ -3124,17 +3117,16 @@ IterateCompartmentsArenasCells(JSContext
     }
 }
 
 void
 IterateChunks(JSContext *cx, void *data, IterateChunkCallback chunkCallback)
 {
     /* :XXX: Any way to common this preamble with IterateCompartmentsArenasCells? */
     CHECK_REQUEST(cx);
-    LeaveTrace(cx);
 
     JSRuntime *rt = cx->runtime;
     JS_ASSERT(!rt->gcRunning);
 
     AutoLockGC lock(rt);
     AutoGCSession gcsession(cx);
 #ifdef JS_THREADSAFE
     rt->gcHelperThread.waitBackgroundSweepEnd();
@@ -3147,18 +3139,16 @@ IterateChunks(JSContext *cx, void *data,
 
 void
 IterateCells(JSContext *cx, JSCompartment *compartment, AllocKind thingKind,
              void *data, IterateCellCallback cellCallback)
 {
     /* :XXX: Any way to common this preamble with IterateCompartmentsArenasCells? */
     CHECK_REQUEST(cx);
 
-    LeaveTrace(cx);
-
     JSRuntime *rt = cx->runtime;
     JS_ASSERT(!rt->gcRunning);
 
     AutoLockGC lock(rt);
     AutoGCSession gcsession(cx);
 #ifdef JS_THREADSAFE
     rt->gcHelperThread.waitBackgroundSweepEnd();
 #endif
@@ -3366,18 +3356,16 @@ NextNode(VerifyNode *node)
 static void
 StartVerifyBarriers(JSContext *cx)
 {
     JSRuntime *rt = cx->runtime;
 
     if (rt->gcVerifyData)
         return;
 
-    LeaveTrace(cx);
-
     AutoLockGC lock(rt);
     AutoGCSession gcsession(cx);
 
 #ifdef JS_THREADSAFE
     rt->gcHelperThread.waitBackgroundSweepOrAllocEnd();
 #endif
 
     AutoUnlockGC unlock(rt);
@@ -3493,18 +3481,16 @@ CheckEdge(JSTracer *jstrc, void *thing, 
             return;
         }
     }
 }
 
 static void
 EndVerifyBarriers(JSContext *cx)
 {
-    LeaveTrace(cx);
-
     JSRuntime *rt = cx->runtime;
 
     AutoLockGC lock(rt);
     AutoGCSession gcsession(cx);
 
 #ifdef JS_THREADSAFE
     rt->gcHelperThread.waitBackgroundSweepOrAllocEnd();
 #endif
--- a/js/src/jsinterp.cpp
+++ b/js/src/jsinterp.cpp
@@ -266,19 +266,16 @@ GetScopeChainFull(JSContext *cx, StackFr
          * Don't force a call object for a lightweight function call, but do
          * insist that there is a call object for a heavyweight function call.
          */
         JS_ASSERT_IF(fp->isNonEvalFunctionFrame() && fp->fun()->isHeavyweight(),
                      fp->hasCallObj());
         return &fp->scopeChain();
     }
 
-    /* We don't handle cloning blocks on trace.  */
-    LeaveTrace(cx);
-
     /*
      * We have one or more lexical scopes to reflect into fp->scopeChain, so
      * make sure there's a call object at the current head of the scope chain,
      * if this frame is a call frame.
      *
      * Also, identify the innermost compiler-allocated block we needn't clone.
      */
     JSObject *limitBlock, *limitClone;
@@ -699,18 +696,16 @@ js::InvokeConstructor(JSContext *cx, con
     *rval = args.rval();
     return true;
 }
 
 bool
 js::InvokeGetterOrSetter(JSContext *cx, JSObject *obj, const Value &fval, uintN argc, Value *argv,
                          Value *rval)
 {
-    LeaveTrace(cx);
-
     /*
      * Invoke could result in another try to get or set the same id again, see
      * bug 355497.
      */
     JS_CHECK_RECURSION(cx, return false);
 
     return Invoke(cx, ObjectValue(*obj), fval, argc, argv, rval);
 }
@@ -750,18 +745,16 @@ js::ExecuteKernel(JSContext *cx, JSScrip
     JS_ASSERT_IF(evalInFrame, type == EXECUTE_DEBUG);
 
     if (script->isEmpty()) {
         if (result)
             result->setUndefined();
         return true;
     }
 
-    LeaveTrace(cx);
-
     ExecuteFrameGuard efg;
     if (!cx->stack.pushExecuteFrame(cx, script, thisv, scopeChain, type, evalInFrame, &efg))
         return false;
 
     /* Give strict mode eval its own fresh lexical environment. */
     StackFrame *fp = efg.fp();
     if (fp->isStrictEvalFrame() && !CreateEvalCallObject(cx, fp))
         return false;
@@ -1511,18 +1504,16 @@ JS_STATIC_ASSERT(JSOP_INITPROP_LENGTH ==
 JS_STATIC_ASSERT(JSOP_IFNE_LENGTH == JSOP_IFEQ_LENGTH);
 JS_STATIC_ASSERT(JSOP_IFNE == JSOP_IFEQ + 1);
 
 /* For the fastest case inder JSOP_INCNAME, etc. */
 JS_STATIC_ASSERT(JSOP_INCNAME_LENGTH == JSOP_DECNAME_LENGTH);
 JS_STATIC_ASSERT(JSOP_INCNAME_LENGTH == JSOP_NAMEINC_LENGTH);
 JS_STATIC_ASSERT(JSOP_INCNAME_LENGTH == JSOP_NAMEDEC_LENGTH);
 
-# define ABORT_RECORDING(cx, reason)    ((void) 0)
-
 /*
  * Inline fast paths for iteration. js_IteratorMore and js_IteratorNext handle
  * all cases, but we inline the most frequently taken paths here.
  */
 static inline bool
 IteratorMore(JSContext *cx, JSObject *iterobj, bool *cond, Value *rval)
 {
     if (iterobj->isIterator()) {
@@ -1571,19 +1562,16 @@ TypeCheckNextBytecode(JSContext *cx, JSS
         TypeScript::CheckBytecode(cx, script, regs.pc, regs.sp);
     }
 #endif
 }
 
 JS_NEVER_INLINE bool
 js::Interpret(JSContext *cx, StackFrame *entryFrame, InterpMode interpMode)
 {
-#ifdef MOZ_TRACEVIS
-    TraceVisStateObj tvso(cx, S_INTERP);
-#endif
     JSAutoResolveFlags rf(cx, RESOLVE_INFER);
 
     gc::VerifyBarriers(cx, true);
 
     JS_ASSERT(!cx->compartment->activeAnalysis);
 
 #if JS_THREADED_INTERP
 #define CHECK_PCCOUNT_INTERRUPTS() JS_ASSERT_IF(script->pcCounters, jumpTable == interruptJumpTable)
@@ -1609,56 +1597,51 @@ js::Interpret(JSContext *cx, StackFrame 
 # undef OPDEF
     };
 
     register void * const *jumpTable = normalJumpTable;
 
     typedef GenericInterruptEnabler<void * const *> InterruptEnabler;
     InterruptEnabler interruptEnabler(&jumpTable, interruptJumpTable);
 
-#  define CHECK_RECORDER()  ((void)0)
-
 # define DO_OP()            JS_BEGIN_MACRO                                    \
-                                CHECK_RECORDER();                             \
                                 CHECK_PCCOUNT_INTERRUPTS();                   \
                                 js::gc::VerifyBarriers(cx);                   \
                                 JS_EXTENSION_(goto *jumpTable[op]);           \
                             JS_END_MACRO
 # define DO_NEXT_OP(n)      JS_BEGIN_MACRO                                    \
                                 TypeCheckNextBytecode(cx, script, n, regs);   \
                                 op = (JSOp) *(regs.pc += (n));                \
                                 DO_OP();                                      \
                             JS_END_MACRO
 
-# define BEGIN_CASE(OP)     L_##OP: CHECK_RECORDER();
+# define BEGIN_CASE(OP)     L_##OP:
 # define END_CASE(OP)       DO_NEXT_OP(OP##_LENGTH);
 # define END_VARLEN_CASE    DO_NEXT_OP(len);
 # define ADD_EMPTY_CASE(OP) BEGIN_CASE(OP)                                    \
                                 JS_ASSERT(js_CodeSpec[OP].length == 1);       \
                                 op = (JSOp) *++regs.pc;                       \
                                 DO_OP();
 
 # define END_EMPTY_CASES
 
 #else /* !JS_THREADED_INTERP */
 
     register intN switchMask = 0;
     intN switchOp;
     typedef GenericInterruptEnabler<intN> InterruptEnabler;
     InterruptEnabler interruptEnabler(&switchMask, -1);
 
-#  define CHECK_RECORDER()  ((void)0)
-
 # define DO_OP()            goto do_op
 # define DO_NEXT_OP(n)      JS_BEGIN_MACRO                                    \
                                 JS_ASSERT((n) == len);                        \
                                 goto advance_pc;                              \
                             JS_END_MACRO
 
-# define BEGIN_CASE(OP)     case OP: CHECK_RECORDER();
+# define BEGIN_CASE(OP)     case OP:
 # define END_CASE(OP)       END_CASE_LEN(OP##_LENGTH)
 # define END_CASE_LEN(n)    END_CASE_LENX(n)
 # define END_CASE_LENX(n)   END_CASE_LEN##n
 
 /*
  * To share the code for all len == 1 cases we use the specialized label with
  * code that falls through to advance_pc: .
  */
@@ -1875,17 +1858,16 @@ js::Interpret(JSContext *cx, StackFrame 
       advance_pc_by_one:
         JS_ASSERT(js_CodeSpec[op].length == 1);
         len = 1;
       advance_pc:
         regs.pc += len;
         op = (JSOp) *regs.pc;
 
       do_op:
-        CHECK_RECORDER();
         CHECK_PCCOUNT_INTERRUPTS();
         js::gc::VerifyBarriers(cx);
         switchOp = intN(op) | switchMask;
       do_switch:
         switch (switchOp) {
 #endif
 
 #if JS_THREADED_INTERP
@@ -1924,20 +1906,16 @@ js::Interpret(JSContext *cx, StackFrame 
                 cx->setPendingException(rval);
                 goto error;
               default:;
             }
             moreInterrupts = true;
         }
 
 #if JS_THREADED_INTERP
-#ifdef MOZ_TRACEVIS
-        if (!moreInterrupts)
-            ExitTraceVisState(cx, R_ABORT);
-#endif
         jumpTable = moreInterrupts ? interruptJumpTable : normalJumpTable;
         JS_EXTENSION_(goto *normalJumpTable[op]);
 #else
         switchMask = moreInterrupts ? -1 : 0;
         switchOp = intN(op);
         goto do_switch;
 #endif
     }
@@ -3564,17 +3542,16 @@ BEGIN_CASE(JSOP_SETMETHOD)
                 defineHow = DNP_CACHE_RESULT | DNP_UNQUALIFIED;
             else
                 defineHow = DNP_CACHE_RESULT;
             if (!js_SetPropertyHelper(cx, obj, id, defineHow, &rval, script->strictModeCode))
                 goto error;
         } else {
             if (!obj->setGeneric(cx, id, &rval, script->strictModeCode))
                 goto error;
-            ABORT_RECORDING(cx, "Non-native set");
         }
     } while (0);
 }
 END_SET_CASE_STORE_RVAL(JSOP_SETPROP, 2);
 
 BEGIN_CASE(JSOP_GETELEM)
 {
     Value &lref = regs.sp[-2];
@@ -3802,17 +3779,17 @@ BEGIN_CASE(JSOP_FUNAPPLY)
     if (!newType) {
         /* Try to ensure methods are method JIT'd.  */
         mjit::CompileRequest request = (interpMode == JSINTERP_NORMAL)
                                        ? mjit::CompileRequest_Interpreter
                                        : mjit::CompileRequest_JIT;
         mjit::CompileStatus status = mjit::CanMethodJIT(cx, script, construct, request);
         if (status == mjit::Compile_Error)
             goto error;
-        if (!TRACE_RECORDER(cx) && !TRACE_PROFILER(cx) && status == mjit::Compile_Okay) {
+        if (status == mjit::Compile_Okay) {
             mjit::JaegerStatus status = mjit::JaegerShot(cx, true);
             CHECK_PARTIAL_METHODJIT(status);
             interpReturnOK = (status == mjit::Jaeger_Returned);
             CHECK_INTERRUPT_HANDLER();
             goto jit_return;
         }
     }
 #endif
@@ -4553,20 +4530,16 @@ BEGIN_CASE(JSOP_LAMBDA)
             if (fun->joinable()) {
                 jsbytecode *pc2 = AdvanceOverBlockchainOp(regs.pc + JSOP_LAMBDA_LENGTH);
                 JSOp op2 = JSOp(*pc2);
 
                 /*
                  * Optimize var obj = {method: function () { ... }, ...},
                  * this.method = function () { ... }; and other significant
                  * single-use-of-null-closure bytecode sequences.
-                 *
-                 * WARNING: code in TraceRecorder::record_JSOP_LAMBDA must
-                 * match the optimization cases in the following code that
-                 * break from the outer do-while(0).
                  */
                 if (op2 == JSOP_INITMETHOD) {
 #ifdef DEBUG
                     const Value &lref = regs.sp[-1];
                     JS_ASSERT(lref.isObject());
                     JSObject *obj2 = &lref.toObject();
                     JS_ASSERT(obj2->isObject());
 #endif
--- a/js/src/jsiter.cpp
+++ b/js/src/jsiter.cpp
@@ -364,17 +364,16 @@ GetCustomIterator(JSContext *cx, JSObjec
         vp->setUndefined();
         return true;
     }
 
     if (!cx->runningWithTrustedPrincipals())
         ++sCustomIteratorCount;
 
     /* Otherwise call it and return that object. */
-    LeaveTrace(cx);
     Value arg = BooleanValue((flags & JSITER_FOREACH) == 0);
     if (!Invoke(cx, ObjectValue(*obj), *vp, 1, &arg, vp))
         return false;
     if (vp->isPrimitive()) {
         /*
          * We are always coming from js_ValueToIterator, and we are no longer on
          * trace, so the object we are iterating over is on top of the stack (-1).
          */
@@ -1391,18 +1390,16 @@ CloseGenerator(JSContext *cx, JSObject *
 }
 
 /*
  * Common subroutine of generator_(next|send|throw|close) methods.
  */
 static JSBool
 generator_op(JSContext *cx, Native native, JSGeneratorOp op, Value *vp, uintN argc)
 {
-    LeaveTrace(cx);
-
     CallArgs args = CallArgsFromVp(argc, vp);
 
     bool ok;
     JSObject *obj = NonGenericMethodGuard(cx, args, native, &GeneratorClass, &ok);
     if (!obj)
         return ok;
 
     JSGenerator *gen = (JSGenerator *) obj->getPrivate();
--- a/js/src/jsobj.cpp
+++ b/js/src/jsobj.cpp
@@ -3121,18 +3121,16 @@ Detecting(JSContext *cx, jsbytecode *pc)
  * Infer lookup flags from the currently executing bytecode. This does
  * not attempt to infer JSRESOLVE_WITH, because the current bytecode
  * does not indicate whether we are in a with statement. Return defaultFlags
  * if a currently executing bytecode cannot be determined.
  */
 uintN
 js_InferFlags(JSContext *cx, uintN defaultFlags)
 {
-    JS_ASSERT_NOT_ON_TRACE(cx);
-
     const JSCodeSpec *cs;
     uint32 format;
     uintN flags = 0;
 
     jsbytecode *pc;
     JSScript *script = cx->stack.currentScript(&pc);
     if (!script || !pc)
         return defaultFlags;
@@ -4423,18 +4421,17 @@ JSObject::allocSlots(JSContext *cx, size
 
             type()->newScript->allocKind = kind;
             type()->newScript->shape = obj->lastProperty();
             type()->markStateChange(cx);
         }
     }
 
     if (newcap > NSLOTS_LIMIT) {
-        if (!JS_ON_TRACE(cx))
-            js_ReportAllocationOverflow(cx);
+        js_ReportAllocationOverflow(cx);
         return false;
     }
 
     uint32 allocCount = numDynamicSlots(newcap);
 
     HeapValue *tmpslots = (HeapValue*) cx->malloc_(allocCount * sizeof(HeapValue));
     if (!tmpslots)
         return false;  /* Leave slots at inline buffer. */
@@ -4932,25 +4929,16 @@ PurgeProtoChain(JSContext *cx, JSObject 
         if (!obj->isNative()) {
             obj = obj->getProto();
             continue;
         }
         shape = obj->nativeLookup(cx, id);
         if (shape) {
             PCMETER(JS_PROPERTY_CACHE(cx).pcpurges++);
             obj->shadowingShapeChange(cx, *shape);
-
-            if (!obj->getParent()) {
-                /*
-                 * All scope chains end in a global object, so this will change
-                 * the global shape. jstracer.cpp assumes that the global shape
-                 * never changes on trace, so we must deep-bail here.
-                 */
-                LeaveTrace(cx);
-            }
             return JS_TRUE;
         }
         obj = obj->getProto();
     }
     return JS_FALSE;
 }
 
 void
@@ -5070,17 +5058,16 @@ namespace js {
 
 const Shape *
 DefineNativeProperty(JSContext *cx, JSObject *obj, jsid id, const Value &value,
                      PropertyOp getter, StrictPropertyOp setter, uintN attrs,
                      uintN flags, intN shortid, uintN defineHow /* = 0 */)
 {
     JS_ASSERT((defineHow & ~(DNP_CACHE_RESULT | DNP_DONT_PURGE |
                              DNP_SET_METHOD | DNP_SKIP_TYPE)) == 0);
-    LeaveTraceIfGlobalObject(cx, obj);
 
     /* Convert string indices to integers if appropriate. */
     id = js_CheckForStringIndex(id);
 
     /*
      * If defining a getter or setter, we must check for its counterpart and
      * update the attributes and property ops.  A getter or setter is really
      * only half of a property.
@@ -5235,17 +5222,16 @@ DefineNativeProperty(JSContext *cx, JSOb
 
     /* XXXbe called with lock held */
     if (!CallAddPropertyHook(cx, clasp, obj, shape, &valueCopy)) {
         obj->removeProperty(cx, id);
         return NULL;
     }
 
     if (defineHow & DNP_CACHE_RESULT) {
-        JS_ASSERT_NOT_ON_TRACE(cx);
         if (adding)
             JS_PROPERTY_CACHE(cx).fill(cx, obj, 0, obj, shape, true);
     }
     return shape;
 }
 
 } /* namespace js */
 
@@ -5435,17 +5421,16 @@ PropertyCacheEntry *
 js_FindPropertyHelper(JSContext *cx, jsid id, bool cacheResult, bool global,
                       JSObject **objp, JSObject **pobjp, JSProperty **propp)
 {
     JSObject *scopeChain, *obj, *parent, *pobj;
     PropertyCacheEntry *entry;
     int scopeIndex;
     JSProperty *prop;
 
-    JS_ASSERT_IF(cacheResult, !JS_ON_TRACE(cx));
     scopeChain = cx->stack.currentScriptedScopeChain();
 
     if (global) {
         /*
          * Skip along the scope chain to the enclosing global object. This is
          * used for GNAME opcodes where the bytecode emitter has determined a
          * name access must be on the global. It also insulates us from bugs
          * in the emitter: type inference will assume that GNAME opcodes are
@@ -5550,17 +5535,16 @@ js_FindProperty(JSContext *cx, jsid id, 
 JSObject *
 js_FindIdentifierBase(JSContext *cx, JSObject *scopeChain, jsid id)
 {
     /*
      * This function should not be called for a global object or from the
      * trace and should have a valid cache entry for native scopeChain.
      */
     JS_ASSERT(scopeChain->getParent());
-    JS_ASSERT(!JS_ON_TRACE(cx));
 
     JSObject *obj = scopeChain;
 
     /*
      * Loop over cacheable objects on the scope chain until we find a
      * property. We also stop when we reach the global object skipping any
      * farther checks or lookups. For details see the JSOP_BINDNAME case of
      * js_Interpret.
@@ -5614,18 +5598,16 @@ js_FindIdentifierBase(JSContext *cx, JSO
     } while (obj->getParent());
     return obj;
 }
 
 static JS_ALWAYS_INLINE JSBool
 js_NativeGetInline(JSContext *cx, JSObject *receiver, JSObject *obj, JSObject *pobj,
                    const Shape *shape, uintN getHow, Value *vp)
 {
-    LeaveTraceIfGlobalObject(cx, pobj);
-
     uint32 slot;
     int32 sample;
 
     JS_ASSERT(pobj->isNative());
 
     slot = shape->slot;
     if (slot != SHAPE_INVALID_SLOT) {
         *vp = pobj->nativeGetSlot(slot);
@@ -5671,18 +5653,16 @@ js_NativeGet(JSContext *cx, JSObject *ob
              Value *vp)
 {
     return js_NativeGetInline(cx, obj, obj, pobj, shape, getHow, vp);
 }
 
 JSBool
 js_NativeSet(JSContext *cx, JSObject *obj, const Shape *shape, bool added, bool strict, Value *vp)
 {
-    LeaveTraceIfGlobalObject(cx, obj);
-
     AddTypePropertyId(cx, obj, shape->propid, *vp);
 
     uint32 slot;
     int32 sample;
 
     JS_ASSERT(obj->isNative());
 
     slot = shape->slot;
@@ -5733,18 +5713,16 @@ js_NativeSet(JSContext *cx, JSObject *ob
 static JS_ALWAYS_INLINE JSBool
 js_GetPropertyHelperInline(JSContext *cx, JSObject *obj, JSObject *receiver, jsid id,
                            uint32 getHow, Value *vp)
 {
     JSObject *aobj, *obj2;
     JSProperty *prop;
     const Shape *shape;
 
-    JS_ASSERT_IF(getHow & JSGET_CACHE_RESULT, !JS_ON_TRACE(cx));
-
     /* Convert string indices to integers if appropriate. */
     id = js_CheckForStringIndex(id);
 
     aobj = js_GetProtoIfDenseArray(obj);
     /* This call site is hot -- use the always-inlined variant of LookupPropertyWithFlags(). */
     if (!LookupPropertyWithFlagsInline(cx, aobj, id, cx->resolveFlags, &obj2, &prop))
         return false;
 
@@ -5765,20 +5743,18 @@ js_GetPropertyHelperInline(JSContext *cx
          * object foo with no property named 'bar'.
          */
         jsbytecode *pc;
         if (vp->isUndefined() && ((pc = js_GetCurrentBytecodePC(cx)) != NULL)) {
             JSOp op;
             uintN flags;
 
             op = (JSOp) *pc;
-            if (op == JSOP_TRAP) {
-                JS_ASSERT_NOT_ON_TRACE(cx);
+            if (op == JSOP_TRAP)
                 op = JS_GetTrapOpcode(cx, cx->fp()->script(), pc);
-            }
             if (op == JSOP_GETXPROP) {
                 flags = JSREPORT_ERROR;
             } else {
                 if (!cx->hasStrictOption() ||
                     cx->stack.currentScript()->warnedAboutUndefinedProp ||
                     (op != JSOP_GETPROP && op != JSOP_GETELEM)) {
                     return JS_TRUE;
                 }
@@ -5787,17 +5763,16 @@ js_GetPropertyHelperInline(JSContext *cx
                  * XXX do not warn about missing __iterator__ as the function
                  * may be called from JS_GetMethodById. See bug 355145.
                  */
                 if (JSID_IS_ATOM(id, cx->runtime->atomState.iteratorAtom))
                     return JS_TRUE;
 
                 /* Do not warn about tests like (obj[prop] == undefined). */
                 if (cx->resolveFlags == RESOLVE_INFER) {
-                    LeaveTrace(cx);
                     pc += js_CodeSpec[op].length;
                     if (Detecting(cx, pc))
                         return JS_TRUE;
                 } else if (cx->resolveFlags & JSRESOLVE_DETECTING) {
                     return JS_TRUE;
                 }
 
                 flags = JSREPORT_WARNING | JSREPORT_STRICT;
@@ -5817,20 +5792,18 @@ js_GetPropertyHelperInline(JSContext *cx
     if (!obj2->isNative()) {
         return obj2->isProxy()
                ? Proxy::get(cx, obj2, receiver, id, vp)
                : obj2->getGeneric(cx, id, vp);
     }
 
     shape = (Shape *) prop;
 
-    if (getHow & JSGET_CACHE_RESULT) {
-        JS_ASSERT_NOT_ON_TRACE(cx);
+    if (getHow & JSGET_CACHE_RESULT)
         JS_PROPERTY_CACHE(cx).fill(cx, aobj, 0, obj2, shape);
-    }
 
     /* This call site is hot -- use the always-inlined variant of js_NativeGet(). */
     if (!js_NativeGetInline(cx, receiver, obj, obj2, shape, getHow, vp))
         return JS_FALSE;
 
     return JS_TRUE;
 }
 
@@ -5977,18 +5950,16 @@ js_SetPropertyHelper(JSContext *cx, JSOb
     uintN attrs, flags;
     intN shortid;
     Class *clasp;
     PropertyOp getter;
     StrictPropertyOp setter;
     bool added;
 
     JS_ASSERT((defineHow & ~(DNP_CACHE_RESULT | DNP_SET_METHOD | DNP_UNQUALIFIED)) == 0);
-    if (defineHow & DNP_CACHE_RESULT)
-        JS_ASSERT_NOT_ON_TRACE(cx);
 
     /* Convert string indices to integers if appropriate. */
     id = js_CheckForStringIndex(id);
 
     if (JS_UNLIKELY(obj->watched())) {
         /* Fire watchpoints, if any. */
         WatchpointMap *wpmap = cx->compartment->watchpointMap;
         if (wpmap && !wpmap->triggerWatchpoint(cx, obj, id, vp))
--- a/js/src/jsobj.h
+++ b/js/src/jsobj.h
@@ -57,18 +57,16 @@
 #include "jspubtd.h"
 #include "jsprvtd.h"
 #include "jslock.h"
 #include "jscell.h"
 
 #include "gc/Barrier.h"
 #include "vm/String.h"
 
-namespace nanojit { class ValidateWriter; }
-
 namespace js {
 
 class AutoPropDescArrayRooter;
 class ProxyHandler;
 class CallObject;
 struct GCMarker;
 struct NativeIterator;
 
@@ -408,25 +406,16 @@ class RegExpObject;
  * dynamic slots pointer is used if those fixed slots overflow, and stores all
  * remaining slots. The dynamic slots pointer is NULL if there is no slots
  * overflow, and never points to the object's fixed slots. Unlike dense arrays,
  * the fixed slots can always be accessed. Two objects with the same shape are
  * guaranteed to have the same number of fixed slots.
  */
 struct JSObject : js::gc::Cell {
     /*
-     * TraceRecorder must be a friend because it generates code that
-     * manipulates JSObjects, which requires peeking under any encapsulation.
-     * ValidateWriter must be a friend because it works in tandem with
-     * TraceRecorder.
-     */
-    friend class js::TraceRecorder;
-    friend class nanojit::ValidateWriter;
-
-    /*
      * Private pointer to the last added property and methods to manipulate the
      * list it links among properties in this scope.
      */
     js::HeapPtrShape    lastProp;
 
   private:
     js::Class           *clasp;
 
--- a/js/src/json.cpp
+++ b/js/src/json.cpp
@@ -339,17 +339,16 @@ PreprocessValue(JSContext *cx, JSObject 
     /* Step 3. */
     if (scx->replacer && scx->replacer->isCallable()) {
         if (!keyStr) {
             keyStr = KeyStringifier<KeyType>::toString(cx, key);
             if (!keyStr)
                 return false;
         }
 
-        LeaveTrace(cx);
         InvokeArgsGuard args;
         if (!cx->stack.pushInvokeArgs(cx, 2, &args))
             return false;
 
         args.calleev() = ObjectValue(*scx->replacer);
         args.thisv() = ObjectValue(*holder);
         args[0] = StringValue(keyStr);
         args[1] = *vp;
@@ -856,17 +855,16 @@ Walk(JSContext *cx, JSObject *holder, js
         }
     }
 
     /* Step 3. */
     JSString *key = IdToString(cx, name);
     if (!key)
         return false;
 
-    LeaveTrace(cx);
     InvokeArgsGuard args;
     if (!cx->stack.pushInvokeArgs(cx, 2, &args))
         return false;
 
     args.calleev() = reviver;
     args.thisv() = ObjectValue(*holder);
     args[0] = StringValue(key);
     args[1] = val;
--- a/js/src/jsopcode.cpp
+++ b/js/src/jsopcode.cpp
@@ -5149,18 +5149,16 @@ js_DecompileValueGenerator(JSContext *cx
     StackFrame *fp;
     JSScript *script;
     jsbytecode *pc;
 
     JS_ASSERT(spindex < 0 ||
               spindex == JSDVG_IGNORE_STACK ||
               spindex == JSDVG_SEARCH_STACK);
 
-    LeaveTrace(cx);
-    
     if (!cx->hasfp() || !cx->fp()->isScriptFrame())
         goto do_fallback;
 
     fp = js_GetTopStackFrame(cx, FRAME_EXPAND_ALL);
     script = fp->script();
     pc = cx->regs().pc;
     JS_ASSERT(script->code <= pc && pc < script->code + script->length);
 
--- a/js/src/jsprvtd.h
+++ b/js/src/jsprvtd.h
@@ -150,18 +150,16 @@ enum RegExpExecType
     RegExpTest
 };
 
 class AutoStringRooter;
 class ExecuteArgsGuard;
 class InvokeFrameGuard;
 class InvokeArgsGuard;
 class StringBuffer;
-class TraceRecorder;
-struct TraceMonitor;
 
 class FrameRegs;
 class StackFrame;
 class StackSegment;
 class StackSpace;
 class ContextStack;
 class FrameRegsIter;
 class CallReceiver;
--- a/js/src/jsscope.cpp
+++ b/js/src/jsscope.cpp
@@ -1142,17 +1142,16 @@ JSObject::clear(JSContext *cx)
 
     /*
      * We have rewound to a uniquely-shaped empty scope, so we don't need an
      * override for this object's shape.
      */
     clearOwnShape();
     setMap(shape);
 
-    LeaveTraceIfGlobalObject(cx, this);
     JS_ATOMIC_INCREMENT(&cx->runtime->propertyRemovals);
     CHECK_SHAPE_CONSISTENCY(this);
 }
 
 void
 JSObject::rollbackProperties(JSContext *cx, uint32 slotSpan)
 {
     /* Remove properties from this object until it has a matching slot span. */
--- a/js/src/jsscopeinlines.h
+++ b/js/src/jsscopeinlines.h
@@ -117,17 +117,16 @@ js::types::TypeObject::canProvideEmptySh
 {
     return proto && !singleton && (!emptyShapes || emptyShapes[0]->getClass() == aclasp);
 }
 
 inline void
 JSObject::updateShape(JSContext *cx)
 {
     JS_ASSERT(isNative());
-    js::LeaveTraceIfGlobalObject(cx, this);
     if (hasOwnShape())
         setOwnShape(js_GenerateShape(cx));
     else
         objShape = lastProp->shapeid;
 }
 
 inline void
 JSObject::updateFlags(const js::Shape *shape, bool isDefinitelyAtom)
--- a/js/src/jsutil.h
+++ b/js/src/jsutil.h
@@ -375,26 +375,20 @@ enum MaybeReportError { REPORT_ERROR = t
 /* Trigger a control flow check to make sure that code flows through label */
 inline __attribute__ ((unused)) void MUST_FLOW_THROUGH(const char *label) {}
 
 /* Avoid unused goto-label warnings. */
 # define MUST_FLOW_LABEL(label) goto label; label:
 
 inline JS_FORCES_STACK void VOUCH_DOES_NOT_REQUIRE_STACK() {}
 
-inline JS_FORCES_STACK void
-JS_ASSERT_NOT_ON_TRACE(JSContext *cx)
-{
-    JS_ASSERT(!JS_ON_TRACE(cx));
-}
 #else
 # define MUST_FLOW_THROUGH(label)            ((void) 0)
 # define MUST_FLOW_LABEL(label)
 # define VOUCH_DOES_NOT_REQUIRE_STACK()      ((void) 0)
-# define JS_ASSERT_NOT_ON_TRACE(cx)          JS_ASSERT(!JS_ON_TRACE(cx))
 #endif
 
 /* Crash diagnostics */
 #ifdef DEBUG
 # define JS_CRASH_DIAGNOSTICS 1
 #endif
 #ifdef JS_CRASH_DIAGNOSTICS
 # define JS_POISON(p, val, size) memset((p), (val), (size))
--- a/js/src/jswrapper.cpp
+++ b/js/src/jswrapper.cpp
@@ -415,17 +415,16 @@ ForceFrame::~ForceFrame()
 }
 
 bool
 ForceFrame::enter()
 {
     frame = context->new_<DummyFrameGuard>();
     if (!frame)
        return false;
-    LeaveTrace(context);
 
     JS_ASSERT(context->compartment == target->compartment());
     JSCompartment *destination = context->compartment;
 
     JSObject *scopeChain = target->getGlobal();
     JS_ASSERT(scopeChain->isNative());
 
     return context->stack.pushDummyFrame(context, destination, *scopeChain, frame);
@@ -446,18 +445,16 @@ AutoCompartment::~AutoCompartment()
         leave();
 }
 
 bool
 AutoCompartment::enter()
 {
     JS_ASSERT(!entered);
     if (origin != destination) {
-        LeaveTrace(context);
-
         JSObject *scopeChain = target->getGlobal();
         JS_ASSERT(scopeChain->isNative());
 
         frame.construct();
         if (!context->stack.pushDummyFrame(context, destination, *scopeChain, &frame.ref()))
             return false;
 
         if (context->isExceptionPending())
--- a/js/src/jsxml.cpp
+++ b/js/src/jsxml.cpp
@@ -1787,17 +1787,16 @@ ParseXMLSource(JSContext *cx, JSString *
         return NULL;
     }
     js_strncpy(chars + offset, srcp, srclen);
     offset += srclen;
     dstlen = length - offset + 1;
     InflateStringToBuffer(cx, suffix, constrlen(suffix), chars + offset, &dstlen);
     chars [offset + dstlen] = 0;
 
-    LeaveTrace(cx);
     xml = NULL;
     filename = NULL;
     lineno = 1;
     FrameRegsIter i(cx);
     if (!i.done()) {
         op = (JSOp) *i.pc();
         if (op == JSOP_TOXML || op == JSOP_TOXMLLIST) {
             filename = i.fp()->script()->filename;
@@ -7955,17 +7954,16 @@ Class js_XMLFilterClass = {
 JSBool
 js_StepXMLListFilter(JSContext *cx, JSBool initialized)
 {
     jsval *sp;
     JSObject *obj, *filterobj, *resobj, *kidobj;
     JSXML *xml, *list;
     JSXMLFilter *filter;
 
-    LeaveTrace(cx);
     sp = cx->regs().sp;
     if (!initialized) {
         /*
          * We haven't iterated yet, so initialize the filter based on the
          * value stored in sp[-2].
          */
         if (!VALUE_IS_XML(sp[-2])) {
             js_ReportValueError(cx, JSMSG_NON_XML_FILTER, -2, sp[-2], NULL);
--- a/js/src/methodjit/MonoIC.cpp
+++ b/js/src/methodjit/MonoIC.cpp
@@ -1293,18 +1293,16 @@ ic::SplatApplyArgs(VMFrame &f)
     }
 
     /* Steps 4-5. */
     JSObject *aobj = &vp[3].toObject();
     jsuint length;
     if (!js_GetLengthProperty(cx, aobj, &length))
         THROWV(false);
 
-    JS_ASSERT(!JS_ON_TRACE(cx));
-
     /* Step 6. */
     if (length > StackSpace::ARGS_LENGTH_MAX) {
         JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL,
                              JSMSG_TOO_MANY_FUN_APPLY_ARGS);
         THROWV(false);
     }
 
     intN delta = length - 1;
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -150,17 +150,16 @@ static jsuword gStackBase;
 /*
  * Limit the timeout to 30 minutes to prevent an overflow on platfoms
  * that represent the time internally in microseconds using 32-bit int.
  */
 static jsdouble MAX_TIMEOUT_INTERVAL = 1800.0;
 static jsdouble gTimeoutInterval = -1.0;
 static volatile bool gCanceled = false;
 
-static bool enableTraceJit = false;
 static bool enableMethodJit = false;
 static bool enableProfiling = false;
 static bool enableTypeInference = false;
 static bool enableDisassemblyDumps = false;
 
 static bool printTiming = false;
 
 static JSBool
@@ -4942,18 +4941,16 @@ NewContext(JSRuntime *rt)
         DestroyContext(cx, false);
         return NULL;
     }
 
     JS_SetContextPrivate(cx, data);
     JS_SetErrorReporter(cx, my_ErrorReporter);
     JS_SetVersion(cx, JSVERSION_LATEST);
     SetContextOptions(cx);
-    if (enableTraceJit)
-        JS_ToggleOptions(cx, JSOPTION_JIT);
     if (enableMethodJit)
         JS_ToggleOptions(cx, JSOPTION_METHODJIT);
     if (enableTypeInference)
         JS_ToggleOptions(cx, JSOPTION_TYPE_INFERENCE);
     return cx;
 }
 
 static void
@@ -5060,21 +5057,16 @@ ProcessArgs(JSContext *cx, JSObject *obj
         JS_ToggleOptions(cx, JSOPTION_METHODJIT);
     }
 
 #ifdef JS_GC_ZEAL
     if (const char *zeal = op->getStringOption('Z'))
         ParseZealArg(cx, zeal);
 #endif
 
-    if (op->getBoolOption('j')) {
-        enableTraceJit = true;
-        JS_ToggleOptions(cx, JSOPTION_JIT);
-    }
-    
     if (op->getBoolOption('p')) {
         enableProfiling = true;
         JS_ToggleOptions(cx, JSOPTION_PROFILING);
     }
 
     if (op->getBoolOption('d')) {
         JS_SetRuntimeDebugMode(JS_GetRuntime(cx), true);
         JS_SetDebugMode(cx, true);
@@ -5249,17 +5241,16 @@ JSPrincipals shellTrustedPrincipals = {
     NULL, /* nobody should be destroying this */
     ShellPrincipalsSubsume
 };
 
 JSBool
 CheckObjectAccess(JSContext *cx, JSObject *obj, jsid id, JSAccessMode mode,
                   jsval *vp)
 {
-    LeaveTrace(cx);
     return true;
 }
 
 JSSecurityCallbacks securityCallbacks = {
     CheckObjectAccess,
     NULL,
     NULL,
     NULL
@@ -5326,17 +5317,17 @@ main(int argc, char **argv, char **envp)
     op.setDescriptionWidth(72);
     op.setHelpWidth(80);
     op.setVersion(JS_GetImplementationVersion());
 
     if (!op.addMultiStringOption('f', "file", "PATH", "File path to run")
         || !op.addMultiStringOption('e', "execute", "CODE", "Inline code to run")
         || !op.addBoolOption('i', "shell", "Enter prompt after running code")
         || !op.addBoolOption('m', "methodjit", "Enable the JaegerMonkey method JIT")
-        || !op.addBoolOption('j', "tracejit", "Enable the JaegerMonkey trace JIT")
+        || !op.addBoolOption('j', "tracejit", "Deprecated; does nothing")
         || !op.addBoolOption('p', "profiling", "Enable runtime profiling select JIT mode")
         || !op.addBoolOption('n', "typeinfer", "Enable type inference")
         || !op.addBoolOption('d', "debugjit", "Enable runtime debug mode for method JIT code")
         || !op.addBoolOption('a', "always-mjit",
                              "Do not try to run in the interpreter before "
                              "method jitting. Note that this has no particular effect on the "
                              "tracer; it still kicks in if enabled.")
         || !op.addBoolOption('D', "dump-bytecode", "Dump bytecode with exec count for all scripts")
--- a/js/src/tests/browser.js
+++ b/js/src/tests/browser.js
@@ -218,17 +218,16 @@ function optionsInit() {
 
   // hash containing the set options.
   options.currvalues = {
     strict:     true,
     werror:     true,
     atline:     true,
     xml:        true,
     relimit:    true,
-    tracejit:   true,
     methodjit:  true,
     jitprofiling: true,
     methodjit_always: true
   };
 
   // record initial values to support resetting
   // options to their initial values
   options.initvalues = {};
@@ -258,23 +257,16 @@ function optionsInit() {
 function gczeal(z)
 {
   netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
   Components.utils.setGCZeal(z);
 }
 
 function jit(on)
 {
-  // XXX do what shell.js does, namely equate "jit" with "tracejit"
-  // only
-  netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
-  var tracejitEnabled = Components.utils.tracejit;
-  if ((on && !tracejitEnabled) ||
-      (!on && tracejitEnabled))
-    options('tracejit');
 }
 
 function jsTestDriverBrowserInit()
 {
 
   if (typeof dump != 'function')
   {
     dump = print;
--- a/js/src/tests/shell.js
+++ b/js/src/tests/shell.js
@@ -644,17 +644,16 @@ function optionsClear() {
   // turn off current settings
   // except jit.
   var optionNames = options().split(',');
   for (var i = 0; i < optionNames.length; i++)
   {
     var optionName = optionNames[i];
     if (optionName &&
         optionName != "methodjit" &&
-        optionName != "tracejit" &&
         optionName != "jitprofiling" &&
         optionName != "methodjit_always")
     {
       options(optionName);
     }
   }
 }
 
@@ -873,24 +872,16 @@ function jsTestDriverEnd()
   {
     gTestcases[i].dump();
   }
 
 }
 
 function jit(on)
 {
-  if (on && !options().match(/tracejit/))
-  {
-    options('tracejit');
-  }
-  else if (!on && options().match(/tracejit/))
-  {
-    options('tracejit');
-  }
 }
 
 /*
  * Some tests need to know if we are in Rhino as opposed to SpiderMonkey
  */
 function inRhino()
 {
   return (typeof defineClass == "function");
--- a/js/src/tests/user.js
+++ b/js/src/tests/user.js
@@ -23,17 +23,15 @@ user_pref("security.warn_leaving_secure"
 user_pref("security.warn_submit_insecure", false);
 user_pref("security.warn_viewing_mixed", false);
 user_pref("signed.applets.codebase_principal_support", true);
 user_pref("browser.warnOnQuit", false);
 user_pref("browser.cache.check_doc_frequency", 1);
 user_pref("extensions.checkCompatibility", false);
 user_pref("extensions.checkUpdateSecurity", false);
 user_pref("browser.EULA.override", true);
-user_pref("javascript.options.tracejit.chrome", false);
-user_pref("javascript.options.tracejit.content", false);
 user_pref("javascript.options.methodjit.chrome", true);
 user_pref("javascript.options.methodjit.content", true);
 user_pref("javascript.options.jitprofiling.chrome", true);
 user_pref("javascript.options.jitprofiling.content", true);
 user_pref("javascript.options.methodjit_always", false);
 user_pref("javascript.options.strict", false);
 user_pref("javascript.options.werror", false);
--- a/js/src/vm/ArgumentsObject-inl.h
+++ b/js/src/vm/ArgumentsObject-inl.h
@@ -116,35 +116,16 @@ ArgumentsObject::maybeStackFrame() const
 }
 
 inline void
 ArgumentsObject::setStackFrame(StackFrame *frame)
 {
     return setPrivate(frame);
 }
 
-#define JS_ARGUMENTS_OBJECT_ON_TRACE ((void *)0xa126)
-inline bool
-ArgumentsObject::onTrace() const
-{
-    return getPrivate() == JS_ARGUMENTS_OBJECT_ON_TRACE;
-}
-
-inline void
-ArgumentsObject::setOnTrace()
-{
-    return setPrivate(JS_ARGUMENTS_OBJECT_ON_TRACE);
-}
-
-inline void
-ArgumentsObject::clearOnTrace()
-{
-    return setPrivate(NULL);
-}
-
 inline const js::Value &
 NormalArgumentsObject::callee() const
 {
     return data()->callee;
 }
 
 inline void
 NormalArgumentsObject::clearCallee()
--- a/js/src/vm/ArgumentsObject.h
+++ b/js/src/vm/ArgumentsObject.h
@@ -197,28 +197,21 @@ class ArgumentsObject : public ::JSObjec
 
     inline const js::Value &element(uint32 i) const;
     inline const js::Value *elements() const;
     inline void setElement(uint32 i, const js::Value &v);
 
     /* The stack frame for this ArgumentsObject, if the frame is still active. */
     inline js::StackFrame *maybeStackFrame() const;
     inline void setStackFrame(js::StackFrame *frame);
-
-    inline bool onTrace() const;
-    inline void setOnTrace();
-    inline void clearOnTrace();
 };
 
 /*
  * Non-strict arguments have a private: the function's stack frame until the
- * function returns, when it is replaced with null.  When an arguments object
- * is created on-trace its private is JS_ARGUMENTS_OBJECT_ON_TRACE, and when
- * the trace exits its private is replaced with the stack frame or null, as
- * appropriate.
+ * function returns, when it is replaced with null.
  */
 class NormalArgumentsObject : public ArgumentsObject
 {
     friend bool JSObject::isNormalArguments() const;
     friend struct EmptyShape; // for EmptyShape::getEmptyArgumentsShape
     friend ArgumentsObject *
     ArgumentsObject::create(JSContext *cx, uint32 argc, JSObject &callee);
 
--- a/js/src/vm/RegExpObject-inl.h
+++ b/js/src/vm/RegExpObject-inl.h
@@ -345,17 +345,17 @@ detail::RegExpPrivate::create(JSContext 
     return RetType(priv);
 }
 
 /* This function should be deleted once bad Android platforms phase out. See bug 604774. */
 inline bool
 detail::RegExpPrivateCode::isJITRuntimeEnabled(JSContext *cx)
 {
 #if defined(ANDROID) && defined(JS_METHODJIT)
-    return cx->traceJitEnabled || cx->methodJitEnabled;
+    return cx->methodJitEnabled;
 #else
     return true;
 #endif
 }
 
 inline bool
 detail::RegExpPrivateCode::compile(JSContext *cx, JSLinearString &pattern, TokenStream *ts,
                                    uintN *parenCount, RegExpFlag flags)
--- a/js/src/vm/Stack-inl.h
+++ b/js/src/vm/Stack-inl.h
@@ -668,23 +668,16 @@ ArgumentsObject::getElement(uint32 i, Va
     /*
      * If the argument was overwritten, it could be in any object slot, so we
      * can't optimize.
      */
     if (vp->isMagic(JS_ARGS_HOLE))
         return false;
 
     /*
-     * If this arguments object was created on trace the actual argument value
-     * could be in a register or something, so we can't optimize.
-     */
-    if (onTrace())
-        return false;
-
-    /*
      * If this arguments object has an associated stack frame, that contains
      * the canonical argument value.  Note that strict arguments objects do not
      * alias named arguments and never have a stack frame.
      */
     StackFrame *fp = maybeStackFrame();
     JS_ASSERT_IF(isStrictArguments(), !fp);
     if (fp)
         *vp = fp->canonicalActualArg(i);
@@ -710,19 +703,15 @@ ArgumentsObject::getElements(uint32 star
         for (Value *dst = vp; src < srcend; ++dst, ++src) {
             if (src->isMagic(JS_ARGS_HOLE))
                 return false;
             *dst = *src;
         }
         return true;
     }
 
-    /* If we're on trace, there's no canonical location for elements: fail. */
-    if (onTrace())
-        return false;
-
     /* Otherwise, element values are on the stack. */
     JS_ASSERT(fp->numActualArgs() <= StackSpace::ARGS_LENGTH_MAX);
     return fp->forEachCanonicalActualArg(detail::CopyNonHoleArgsTo(this, vp), start, count);
 }
 
 } /* namespace js */
 #endif /* Stack_inl_h__ */
--- a/js/src/vm/Stack.cpp
+++ b/js/src/vm/Stack.cpp
@@ -639,17 +639,16 @@ ContextStack::popSegment()
 
     if (!seg_)
         cx_->maybeMigrateVersionOverride();
 }
 
 bool
 ContextStack::pushInvokeArgs(JSContext *cx, uintN argc, InvokeArgsGuard *iag)
 {
-    LeaveTrace(cx);
     JS_ASSERT(argc <= StackSpace::ARGS_LENGTH_MAX);
 
     uintN nvars = 2 + argc;
     Value *firstUnused = ensureOnTop(cx, REPORT_ERROR, nvars, CAN_EXTEND, &iag->pushedSeg_);
     if (!firstUnused)
         return false;
 
     ImplicitCast<CallArgs>(*iag) = CallArgsFromVp(argc, firstUnused);
@@ -1091,18 +1090,16 @@ StackIter::settleOnNewState()
 StackIter::StackIter(JSContext *cx, SavedOption savedOption)
   : cx_(cx),
     savedOption_(savedOption)
 {
 #ifdef JS_METHODJIT
     mjit::ExpandInlineFrames(cx->compartment);
 #endif
 
-    LeaveTrace(cx);
-
     if (StackSegment *seg = cx->stack.seg_) {
         startOnSegment(seg);
         settleOnNewState();
     } else {
         state_ = DONE;
     }
 }
 
--- a/js/src/vm/String-inl.h
+++ b/js/src/vm/String-inl.h
@@ -75,26 +75,16 @@ JSString::needWriteBarrierPre(JSCompartm
     return false;
 #endif
 }
 
 JS_ALWAYS_INLINE bool
 JSString::validateLength(JSContext *cx, size_t length)
 {
     if (JS_UNLIKELY(length > JSString::MAX_LENGTH)) {
-        if (JS_ON_TRACE(cx)) {
-            /*
-             * If we can't leave the trace, signal OOM condition, otherwise
-             * exit from trace before throwing.
-             */
-            if (!js::CanLeaveTrace(cx))
-                return NULL;
-
-            js::LeaveTrace(cx);
-        }
         js_ReportAllocationOverflow(cx);
         return false;
     }
 
     return true;
 }
 
 JS_ALWAYS_INLINE void