Bug 1003056: Tracelogging - Log the lowering and generation of ionmonkey code, r=bbouvier
authorHannes Verschore <hv1989@gmail.com>
Wed, 30 Apr 2014 16:59:00 +0200
changeset 181023 6c9e1af09baea27a279dd648385ea9ac3d81cd86
parent 181022 8a6c3ab28bbc433485d29e13fb905682495d785c
child 181024 61f1739efa5df068863acf386139e706f33a23d3
push id42918
push userhv1989@gmail.com
push dateWed, 30 Apr 2014 14:59:28 +0000
treeherdermozilla-inbound@6c9e1af09bae [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbbouvier
bugs1003056
milestone32.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 1003056: Tracelogging - Log the lowering and generation of ionmonkey code, r=bbouvier
js/src/jit/Ion.cpp
js/src/vm/TraceLogging.cpp
js/src/vm/TraceLogging.h
--- a/js/src/jit/Ion.cpp
+++ b/js/src/jit/Ion.cpp
@@ -1528,30 +1528,41 @@ OptimizeMIR(MIRGenerator *mir)
     return true;
 }
 
 LIRGraph *
 GenerateLIR(MIRGenerator *mir)
 {
     MIRGraph &graph = mir->graph();
 
+    TraceLogger *logger;
+    if (GetIonContext()->runtime->onMainThread())
+        logger = TraceLoggerForMainThread(GetIonContext()->runtime);
+    else
+        logger = TraceLoggerForCurrentThread();
+
     LIRGraph *lir = mir->alloc().lifoAlloc()->new_<LIRGraph>(&graph);
     if (!lir || !lir->init())
         return nullptr;
 
     LIRGenerator lirgen(mir, graph, *lir);
-    if (!lirgen.generate())
-        return nullptr;
-    IonSpewPass("Generate LIR");
-
-    if (mir->shouldCancel("Generate LIR"))
-        return nullptr;
+    {
+        AutoTraceLog log(logger, TraceLogger::GenerateLIR);
+        if (!lirgen.generate())
+            return nullptr;
+        IonSpewPass("Generate LIR");
+
+        if (mir->shouldCancel("Generate LIR"))
+            return nullptr;
+    }
 
     AllocationIntegrityState integrity(*lir);
 
+    TraceLogStartEvent(logger, TraceLogger::RegisterAllocation);
+
     switch (mir->optimizationInfo().registerAllocator()) {
       case RegisterAllocator_LSRA: {
 #ifdef DEBUG
         if (!integrity.record())
             return nullptr;
 #endif
 
         LinearScanAllocator regalloc(mir, &lirgen, *lir);
@@ -1603,29 +1614,41 @@ GenerateLIR(MIRGenerator *mir)
 
       default:
         MOZ_ASSUME_UNREACHABLE("Bad regalloc");
     }
 
     if (mir->shouldCancel("Allocate Registers"))
         return nullptr;
 
-    // Now that all optimization and register allocation is done, re-introduce
-    // critical edges to avoid unnecessary jumps.
-    if (!UnsplitEdges(lir))
-        return nullptr;
-    IonSpewPass("Unsplit Critical Edges");
-    AssertBasicGraphCoherency(graph);
+    TraceLogStopEvent(logger, TraceLogger::RegisterAllocation);
+
+    {
+        AutoTraceLog log(logger, TraceLogger::UnsplitEdges);
+        // Now that all optimization and register allocation is done, re-introduce
+        // critical edges to avoid unnecessary jumps.
+        if (!UnsplitEdges(lir))
+            return nullptr;
+        IonSpewPass("Unsplit Critical Edges");
+        AssertBasicGraphCoherency(graph);
+    }
 
     return lir;
 }
 
 CodeGenerator *
 GenerateCode(MIRGenerator *mir, LIRGraph *lir)
 {
+    TraceLogger *logger;
+    if (GetIonContext()->runtime->onMainThread())
+        logger = TraceLoggerForMainThread(GetIonContext()->runtime);
+    else
+        logger = TraceLoggerForCurrentThread();
+    AutoTraceLog log(logger, TraceLogger::GenerateCode);
+
     CodeGenerator *codegen = js_new<CodeGenerator>(mir, lir);
     if (!codegen)
         return nullptr;
 
     if (!codegen->generate()) {
         js_delete(codegen);
         return nullptr;
     }
--- a/js/src/vm/TraceLogging.cpp
+++ b/js/src/vm/TraceLogging.cpp
@@ -830,16 +830,20 @@ TraceLogging::lazyInit()
         enabledTextIds[TraceLogger::GVN] = true;
         enabledTextIds[TraceLogger::UCE] = true;
         enabledTextIds[TraceLogger::LICM] = true;
         enabledTextIds[TraceLogger::RangeAnalysis] = true;
         enabledTextIds[TraceLogger::EffectiveAddressAnalysis] = true;
         enabledTextIds[TraceLogger::EliminateDeadCode] = true;
         enabledTextIds[TraceLogger::EdgeCaseAnalysis] = true;
         enabledTextIds[TraceLogger::EliminateRedundantChecks] = true;
+        enabledTextIds[TraceLogger::GenerateLIR] = true;
+        enabledTextIds[TraceLogger::RegisterAllocation] = true;
+        enabledTextIds[TraceLogger::UnsplitEdges] = true;
+        enabledTextIds[TraceLogger::GenerateCode] = true;
     }
 
     const char *options = getenv("TLOPTIONS");
     if (options) {
         if (strstr(options, "help")) {
             fflush(nullptr);
             printf(
                 "\n"
--- a/js/src/vm/TraceLogging.h
+++ b/js/src/vm/TraceLogging.h
@@ -140,17 +140,21 @@ namespace jit {
     _(AliasAnalysis)                                  \
     _(GVN)                                            \
     _(UCE)                                            \
     _(LICM)                                           \
     _(RangeAnalysis)                                  \
     _(EffectiveAddressAnalysis)                       \
     _(EliminateDeadCode)                              \
     _(EdgeCaseAnalysis)                               \
-    _(EliminateRedundantChecks)
+    _(EliminateRedundantChecks)                       \
+    _(GenerateLIR)                                    \
+    _(RegisterAllocation)                             \
+    _(UnsplitEdges)                                   \
+    _(GenerateCode)                                   \
 
 class AutoTraceLog;
 
 template <class T>
 class ContinuousSpace {
     T *data_;
     uint32_t next_;
     uint32_t capacity_;