Commits

Andrew Sutherland  committed e6a7724

maybe add conversions from contexts to compartments; untested

  • Participants
  • Parent commits e6eeba3

Comments (0)

Files changed (2)

File js-run-probes

+# HG changeset patch
+# Parent a543a29c8529ca75719d1572a2c19eabf816ef85
+
+diff --git a/js/src/jsinterp.cpp b/js/src/jsinterp.cpp
+--- a/js/src/jsinterp.cpp
++++ b/js/src/jsinterp.cpp
+@@ -514,7 +514,13 @@
+     JSBool ok;
+     {
+         AutoPreserveEnumerators preserve(cx);
+-        ok = RunScript(cx, fun->script(), fp);
++        JSScript *script = fun->script();
++
++        Probes::startExecution(cx, script);
++
++        ok = RunScript(cx, script, fp);
++
++        Probes::stopExecution(cx, script);
+     }
+ 
+     args.rval() = fp->returnValue();
+diff --git a/js/src/jsprobedefs.cpp b/js/src/jsprobedefs.cpp
+--- a/js/src/jsprobedefs.cpp
++++ b/js/src/jsprobedefs.cpp
+@@ -238,6 +238,18 @@
+     return true;
+ }
+ 
++bool
++context_to_compartment(JSRuntime *rt, ProbeValue *arg)
++{
++    JS_ASSERT(arg);
++    JS_ASSERT(arg->ty == ProbeType_JSContextPtr);
++    JS_ASSERT(arg->data.as_JSContextPtr);
++    PROBE_VALUE_SET(arg, intptr_t,
++                    (intptr_t)arg->data.as_JSContextPtr->compartment);
++    return true;
++}
++
++
+ js::Value
+ deserialize_size_t(JSContext *cx, ProbeValue v)
+ {
+diff --git a/js/src/jsprobedefs.h b/js/src/jsprobedefs.h
+--- a/js/src/jsprobedefs.h
++++ b/js/src/jsprobedefs.h
+@@ -158,6 +158,7 @@
+ bool compartment_gcLastBytes(JSRuntime *rt, ProbeValue *val);
+ bool compartment_id(JSRuntime *rt, ProbeValue *val);
+ bool env_currentTimeMS(JSRuntime *rt, ProbeValue *val);
++bool context_to_compartment(JSRuntime *rt, ProbeValue *val);
+ 
+ js::Value deserialize_size_t(JSContext *cx, ProbeValue val);
+ js::Value deserialize_intptr_t(JSContext *cx, ProbeValue val);
+diff --git a/js/src/jsprobes.h b/js/src/jsprobes.h
+--- a/js/src/jsprobes.h
++++ b/js/src/jsprobes.h
+@@ -834,6 +834,11 @@
+     if (ProfilingActive && !ETWStartExecution(cx, script))
+         ok = false;
+ #endif
++#ifdef MOZ_JSPROBES
++    ProbeManager *mgr = ProbeManager::manager();
++    if (!mgr || !mgr->fireProbe(JS_WILL_EXECUTE_SCRIPT, cx, script))
++        ok = false;
++#endif
+ 
+     return ok;
+ }
+@@ -852,6 +857,11 @@
+     if (ProfilingActive && !ETWStopExecution(cx, script))
+         ok = false;
+ #endif
++#ifdef MOZ_JSPROBES
++    ProbeManager *mgr = ProbeManager::manager();
++    if (!mgr || !mgr->fireProbe(JS_DID_EXECUTE_SCRIPT, cx, script))
++        ok = false;
++#endif
+ 
+     return ok;
+ }
+diff --git a/js/src/jsprobes.tbl b/js/src/jsprobes.tbl
+--- a/js/src/jsprobes.tbl
++++ b/js/src/jsprobes.tbl
+@@ -205,6 +205,7 @@
+ PROBE_TRANS(compartment_gcLastBytes,       gcLastBytes,        9,  JSCompartmentPtr,    size_t)
+ PROBE_TRANS(compartment_id,                id,                10,  JSCompartmentPtr,    intptr_t)
+ PROBE_TRANS(env_currentTimeMS,             currentTimeMS,     11,  DummyGlobal,         double)
++PROBE_TRANS(context_to_compartment,        compartment,       12,  JSContextPtr,        JSCompartmentPtr)
+ 
+ /* teardown PROBE_POINT helpers */
+ #undef _NO_ARGS
+diff --git a/toolkit/components/probes/ProbeService.cpp b/toolkit/components/probes/ProbeService.cpp
+--- a/toolkit/components/probes/ProbeService.cpp
++++ b/toolkit/components/probes/ProbeService.cpp
+@@ -401,7 +401,7 @@
+ 
+     mListeners.Put(codeCookie, listener);
+     mListenerContexts.Put(codeCookie, scriptCx);
+-    StartDrainTimer(1000);
++    StartDrainTimer(400);
+ 
+     return NS_OK;
+ }
 jsshell-integration #+shell
 xpcom-nsIProbeService
 js-runtime-fixups
+js-run-probes