Bug 1103269 - Remove the jscall tracer infrastructure; r=sfink
authorTerrence Cole <terrence@mozilla.com>
Thu, 04 Dec 2014 09:41:02 -0800
changeset 218362 f1d6929bde76393df7dabf148fbf63dbc0878c2b
parent 218361 f3fa77b9e07b189c3c76c8c88f9270fd4200e154
child 218363 d0e4a8a2ecaa1b07d8bb45515e6f57fba7182f3d
push id52513
push usertcole@mozilla.com
push dateThu, 04 Dec 2014 17:49:21 +0000
treeherdermozilla-inbound@f1d6929bde76 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssfink
bugs1103269
milestone37.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1103269 - Remove the jscall tracer infrastructure; r=sfink
configure.in
js/src/builtin/TestingFunctions.cpp
js/src/configure.in
js/src/jsapi-tests/moz.build
js/src/jsapi-tests/testFuncCallback.cpp
js/src/jsapi.cpp
js/src/jsapi.h
js/src/jscntxt.cpp
js/src/jscntxt.h
js/src/vm/Probes-inl.h
--- a/configure.in
+++ b/configure.in
@@ -7287,27 +7287,16 @@ if test "$OS_TARGET" = Android; then
         MOZ_GLUE_WRAP_LDFLAGS="${MOZ_GLUE_WRAP_LDFLAGS} -Wl,--wrap=pthread_create,--wrap=epoll_wait,--wrap=poll,--wrap=pthread_cond_timedwait,--wrap=__pthread_cond_timedwait,--wrap=pthread_cond_wait,--wrap=epoll_create,--wrap=epoll_ctl,--wrap=close,--wrap=pthread_key_create,--wrap=pthread_key_delete,--wrap=socketpair,--wrap=pthread_self,--wrap=pthread_mutex_lock,--wrap=pthread_join,--wrap=pipe,--wrap=pipe2"
     fi
 fi
 
 AC_SUBST_LIST(MOZ_GLUE_WRAP_LDFLAGS)
 export MOZ_GLUE_WRAP_LDFLAGS
 
 dnl ========================================================
-dnl = Use JS Call tracing
-dnl ========================================================
-MOZ_ARG_ENABLE_BOOL(trace-jscalls,
-[  --enable-trace-jscalls  Enable JS call enter/exit callback (default=no)],
-    MOZ_TRACE_JSCALLS=1,
-    MOZ_TRACE_JSCALLS= )
-if test -n "$MOZ_TRACE_JSCALLS"; then
-    AC_DEFINE(MOZ_TRACE_JSCALLS)
-fi
-
-dnl ========================================================
 dnl JS opt-mode assertions and minidump instrumentation
 dnl ========================================================
 MOZ_ARG_ENABLE_BOOL(js-diagnostics,
 [  --enable-js-diagnostics
                           Enable JS diagnostic assertions and breakpad data],
     JS_CRASH_DIAGNOSTICS=1,
     JS_CRASH_DIAGNOSTICS= )
 if test -n "$JS_CRASH_DIAGNOSTICS"; then
--- a/js/src/builtin/TestingFunctions.cpp
+++ b/js/src/builtin/TestingFunctions.cpp
@@ -58,16 +58,19 @@ GetBuildConfiguration(JSContext *cx, uns
         return false;
 
     if (!JS_SetProperty(cx, info, "rooting-analysis", FalseHandleValue))
         return false;
 
     if (!JS_SetProperty(cx, info, "exact-rooting", TrueHandleValue))
         return false;
 
+    if (!JS_SetProperty(cx, info, "trace-jscalls-api", FalseHandleValue))
+        return false;
+
     RootedValue value(cx);
 #ifdef DEBUG
     value = BooleanValue(true);
 #else
     value = BooleanValue(false);
 #endif
     if (!JS_SetProperty(cx, info, "debug", value))
         return false;
@@ -139,24 +142,16 @@ GetBuildConfiguration(JSContext *cx, uns
 #ifdef INCLUDE_MOZILLA_DTRACE
     value = BooleanValue(true);
 #else
     value = BooleanValue(false);
 #endif
     if (!JS_SetProperty(cx, info, "dtrace", value))
         return false;
 
-#ifdef MOZ_TRACE_JSCALLS
-    value = BooleanValue(true);
-#else
-    value = BooleanValue(false);
-#endif
-    if (!JS_SetProperty(cx, info, "trace-jscalls-api", value))
-        return false;
-
 #ifdef JSGC_INCREMENTAL
     value = BooleanValue(true);
 #else
     value = BooleanValue(false);
 #endif
     if (!JS_SetProperty(cx, info, "incremental-gc", value))
         return false;
 
--- a/js/src/configure.in
+++ b/js/src/configure.in
@@ -3128,27 +3128,16 @@ fi
 dnl ========================================================
 dnl = Location of malloc wrapper lib
 dnl ========================================================
 MOZ_ARG_WITH_STRING(wrap-malloc,
 [  --with-wrap-malloc=DIR  Location of malloc wrapper library],
     WRAP_LDFLAGS="${WRAP_LDFLAGS} $withval")
 
 dnl ========================================================
-dnl = Use JS Call tracing
-dnl ========================================================
-MOZ_ARG_ENABLE_BOOL(trace-jscalls,
-[  --enable-trace-jscalls  Enable JS call enter/exit callback (default=no)],
-    MOZ_TRACE_JSCALLS=1,
-    MOZ_TRACE_JSCALLS= )
-if test -n "$MOZ_TRACE_JSCALLS"; then
-    AC_DEFINE(MOZ_TRACE_JSCALLS)
-fi
-
-dnl ========================================================
 dnl = Use incremental GC
 dnl ========================================================
 JSGC_INCREMENTAL=1
 MOZ_ARG_DISABLE_BOOL(gcincremental,
 [  --disable-gcincremental Disable incremental GC],
     JSGC_INCREMENTAL= )
 if test -n "$JSGC_INCREMENTAL"; then
     AC_DEFINE(JSGC_INCREMENTAL)
--- a/js/src/jsapi-tests/moz.build
+++ b/js/src/jsapi-tests/moz.build
@@ -26,17 +26,16 @@ UNIFIED_SOURCES += [
     'testDefinePropertyIgnoredAttributes.cpp',
     'testEnclosingFunction.cpp',
     'testErrorCopying.cpp',
     'testException.cpp',
     'testExternalStrings.cpp',
     'testFindSCCs.cpp',
     'testForOfIterator.cpp',
     'testFreshGlobalEvalRedefinition.cpp',
-    'testFuncCallback.cpp',
     'testFunctionProperties.cpp',
     'testGCAllocator.cpp',
     'testGCChunkPool.cpp',
     'testGCExactRooting.cpp',
     'testGCFinalizeCallback.cpp',
     'testGCHeapPostBarriers.cpp',
     'testGCMarking.cpp',
     'testGCOutOfMemory.cpp',
deleted file mode 100644
--- a/js/src/jsapi-tests/testFuncCallback.cpp
+++ /dev/null
@@ -1,141 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "jsapi-tests/tests.h"
-
-#ifdef MOZ_TRACE_JSCALLS
-
-static int depth = 0;
-static int enters = 0;
-static int leaves = 0;
-static int interpreted = 0;
-
-static void
-funcTransition(const JSFunction *,
-               const JSScript *,
-               const JSContext *cx,
-               int entering)
-{
-    if (entering > 0) {
-        ++depth;
-        ++enters;
-        ++interpreted;
-    } else {
-        --depth;
-        ++leaves;
-    }
-}
-
-static bool called2 = false;
-
-static void
-funcTransition2(const JSFunction *, const JSScript*, const JSContext*, int)
-{
-    called2 = true;
-}
-
-static int overlays = 0;
-static JSFunctionCallback innerCallback = nullptr;
-static void
-funcTransitionOverlay(const JSFunction *fun,
-                      const JSScript *script,
-                      const JSContext *cx,
-                      int entering)
-{
-    (*innerCallback)(fun, script, cx, entering);
-    overlays++;
-}
-#endif
-
-BEGIN_TEST(testFuncCallback_bug507012)
-{
-#ifdef MOZ_TRACE_JSCALLS
-    // Call funcTransition() whenever a Javascript method is invoked
-    JS_SetFunctionCallback(cx, funcTransition);
-
-    EXEC("x = 0; function f (n) { if (n > 1) { f(n - 1); } }");
-    interpreted = enters = leaves = depth = 0;
-
-    // Check whether JS_Execute() tracking works
-    EXEC("42");
-    CHECK_EQUAL(enters, 1);
-    CHECK_EQUAL(leaves, 1);
-    CHECK_EQUAL(depth, 0);
-    interpreted = enters = leaves = depth = 0;
-
-    // Check whether the basic function tracking works
-    EXEC("f(1)");
-    CHECK_EQUAL(enters, 1+1);
-    CHECK_EQUAL(leaves, 1+1);
-    CHECK_EQUAL(depth, 0);
-
-    // Can we switch to a different callback?
-    enters = 777;
-    JS_SetFunctionCallback(cx, funcTransition2);
-    EXEC("f(1)");
-    CHECK(called2);
-    CHECK_EQUAL(enters, 777);
-
-    // Check whether we can turn off function tracing
-    JS_SetFunctionCallback(cx, nullptr);
-    EXEC("f(1)");
-    CHECK_EQUAL(enters, 777);
-    interpreted = enters = leaves = depth = 0;
-
-    // Check nested invocations
-    JS_SetFunctionCallback(cx, funcTransition);
-    enters = leaves = depth = 0;
-    EXEC("f(3)");
-    CHECK_EQUAL(enters, 1+3);
-    CHECK_EQUAL(leaves, 1+3);
-    CHECK_EQUAL(depth, 0);
-    interpreted = enters = leaves = depth = 0;
-
-    // Check calls invoked while running on trace -- or now, perhaps on
-    // IonMonkey's equivalent, if it ever starts to exist?
-    EXEC("function g () { ++x; }");
-    interpreted = enters = leaves = depth = 0;
-    EXEC("for (i = 0; i < 5000; ++i) { g(); }");
-    CHECK_EQUAL(enters, 1+5000);
-    CHECK_EQUAL(leaves, 1+5000);
-    CHECK_EQUAL(depth, 0);
-
-    // Test nesting callbacks via JS_GetFunctionCallback()
-    JS_SetFunctionCallback(cx, funcTransition);
-    innerCallback = JS_GetFunctionCallback(cx);
-    JS_SetFunctionCallback(cx, funcTransitionOverlay);
-
-    EXEC("x = 0; function f (n) { if (n > 1) { f(n - 1); } }");
-    interpreted = enters = leaves = depth = overlays = 0;
-
-    EXEC("42.5");
-    CHECK_EQUAL(enters, 1);
-    CHECK_EQUAL(leaves, 1);
-    CHECK_EQUAL(depth, 0);
-    CHECK_EQUAL(overlays, enters + leaves);
-    interpreted = enters = leaves = depth = overlays = 0;
-#endif
-
-    // Uncomment this to validate whether you're hitting all runmodes (interp,
-    // mjit, ...?) Unfortunately, that still doesn't cover all
-    // transitions between the various runmodes, but it's a start.
-    //JS_DumpAllProfiles(cx);
-
-    return true;
-}
-
-// Make sure that the method jit is enabled.
-// We'll probably want to test in all modes.
-virtual
-JSContext *createContext()
-{
-    JSContext *cx = JSAPITest::createContext();
-    if (!cx)
-        return nullptr;
-    JS::RuntimeOptionsRef(cx).setBaseline(true)
-                             .setIon(true);
-    return cx;
-}
-
-END_TEST(testFuncCallback_bug507012)
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -5041,30 +5041,16 @@ JS_SaveFrameChain(JSContext *cx)
 JS_PUBLIC_API(void)
 JS_RestoreFrameChain(JSContext *cx)
 {
     AssertHeapIsIdleOrIterating(cx);
     CHECK_REQUEST(cx);
     cx->restoreFrameChain();
 }
 
-#ifdef MOZ_TRACE_JSCALLS
-JS_PUBLIC_API(void)
-JS_SetFunctionCallback(JSContext *cx, JSFunctionCallback fcb)
-{
-    cx->functionCallback = fcb;
-}
-
-JS_PUBLIC_API(JSFunctionCallback)
-JS_GetFunctionCallback(JSContext *cx)
-{
-    return cx->functionCallback;
-}
-#endif
-
 /************************************************************************/
 JS_PUBLIC_API(JSString *)
 JS_NewStringCopyN(JSContext *cx, const char *s, size_t n)
 {
     AssertHeapIsIdle(cx);
     CHECK_REQUEST(cx);
     if (!n)
         return cx->names().empty;
--- a/js/src/jsapi.h
+++ b/js/src/jsapi.h
@@ -748,24 +748,16 @@ typedef void
 (* JSWeakPointerCallback)(JSRuntime *rt, void *data);
 
 typedef bool
 (* JSInterruptCallback)(JSContext *cx);
 
 typedef void
 (* JSErrorReporter)(JSContext *cx, const char *message, JSErrorReport *report);
 
-#ifdef MOZ_TRACE_JSCALLS
-typedef void
-(* JSFunctionCallback)(const JSFunction *fun,
-                       const JSScript *scr,
-                       const JSContext *cx,
-                       int entering);
-#endif
-
 /*
  * Possible exception types. These types are part of a JSErrorFormatString
  * structure. They define which error to throw in case of a runtime error.
  * JSEXN_NONE marks an unthrowable error.
  */
 typedef enum JSExnType {
     JSEXN_NONE = -1,
       JSEXN_ERR,
@@ -4186,33 +4178,16 @@ JS_IsRunning(JSContext *cx);
  * JS_SaveFrameChain deals with cx not having any code running on it.
  */
 extern JS_PUBLIC_API(bool)
 JS_SaveFrameChain(JSContext *cx);
 
 extern JS_PUBLIC_API(void)
 JS_RestoreFrameChain(JSContext *cx);
 
-#ifdef MOZ_TRACE_JSCALLS
-/*
- * The callback is expected to be quick and noninvasive. It should not
- * request interrupts, turn on debugging, or produce uncaught JS
- * exceptions. The state of the stack and registers in the context
- * cannot be relied upon, since this callback may be invoked directly
- * from either JIT. The 'entering' field means we are entering a
- * function if it is positive, leaving a function if it is zero or
- * negative.
- */
-extern JS_PUBLIC_API(void)
-JS_SetFunctionCallback(JSContext *cx, JSFunctionCallback fcb);
-
-extern JS_PUBLIC_API(JSFunctionCallback)
-JS_GetFunctionCallback(JSContext *cx);
-#endif /* MOZ_TRACE_JSCALLS */
-
 /************************************************************************/
 
 /*
  * Strings.
  *
  * NB: JS_NewUCString takes ownership of bytes on success, avoiding a copy;
  * but on error (signified by null return), it leaves chars owned by the
  * caller. So the caller must free bytes in the error case, if it has no use
--- a/js/src/jscntxt.cpp
+++ b/js/src/jscntxt.cpp
@@ -1020,19 +1020,16 @@ JSContext::JSContext(JSRuntime *rt)
     resolvingList(nullptr),
     generatingError(false),
     savedFrameChains_(),
     cycleDetectorSet(MOZ_THIS_IN_INITIALIZER_LIST()),
     data(nullptr),
     data2(nullptr),
     outstandingRequests(0),
     jitIsBroken(false)
-#ifdef MOZ_TRACE_JSCALLS
-  , functionCallback(nullptr)
-#endif
 {
     MOZ_ASSERT(static_cast<ContextFriendFields*>(this) ==
                ContextFriendFields::get(this));
 }
 
 JSContext::~JSContext()
 {
     /* Free the stuff hanging off of cx. */
--- a/js/src/jscntxt.h
+++ b/js/src/jscntxt.h
@@ -529,29 +529,16 @@ struct JSContext : public js::ExclusiveC
      */
     enum MaybeAllowCrossCompartment {
         DONT_ALLOW_CROSS_COMPARTMENT = false,
         ALLOW_CROSS_COMPARTMENT = true
     };
     inline JSScript *currentScript(jsbytecode **pc = nullptr,
                                    MaybeAllowCrossCompartment = DONT_ALLOW_CROSS_COMPARTMENT) const;
 
-#ifdef MOZ_TRACE_JSCALLS
-    /* Function entry/exit debugging callback. */
-    JSFunctionCallback    functionCallback;
-
-    void doFunctionCallback(const JSFunction *fun,
-                            const JSScript *scr,
-                            int entering) const
-    {
-        if (functionCallback)
-            functionCallback(fun, scr, this, entering);
-    }
-#endif
-
     // The generational GC nursery may only be used on the main thread.
 #ifdef JSGC_GENERATIONAL
     inline js::Nursery &nursery() {
         return runtime_->gc.nursery;
     }
 #endif
 
     void minorGC(JS::gcreason::Reason reason) {
--- a/js/src/vm/Probes-inl.h
+++ b/js/src/vm/Probes-inl.h
@@ -20,20 +20,16 @@ namespace js {
 
 inline bool
 probes::CallTrackingActive(JSContext *cx)
 {
 #ifdef INCLUDE_MOZILLA_DTRACE
     if (JAVASCRIPT_FUNCTION_ENTRY_ENABLED() || JAVASCRIPT_FUNCTION_RETURN_ENABLED())
         return true;
 #endif
-#ifdef MOZ_TRACE_JSCALLS
-    if (cx->functionCallback)
-        return true;
-#endif
     return false;
 }
 
 inline bool
 probes::WantNativeAddressInfo(JSContext *cx)
 {
     return cx->reportGranularity >= JITREPORT_GRANULARITY_FUNCTION &&
            JITGranularityRequested(cx) >= JITREPORT_GRANULARITY_FUNCTION;
@@ -42,19 +38,16 @@ probes::WantNativeAddressInfo(JSContext 
 inline bool
 probes::EnterScript(JSContext *cx, JSScript *script, JSFunction *maybeFun,
                     InterpreterFrame *fp)
 {
 #ifdef INCLUDE_MOZILLA_DTRACE
     if (JAVASCRIPT_FUNCTION_ENTRY_ENABLED())
         DTraceEnterJSFun(cx, maybeFun, script);
 #endif
-#ifdef MOZ_TRACE_JSCALLS
-    cx->doFunctionCallback(maybeFun, script, 1);
-#endif
 
     JSRuntime *rt = cx->runtime();
     if (rt->spsProfiler.enabled()) {
         if (!rt->spsProfiler.enter(script, maybeFun))
             return false;
         MOZ_ASSERT_IF(!fp->script()->isGenerator(), !fp->hasPushedSPSFrame());
         fp->setPushedSPSFrame();
     }
@@ -64,19 +57,16 @@ probes::EnterScript(JSContext *cx, JSScr
 
 inline void
 probes::ExitScript(JSContext *cx, JSScript *script, JSFunction *maybeFun, bool popSPSFrame)
 {
 #ifdef INCLUDE_MOZILLA_DTRACE
     if (JAVASCRIPT_FUNCTION_RETURN_ENABLED())
         DTraceExitJSFun(cx, maybeFun, script);
 #endif
-#ifdef MOZ_TRACE_JSCALLS
-    cx->doFunctionCallback(maybeFun, script, 0);
-#endif
 
     if (popSPSFrame)
         cx->runtime()->spsProfiler.exit(script, maybeFun);
 }
 
 inline bool
 probes::StartExecution(JSScript *script)
 {