Bug 997656 - Tracelogging: Log when baseline is compiling, r=djvj
authorHannes Verschore <hv1989@gmail.com>
Fri, 18 Apr 2014 16:00:17 +0200
changeset 197792 a90a994dee5fa3bc2f7891e52eaf79e402cdcdad
parent 197791 df8e7a4b86cfdec117295389d63349c46d8e65d2
child 197793 af1479b9a7ef9ab55803ed1545a1ac7a3776f342
push id3624
push userasasaki@mozilla.com
push dateMon, 09 Jun 2014 21:49:01 +0000
treeherdermozilla-beta@b1a5da15899a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdjvj
bugs997656
milestone31.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 997656 - Tracelogging: Log when baseline is compiling, r=djvj
js/src/jit/BaselineCompiler.cpp
js/src/vm/TraceLogging.cpp
js/src/vm/TraceLogging.h
--- a/js/src/jit/BaselineCompiler.cpp
+++ b/js/src/jit/BaselineCompiler.cpp
@@ -70,16 +70,20 @@ MethodStatus
 BaselineCompiler::compile()
 {
     IonSpew(IonSpew_BaselineScripts, "Baseline compiling script %s:%d (%p)",
             script->filename(), script->lineno(), script.get());
 
     IonSpew(IonSpew_Codegen, "# Emitting baseline code for script %s:%d",
             script->filename(), script->lineno());
 
+    TraceLogger *logger = TraceLoggerForMainThread(cx->runtime());
+    AutoTraceLog logScript(logger, TraceLogCreateTextId(logger, script));
+    AutoTraceLog logCompile(logger, TraceLogger::BaselineCompilation);
+
     if (!script->ensureHasTypes(cx))
         return Method_Error;
 
     // Only need to analyze scripts which are marked |argumensHasVarBinding|, to
     // compute |needsArgsObj| flag.
     if (script->argumentsHasVarBinding()) {
         if (!script->ensureRanAnalysis(cx))
             return Method_Error;
--- a/js/src/vm/TraceLogging.cpp
+++ b/js/src/vm/TraceLogging.cpp
@@ -62,55 +62,22 @@ rdtsc(void)
     result = result|lower;
 
     return(result);
 }
 #endif
 
 TraceLogging traceLoggers;
 
-// The text that will get logged for eagerly created logged text.
-// When adding/removing something here, you must update the enum
-// Tracelogger::TextId in TraceLogging.h too.
-const char* const text[] = {
+static const char* const text[] =
+{
     "TraceLogger failed to process text",
-    "Bailout",
-    "Baseline",
-    "GC",
-    "GCAllocation",
-    "GCSweeping",
-    "Interpreter",
-    "Invalidation",
-    "IonCompilation",
-    "IonLinking",
-    "IonMonkey",
-    "MinorGC",
-    "ParserCompileFunction",
-    "ParserCompileLazy",
-    "ParserCompileScript",
-    "TraceLogger",
-    "YarrCompile",
-    "YarrInterpret",
-    "YarrJIT",
-    "VM",
-    "SplitCriticalEdges",
-    "RenumberBlocks",
-    "DominatorTree",
-    "PhiAnalysis",
-    "ApplyTypes",
-    "ParallelSafetyAnalysis",
-    "AliasAnalysis",
-    "GVN",
-    "UCE",
-    "LICM",
-    "RangeAnalysis",
-    "EffectiveAddressAnalysis",
-    "EliminateDeadCode",
-    "EdgeCaseAnalysis",
-    "EliminateRedundantChecks"
+#define NAME(x) #x,
+    TRACELOGGER_TEXT_ID_LIST(NAME)
+#undef NAME
 };
 
 TraceLogger::TraceLogger()
  : enabled(false),
    enabledTimes(0),
    failed(false),
    nextTextId(0),
    treeOffset(0),
@@ -828,16 +795,17 @@ TraceLogging::lazyInit()
         enabledTextIds[i] = ContainsFlag(env, text[i]);
 
     enabledTextIds[TraceLogger::TL_Error] = true;
     enabledTextIds[TraceLogger::TL] = true;
 
     if (ContainsFlag(env, "Default") || strlen(env) == 0) {
         enabledTextIds[TraceLogger::Bailout] = true;
         enabledTextIds[TraceLogger::Baseline] = true;
+        enabledTextIds[TraceLogger::BaselineCompilation] = true;
         enabledTextIds[TraceLogger::GC] = true;
         enabledTextIds[TraceLogger::GCAllocation] = true;
         enabledTextIds[TraceLogger::GCSweeping] = true;
         enabledTextIds[TraceLogger::Interpreter] = true;
         enabledTextIds[TraceLogger::IonCompilation] = true;
         enabledTextIds[TraceLogger::IonLinking] = true;
         enabledTextIds[TraceLogger::IonMonkey] = true;
         enabledTextIds[TraceLogger::MinorGC] = true;
--- a/js/src/vm/TraceLogging.h
+++ b/js/src/vm/TraceLogging.h
@@ -103,16 +103,55 @@ namespace jit {
  *    or the duration:
  *    - TraceLogStartEvent(logger, textId);
  *    - TraceLogStopEvent(logger, textId);
  *
  *    or the duration with a RAII class:
  *    - AutoTraceLog logger(logger, textId);
  */
 
+#define TRACELOGGER_TEXT_ID_LIST(_)                   \
+    _(Bailout)                                        \
+    _(Baseline)                                       \
+    _(BaselineCompilation)                            \
+    _(GC)                                             \
+    _(GCAllocation)                                   \
+    _(GCSweeping)                                     \
+    _(Interpreter)                                    \
+    _(Invalidation)                                   \
+    _(IonCompilation)                                 \
+    _(IonLinking)                                     \
+    _(IonMonkey)                                      \
+    _(MinorGC)                                        \
+    _(ParserCompileFunction)                          \
+    _(ParserCompileLazy)                              \
+    _(ParserCompileScript)                            \
+    _(TL)                                             \
+    _(YarrCompile)                                    \
+    _(YarrInterpret)                                  \
+    _(YarrJIT)                                        \
+    _(VM)                                             \
+                                                      \
+    /* Specific passes during ion compilation */      \
+    _(SplitCriticalEdges)                             \
+    _(RenumberBlocks)                                 \
+    _(DominatorTree)                                  \
+    _(PhiAnalysis)                                    \
+    _(ApplyTypes)                                     \
+    _(ParallelSafetyAnalysis)                         \
+    _(AliasAnalysis)                                  \
+    _(GVN)                                            \
+    _(UCE)                                            \
+    _(LICM)                                           \
+    _(RangeAnalysis)                                  \
+    _(EffectiveAddressAnalysis)                       \
+    _(EliminateDeadCode)                              \
+    _(EdgeCaseAnalysis)                               \
+    _(EliminateRedundantChecks)
+
 class AutoTraceLog;
 
 template <class T>
 class ContinuousSpace {
     T *data_;
     uint32_t next_;
     uint32_t capacity_;
 
@@ -203,58 +242,22 @@ class ContinuousSpace {
     }
 };
 
 class TraceLogger
 {
   public:
     // Predefined IDs for common operations. These IDs can be used
     // without using TraceLogCreateTextId, because there are already created.
-    // When changing the enum here, you must update the array containing the
-    // actual logged text in TraceLogging.cpp.
     enum TextId {
-      TL_Error,
-      Bailout,
-      Baseline,
-      GC,
-      GCAllocation,
-      GCSweeping,
-      Interpreter,
-      Invalidation,
-      IonCompilation,
-      IonLinking,
-      IonMonkey,
-      MinorGC,
-      ParserCompileFunction,
-      ParserCompileLazy,
-      ParserCompileScript,
-      TL,
-      YarrCompile,
-      YarrInterpret,
-      YarrJIT,
-      VM,
-
-      // Specific passes during ion compilation:
-      SplitCriticalEdges,
-      RenumberBlocks,
-      DominatorTree,
-      PhiAnalysis,
-      ApplyTypes,
-      ParallelSafetyAnalysis,
-      AliasAnalysis,
-      GVN,
-      UCE,
-      LICM,
-      RangeAnalysis,
-      EffectiveAddressAnalysis,
-      EliminateDeadCode,
-      EdgeCaseAnalysis,
-      EliminateRedundantChecks,
-
-      LAST
+        TL_Error = 0,
+#   define DEFINE_TEXT_ID(textId) textId,
+        TRACELOGGER_TEXT_ID_LIST(DEFINE_TEXT_ID)
+#   undef DEFINE_TEXT_ID
+        LAST
     };
 
 #ifdef JS_TRACE_LOGGING
   private:
     typedef HashMap<const void *,
                     uint32_t,
                     PointerHasher<const void *, 3>,
                     SystemAllocPolicy> PointerHashMap;