Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (200530 => 200531)
--- trunk/Source/_javascript_Core/ChangeLog 2016-05-06 22:47:16 UTC (rev 200530)
+++ trunk/Source/_javascript_Core/ChangeLog 2016-05-06 22:57:32 UTC (rev 200531)
@@ -1,3 +1,40 @@
+2016-05-06 Mark Lam <mark....@apple.com>
+
+ Add JSC options reportBaselineCompileTimes and reportDFGCompileTimes.
+ https://bugs.webkit.org/show_bug.cgi?id=157427
+
+ Reviewed by Filip Pizlo and Keith Miller.
+
+ The compile times reporting options are now:
+ reportCompileTimes -> report compile times in all tiers.
+ reportBaselineCompileTimes -> report compile times in baseline JIT.
+ reportDFGCompileTimes -> report compile times in DFG and FTL.
+ reportFTLCompileTimes -> report compile times in FTL.
+
+ Also updated reportTotalCompileTimes() to collect stats that include the baseline
+ JIT. compileTimeStats() is now moved into JIT.cpp (from DFGPlan.cpp).
+
+ * dfg/DFGPlan.cpp:
+ (JSC::DFG::Plan::reportCompileTimes):
+ (JSC::DFG::Plan::compileInThread):
+ (JSC::DFG::Plan::compileInThreadImpl):
+ (JSC::DFG::Plan::cancel):
+ (JSC::DFG::Plan::compileTimeStats): Deleted.
+ * dfg/DFGPlan.h:
+ (JSC::DFG::Plan::compileTimeStats): Deleted.
+ * jit/JIT.cpp:
+ (JSC::ctiPatchCallByReturnAddress):
+ (JSC::JIT::privateCompile):
+ (JSC::JIT::stackPointerOffsetFor):
+ (JSC::JIT::reportCompileTimes):
+ (JSC::JIT::computeCompileTimes):
+ (JSC::JIT::compileTimeStats):
+ * jit/JIT.h:
+ (JSC::JIT::shouldEmitProfiling):
+ * jsc.cpp:
+ (runJSC):
+ * runtime/Options.h:
+
2016-05-05 Benjamin Poulain <bpoul...@apple.com>
[JSC] Get rid of NonNegZeroDouble, it is broken
Modified: trunk/Source/_javascript_Core/dfg/DFGPlan.cpp (200530 => 200531)
--- trunk/Source/_javascript_Core/dfg/DFGPlan.cpp 2016-05-06 22:47:16 UTC (rev 200530)
+++ trunk/Source/_javascript_Core/dfg/DFGPlan.cpp 2016-05-06 22:57:32 UTC (rev 200531)
@@ -90,15 +90,19 @@
#include "FTLState.h"
#endif
+namespace JSC {
+
+extern double totalDFGCompileTime;
+extern double totalFTLCompileTime;
+extern double totalFTLDFGCompileTime;
+extern double totalFTLB3CompileTime;
+
+}
+
namespace JSC { namespace DFG {
namespace {
-double totalDFGCompileTime;
-double totalFTLCompileTime;
-double totalFTLDFGCompileTime;
-double totalFTLB3CompileTime;
-
void dumpAndVerifyGraph(Graph& graph, const char* text, bool forceDump = false)
{
GraphDumpMode modeForFinalValidate = DumpGraph;
@@ -160,6 +164,7 @@
bool Plan::reportCompileTimes() const
{
return Options::reportCompileTimes()
+ || Options::reportDFGCompileTimes()
|| (Options::reportFTLCompileTimes() && isFTL(mode));
}
@@ -169,9 +174,9 @@
double before = 0;
CString codeBlockName;
- if (computeCompileTimes())
+ if (UNLIKELY(computeCompileTimes()))
before = monotonicallyIncreasingTimeMS();
- if (reportCompileTimes())
+ if (UNLIKELY(reportCompileTimes()))
codeBlockName = toCString(*codeBlock);
CompilationScope compilationScope;
@@ -185,19 +190,19 @@
RELEASE_ASSERT((path == CancelPath) == (stage == Cancelled));
double after = 0;
- if (computeCompileTimes())
+ if (UNLIKELY(computeCompileTimes())) {
after = monotonicallyIncreasingTimeMS();
- if (Options::reportTotalCompileTimes()) {
- if (isFTL(mode)) {
- totalFTLCompileTime += after - before;
- totalFTLDFGCompileTime += m_timeBeforeFTL - before;
- totalFTLB3CompileTime += after - m_timeBeforeFTL;
- } else
- totalDFGCompileTime += after - before;
+ if (Options::reportTotalCompileTimes()) {
+ if (isFTL(mode)) {
+ totalFTLCompileTime += after - before;
+ totalFTLDFGCompileTime += m_timeBeforeFTL - before;
+ totalFTLB3CompileTime += after - m_timeBeforeFTL;
+ } else
+ totalDFGCompileTime += after - before;
+ }
}
-
- if (reportCompileTimes()) {
+ if (UNLIKELY(reportCompileTimes())) {
const char* pathName;
switch (path) {
case FailPath:
@@ -458,7 +463,7 @@
FTL::State state(dfg);
FTL::lowerDFGToB3(state);
- if (computeCompileTimes())
+ if (UNLIKELY(computeCompileTimes()))
m_timeBeforeFTL = monotonicallyIncreasingTimeMS();
if (Options::b3AlwaysFailsBeforeCompile()) {
@@ -651,19 +656,6 @@
stage = Cancelled;
}
-HashMap<CString, double> Plan::compileTimeStats()
-{
- HashMap<CString, double> result;
- if (Options::reportTotalCompileTimes()) {
- result.add("Compile Time", totalDFGCompileTime + totalFTLCompileTime);
- result.add("DFG Compile Time", totalDFGCompileTime);
- result.add("FTL Compile Time", totalFTLCompileTime);
- result.add("FTL (DFG) Compile Time", totalFTLDFGCompileTime);
- result.add("FTL (B3) Compile Time", totalFTLB3CompileTime);
- }
- return result;
-}
-
} } // namespace JSC::DFG
#endif // ENABLE(DFG_JIT)
Modified: trunk/Source/_javascript_Core/dfg/DFGPlan.h (200530 => 200531)
--- trunk/Source/_javascript_Core/dfg/DFGPlan.h 2016-05-06 22:47:16 UTC (rev 200530)
+++ trunk/Source/_javascript_Core/dfg/DFGPlan.h 2016-05-06 22:57:32 UTC (rev 200531)
@@ -110,8 +110,6 @@
RefPtr<DeferredCompilationCallback> callback;
- JS_EXPORT_PRIVATE static HashMap<CString, double> compileTimeStats();
-
private:
bool computeCompileTimes() const;
bool reportCompileTimes() const;
@@ -125,14 +123,6 @@
double m_timeBeforeFTL;
};
-#else // ENABLE(DFG_JIT)
-
-class Plan : public RefCounted<Plan> {
- // Dummy class to allow !ENABLE(DFG_JIT) to build.
-public:
- static HashMap<CString, double> compileTimeStats() { return HashMap<CString, double>(); }
-};
-
#endif // ENABLE(DFG_JIT)
} } // namespace JSC::DFG
Modified: trunk/Source/_javascript_Core/jit/JIT.cpp (200530 => 200531)
--- trunk/Source/_javascript_Core/jit/JIT.cpp 2016-05-06 22:47:16 UTC (rev 200530)
+++ trunk/Source/_javascript_Core/jit/JIT.cpp 2016-05-06 22:57:32 UTC (rev 200531)
@@ -52,6 +52,12 @@
namespace JSC {
+double totalBaselineCompileTime;
+double totalDFGCompileTime;
+double totalFTLCompileTime;
+double totalFTLDFGCompileTime;
+double totalFTLB3CompileTime;
+
void ctiPatchCallByReturnAddress(ReturnAddressPtr returnAddress, FunctionPtr newCalleeFunction)
{
MacroAssembler::repatchCall(
@@ -484,6 +490,10 @@
CompilationResult JIT::privateCompile(JITCompilationEffort effort)
{
+ double before = 0;
+ if (UNLIKELY(computeCompileTimes()))
+ before = monotonicallyIncreasingTimeMS();
+
DFG::CapabilityLevel level = m_codeBlock->capabilityLevel();
switch (level) {
case DFG::CannotCompile:
@@ -741,7 +751,20 @@
m_codeBlock->shrinkToFit(CodeBlock::LateShrink);
m_codeBlock->setJITCode(
adoptRef(new DirectJITCode(result, withArityCheck, JITCode::BaselineJIT)));
-
+
+ double after;
+ if (UNLIKELY(computeCompileTimes())) {
+ after = monotonicallyIncreasingTimeMS();
+
+ if (Options::reportTotalCompileTimes())
+ totalBaselineCompileTime += after - before;
+ }
+ if (UNLIKELY(reportCompileTimes())) {
+ CString codeBlockName = toCString(*m_codeBlock);
+
+ dataLog("Optimized ", codeBlockName, " with Baseline JIT into ", patchBuffer.size(), " bytes in ", after - before, " ms.\n");
+ }
+
#if ENABLE(JIT_VERBOSE)
dataLogF("JIT generated code for %p at [%p, %p).\n", m_codeBlock, result.executableMemory()->start(), result.executableMemory()->end());
#endif
@@ -801,6 +824,34 @@
return virtualRegisterForLocal(frameRegisterCountFor(codeBlock) - 1).offset();
}
+bool JIT::reportCompileTimes()
+{
+ return Options::reportCompileTimes() || Options::reportBaselineCompileTimes();
+}
+
+bool JIT::computeCompileTimes()
+{
+ return reportCompileTimes() || Options::reportTotalCompileTimes();
+}
+
+HashMap<CString, double> JIT::compileTimeStats()
+{
+ HashMap<CString, double> result;
+ if (Options::reportTotalCompileTimes()) {
+ result.add("Total Compile Time", totalBaselineCompileTime + totalDFGCompileTime + totalFTLCompileTime);
+ result.add("Baseline Compile Time", totalBaselineCompileTime);
+#if ENABLE(DFG_JIT)
+ result.add("DFG Compile Time", totalDFGCompileTime);
+#if ENABLE(FTL_JIT)
+ result.add("FTL Compile Time", totalFTLCompileTime);
+ result.add("FTL (DFG) Compile Time", totalFTLDFGCompileTime);
+ result.add("FTL (B3) Compile Time", totalFTLB3CompileTime);
+#endif // ENABLE(FTL_JIT)
+#endif // ENABLE(DFG_JIT)
+ }
+ return result;
+}
+
} // namespace JSC
#endif // ENABLE(JIT)
Modified: trunk/Source/_javascript_Core/jit/JIT.h (200530 => 200531)
--- trunk/Source/_javascript_Core/jit/JIT.h 2016-05-06 22:47:16 UTC (rev 200530)
+++ trunk/Source/_javascript_Core/jit/JIT.h 2016-05-06 22:57:32 UTC (rev 200531)
@@ -253,6 +253,8 @@
static unsigned frameRegisterCountFor(CodeBlock*);
static int stackPointerOffsetFor(CodeBlock*);
+ JS_EXPORT_PRIVATE static HashMap<CString, double> compileTimeStats();
+
private:
JIT(VM*, CodeBlock* = 0);
@@ -897,6 +899,9 @@
bool shouldEmitProfiling() { return false; }
#endif
+ static bool reportCompileTimes();
+ static bool computeCompileTimes();
+
Interpreter* m_interpreter;
Vector<CallRecord> m_calls;
Modified: trunk/Source/_javascript_Core/jsc.cpp (200530 => 200531)
--- trunk/Source/_javascript_Core/jsc.cpp 2016-05-06 22:47:16 UTC (rev 200530)
+++ trunk/Source/_javascript_Core/jsc.cpp 2016-05-06 22:57:32 UTC (rev 200531)
@@ -29,7 +29,6 @@
#include "CodeBlock.h"
#include "Completion.h"
#include "CopiedSpaceInlines.h"
-#include "DFGPlan.h"
#include "Disassembler.h"
#include "Exception.h"
#include "ExceptionHelpers.h"
@@ -39,6 +38,7 @@
#include "HeapStatistics.h"
#include "InitializeThreading.h"
#include "Interpreter.h"
+#include "JIT.h"
#include "JSArray.h"
#include "JSArrayBuffer.h"
#include "JSCInlines.h"
@@ -2264,14 +2264,15 @@
printf("JSC OSR EXIT FUZZ: encountered %u static checks.\n", numberOfStaticOSRExitFuzzChecks());
printf("JSC OSR EXIT FUZZ: encountered %u dynamic checks.\n", numberOfOSRExitFuzzChecks());
}
-#endif
- auto compileTimeStats = DFG::Plan::compileTimeStats();
+
+ auto compileTimeStats = JIT::compileTimeStats();
Vector<CString> compileTimeKeys;
for (auto& entry : compileTimeStats)
compileTimeKeys.append(entry.key);
std::sort(compileTimeKeys.begin(), compileTimeKeys.end());
for (CString key : compileTimeKeys)
printf("%40s: %.3lf ms\n", key.data(), compileTimeStats.get(key));
+#endif
return result;
}
Modified: trunk/Source/_javascript_Core/runtime/Options.h (200530 => 200531)
--- trunk/Source/_javascript_Core/runtime/Options.h 2016-05-06 22:47:16 UTC (rev 200530)
+++ trunk/Source/_javascript_Core/runtime/Options.h 2016-05-06 22:57:32 UTC (rev 200531)
@@ -168,7 +168,9 @@
v(bool, verboseFTLOSRExit, false, Normal, nullptr) \
v(bool, verboseCallLink, false, Normal, nullptr) \
v(bool, verboseCompilationQueue, false, Normal, nullptr) \
- v(bool, reportCompileTimes, false, Normal, "dumps JS function signature and the time it took to compile") \
+ v(bool, reportCompileTimes, false, Normal, "dumps JS function signature and the time it took to compile in all tiers") \
+ 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, reportTotalCompileTimes, false, Normal, nullptr) \
v(bool, verboseCFA, false, Normal, nullptr) \