Title: [207491] trunk/Source/_javascript_Core
Revision
207491
Author
msab...@apple.com
Date
2016-10-18 14:28:58 -0700 (Tue, 18 Oct 2016)

Log Message

Add JSC option to show time spent in each optimization phase
https://bugs.webkit.org/show_bug.cgi?id=163617

Reviewed by Saam Barati.

Added reportDFGPhaseTimes option.  This outputs one line per phase similar to
    Phase CPS rethreading took 0.2661 ms

One line is output for each phase run.

* dfg/DFGPhase.h:
(JSC::DFG::runAndLog):
* dfg/DFGPlan.cpp:
(JSC::DFG::Plan::compileInThread):
* runtime/Options.cpp:
(JSC::recomputeDependentOptions):
* runtime/Options.h:

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (207490 => 207491)


--- trunk/Source/_javascript_Core/ChangeLog	2016-10-18 21:26:14 UTC (rev 207490)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-10-18 21:28:58 UTC (rev 207491)
@@ -1,3 +1,23 @@
+2016-10-18  Michael Saboff  <msab...@apple.com>
+
+        Add JSC option to show time spent in each optimization phase
+        https://bugs.webkit.org/show_bug.cgi?id=163617
+
+        Reviewed by Saam Barati.
+
+        Added reportDFGPhaseTimes option.  This outputs one line per phase similar to
+            Phase CPS rethreading took 0.2661 ms
+
+        One line is output for each phase run.
+
+        * dfg/DFGPhase.h:
+        (JSC::DFG::runAndLog):
+        * dfg/DFGPlan.cpp:
+        (JSC::DFG::Plan::compileInThread):
+        * runtime/Options.cpp:
+        (JSC::recomputeDependentOptions):
+        * runtime/Options.h:
+
 2016-10-18  Filip Pizlo  <fpi...@apple.com>
 
         WTF should make it easier to create threads that die automatically after inactivity

Modified: trunk/Source/_javascript_Core/dfg/DFGPhase.h (207490 => 207491)


--- trunk/Source/_javascript_Core/dfg/DFGPhase.h	2016-10-18 21:26:14 UTC (rev 207490)
+++ trunk/Source/_javascript_Core/dfg/DFGPhase.h	2016-10-18 21:28:58 UTC (rev 207491)
@@ -76,7 +76,17 @@
 template<typename PhaseType>
 bool runAndLog(PhaseType& phase)
 {
+    double before = 0;
+
+    if (UNLIKELY(Options::reportDFGPhaseTimes()))
+        before = monotonicallyIncreasingTimeMS();
+
     bool result = phase.run();
+
+    if (UNLIKELY(Options::reportDFGPhaseTimes())) {
+        double after = monotonicallyIncreasingTimeMS();
+        dataLogF("Phase %s took %.4f ms\n", phase.name(), after - before);
+    }
     if (result && logCompilationChanges(phase.graph().m_plan.mode))
         dataLogF("Phase %s changed the IR.\n", phase.name());
     return result;

Modified: trunk/Source/_javascript_Core/dfg/DFGPlan.cpp (207490 => 207491)


--- trunk/Source/_javascript_Core/dfg/DFGPlan.cpp	2016-10-18 21:26:14 UTC (rev 207490)
+++ trunk/Source/_javascript_Core/dfg/DFGPlan.cpp	2016-10-18 21:28:58 UTC (rev 207491)
@@ -183,7 +183,7 @@
     
     CompilationScope compilationScope;
 
-    if (logCompilationChanges(mode))
+    if (logCompilationChanges(mode) || Options::reportDFGPhaseTimes())
         dataLog("DFG(Plan) compiling ", *codeBlock, " with ", mode, ", number of instructions = ", codeBlock->instructionCount(), "\n");
 
     CompilationPath path = compileInThreadImpl(longLivedState);

Modified: trunk/Source/_javascript_Core/runtime/Options.cpp (207490 => 207491)


--- trunk/Source/_javascript_Core/runtime/Options.cpp	2016-10-18 21:26:14 UTC (rev 207490)
+++ trunk/Source/_javascript_Core/runtime/Options.cpp	2016-10-18 21:28:58 UTC (rev 207491)
@@ -349,6 +349,7 @@
         || Options::reportBaselineCompileTimes()
         || Options::reportDFGCompileTimes()
         || Options::reportFTLCompileTimes()
+        || Options::reportDFGPhaseTimes()
         || Options::verboseCFA()
         || Options::verboseFTLFailure())
         Options::alwaysComputeHash() = true;

Modified: trunk/Source/_javascript_Core/runtime/Options.h (207490 => 207491)


--- trunk/Source/_javascript_Core/runtime/Options.h	2016-10-18 21:26:14 UTC (rev 207490)
+++ trunk/Source/_javascript_Core/runtime/Options.h	2016-10-18 21:28:58 UTC (rev 207491)
@@ -173,6 +173,7 @@
     v(bool, reportBaselineCompileTimes, false, Normal, "dumps JS function signature and the time it took to BaselineJIT compile") \
     v(bool, reportDFGCompileTimes, false, Normal, "dumps JS function signature and the time it took to DFG and FTL compile") \
     v(bool, reportFTLCompileTimes, false, Normal, "dumps JS function signature and the time it took to FTL compile") \
+    v(bool, reportDFGPhaseTimes, false, Normal, "dumps JS function name and the time is took for each DFG phase") \
     v(bool, reportTotalCompileTimes, false, Normal, nullptr) \
     v(bool, verboseExitProfile, false, Normal, nullptr) \
     v(bool, verboseCFA, false, Normal, nullptr) \
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to