Bug 900784 part 0.11 - Instrument XDR Encode/Decode function with the TraceLogger. r=h4writer
authorNicolas B. Pierron <nicolas.b.pierron@mozilla.com>
Tue, 31 Jan 2017 20:03:57 +0000
changeset 331865 81c659b2e7e26e4ebde1b92d6a2bb240beb37f01
parent 331864 aeaf50c6d238d273776dce8cb6be0bf3c034306f
child 331866 6ad62d0a98d7426eca10b66d9fef1d47509adc68
push id86379
push usernpierron@mozilla.com
push dateTue, 31 Jan 2017 20:04:21 +0000
treeherdermozilla-inbound@36aebe4f719d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersh4writer
bugs900784
milestone54.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 900784 part 0.11 - Instrument XDR Encode/Decode function with the TraceLogger. r=h4writer
js/src/vm/TraceLoggingTypes.h
js/src/vm/Xdr.cpp
--- a/js/src/vm/TraceLoggingTypes.h
+++ b/js/src/vm/TraceLoggingTypes.h
@@ -28,16 +28,20 @@
     _(IonMonkey)                                      \
     _(IrregexpCompile)                                \
     _(IrregexpExecute)                                \
     _(MinorGC)                                        \
     _(ParserCompileFunction)                          \
     _(ParserCompileLazy)                              \
     _(ParserCompileScript)                            \
     _(ParserCompileModule)                            \
+    _(DecodeScript)                                   \
+    _(DecodeFunction)                                 \
+    _(EncodeScript)                                   \
+    _(EncodeFunction)                                 \
     _(Scripts)                                        \
     _(VM)                                             \
     _(CompressSource)                                 \
     _(WasmCompilation)                                \
     _(Call)                                           \
                                                       \
     /* Specific passes during ion compilation */      \
     _(PruneUnusedBranches)                            \
--- a/js/src/vm/Xdr.cpp
+++ b/js/src/vm/Xdr.cpp
@@ -10,16 +10,17 @@
 
 #include <string.h>
 
 #include "jsapi.h"
 #include "jsscript.h"
 
 #include "vm/Debugger.h"
 #include "vm/EnvironmentObject.h"
+#include "vm/TraceLogging.h"
 
 using namespace js;
 using mozilla::PodEqual;
 
 template<XDRMode mode>
 void
 XDRState<mode>::postProcessContextErrors(JSContext* cx)
 {
@@ -111,16 +112,21 @@ VersionCheck(XDRState<mode>* xdr)
 
     return true;
 }
 
 template<XDRMode mode>
 bool
 XDRState<mode>::codeFunction(MutableHandleFunction funp)
 {
+    TraceLoggerThread* logger = TraceLoggerForMainThread(cx()->runtime());
+    TraceLoggerTextId event =
+        mode == XDR_DECODE ? TraceLogger_DecodeFunction : TraceLogger_EncodeFunction;
+    AutoTraceLog tl(logger, event);
+
     if (mode == XDR_DECODE)
         funp.set(nullptr);
     else
         MOZ_ASSERT(funp->nonLazyScript()->enclosingScope()->is<GlobalScope>());
 
     if (!VersionCheck(this)) {
         postProcessContextErrors(cx());
         return false;
@@ -135,16 +141,21 @@ XDRState<mode>::codeFunction(MutableHand
 
     return true;
 }
 
 template<XDRMode mode>
 bool
 XDRState<mode>::codeScript(MutableHandleScript scriptp)
 {
+    TraceLoggerThread* logger = TraceLoggerForMainThread(cx()->runtime());
+    TraceLoggerTextId event =
+        mode == XDR_DECODE ? TraceLogger_DecodeScript : TraceLogger_EncodeScript;
+    AutoTraceLog tl(logger, event);
+
     if (mode == XDR_DECODE)
         scriptp.set(nullptr);
     else
         MOZ_ASSERT(!scriptp->enclosingScope());
 
     if (!VersionCheck(this)) {
         postProcessContextErrors(cx());
         return false;