Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (231337 => 231338)
--- trunk/Source/_javascript_Core/ChangeLog 2018-05-04 00:40:18 UTC (rev 231337)
+++ trunk/Source/_javascript_Core/ChangeLog 2018-05-04 00:41:58 UTC (rev 231338)
@@ -1,5 +1,39 @@
2018-05-03 Filip Pizlo <fpi...@apple.com>
+ Make it easy to log compile times for all optimizing tiers
+ https://bugs.webkit.org/show_bug.cgi?id=185270
+
+ Reviewed by Keith Miller.
+
+ This makes --logPhaseTimes=true enable logging of phase times for DFG and B3 using a common
+ helper class, CompilerTimingScope. This used to be called B3::TimingScope and only B3 used
+ it.
+
+ This should help us reduce compile times by telling us where to look. So, far, it looks like
+ CFA is the worst.
+
+ * _javascript_Core.xcodeproj/project.pbxproj:
+ * Sources.txt:
+ * b3/B3Common.cpp:
+ (JSC::B3::shouldMeasurePhaseTiming): Deleted.
+ * b3/B3Common.h:
+ * b3/B3TimingScope.cpp: Removed.
+ * b3/B3TimingScope.h:
+ (JSC::B3::TimingScope::TimingScope):
+ * dfg/DFGPhase.h:
+ (JSC::DFG::runAndLog):
+ * dfg/DFGPlan.cpp:
+ (JSC::DFG::Plan::compileInThread):
+ * tools/CompilerTimingScope.cpp: Added.
+ (JSC::CompilerTimingScope::CompilerTimingScope):
+ (JSC::CompilerTimingScope::~CompilerTimingScope):
+ * tools/CompilerTimingScope.h: Added.
+ * runtime/Options.cpp:
+ (JSC::recomputeDependentOptions):
+ * runtime/Options.h:
+
+2018-05-03 Filip Pizlo <fpi...@apple.com>
+
Strings should not be allocated in a gigacage
https://bugs.webkit.org/show_bug.cgi?id=185218
Modified: trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj (231337 => 231338)
--- trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj 2018-05-04 00:40:18 UTC (rev 231337)
+++ trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj 2018-05-04 00:41:58 UTC (rev 231338)
@@ -318,6 +318,7 @@
0F4D8C751FC7A97D001D32AC /* ConstraintParallelism.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F4D8C731FC7A974001D32AC /* ConstraintParallelism.h */; settings = {ATTRIBUTES = (Private, ); }; };
0F4D8C781FCA3CFA001D32AC /* SimpleMarkingConstraint.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F4D8C771FCA3CF3001D32AC /* SimpleMarkingConstraint.h */; settings = {ATTRIBUTES = (Private, ); }; };
0F4DE1CF1C4C1B54004D6C11 /* AirFixObviousSpills.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F4DE1CD1C4C1B54004D6C11 /* AirFixObviousSpills.h */; };
+ 0F4F11E8209BCDAB00709654 /* CompilerTimingScope.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F4F11E6209BCDA100709654 /* CompilerTimingScope.h */; };
0F4F29E018B6AD1C0057BC15 /* DFGStaticExecutionCountEstimationPhase.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F4F29DE18B6AD1C0057BC15 /* DFGStaticExecutionCountEstimationPhase.h */; };
0F4F82881E2FFDE00075184C /* JSSegmentedVariableObjectHeapCellType.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F4F82861E2FFDDB0075184C /* JSSegmentedVariableObjectHeapCellType.h */; settings = {ATTRIBUTES = (Private, ); }; };
0F4F828C1E31B9760075184C /* StochasticSpaceTimeMutatorScheduler.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F4F828A1E31B9710075184C /* StochasticSpaceTimeMutatorScheduler.h */; };
@@ -2272,7 +2273,6 @@
0F4570371BE44C910062A629 /* AirEliminateDeadCode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AirEliminateDeadCode.h; path = b3/air/AirEliminateDeadCode.h; sourceTree = "<group>"; };
0F45703A1BE45F0A0062A629 /* AirReportUsedRegisters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AirReportUsedRegisters.cpp; path = b3/air/AirReportUsedRegisters.cpp; sourceTree = "<group>"; };
0F45703B1BE45F0A0062A629 /* AirReportUsedRegisters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AirReportUsedRegisters.h; path = b3/air/AirReportUsedRegisters.h; sourceTree = "<group>"; };
- 0F45703E1BE584CA0062A629 /* B3TimingScope.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = B3TimingScope.cpp; path = b3/B3TimingScope.cpp; sourceTree = "<group>"; };
0F45703F1BE584CA0062A629 /* B3TimingScope.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = B3TimingScope.h; path = b3/B3TimingScope.h; sourceTree = "<group>"; };
0F46807F14BA572700BFE272 /* JITExceptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITExceptions.cpp; sourceTree = "<group>"; };
0F46808014BA572700BFE272 /* JITExceptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITExceptions.h; sourceTree = "<group>"; };
@@ -2308,6 +2308,8 @@
0F4DE1CC1C4C1B54004D6C11 /* AirFixObviousSpills.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AirFixObviousSpills.cpp; path = b3/air/AirFixObviousSpills.cpp; sourceTree = "<group>"; };
0F4DE1CD1C4C1B54004D6C11 /* AirFixObviousSpills.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AirFixObviousSpills.h; path = b3/air/AirFixObviousSpills.h; sourceTree = "<group>"; };
0F4DE1D01C4D764B004D6C11 /* B3OriginDump.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = B3OriginDump.cpp; path = b3/B3OriginDump.cpp; sourceTree = "<group>"; };
+ 0F4F11E6209BCDA100709654 /* CompilerTimingScope.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CompilerTimingScope.h; sourceTree = "<group>"; };
+ 0F4F11E7209BCDA100709654 /* CompilerTimingScope.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CompilerTimingScope.cpp; sourceTree = "<group>"; };
0F4F29DD18B6AD1C0057BC15 /* DFGStaticExecutionCountEstimationPhase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGStaticExecutionCountEstimationPhase.cpp; path = dfg/DFGStaticExecutionCountEstimationPhase.cpp; sourceTree = "<group>"; };
0F4F29DE18B6AD1C0057BC15 /* DFGStaticExecutionCountEstimationPhase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGStaticExecutionCountEstimationPhase.h; path = dfg/DFGStaticExecutionCountEstimationPhase.h; sourceTree = "<group>"; };
0F4F82851E2FFDDB0075184C /* JSSegmentedVariableObjectHeapCellType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSegmentedVariableObjectHeapCellType.cpp; sourceTree = "<group>"; };
@@ -5210,7 +5212,6 @@
0FEC84EE1BDACDAC0080FF74 /* B3SwitchCase.h */,
0FEC84EF1BDACDAC0080FF74 /* B3SwitchValue.cpp */,
0FEC84F01BDACDAC0080FF74 /* B3SwitchValue.h */,
- 0F45703E1BE584CA0062A629 /* B3TimingScope.cpp */,
0F45703F1BE584CA0062A629 /* B3TimingScope.h */,
0FEC84F11BDACDAC0080FF74 /* B3Type.cpp */,
0FEC84F21BDACDAC0080FF74 /* B3Type.h */,
@@ -6595,9 +6596,9 @@
E178633F0D9BEC0000D74E75 /* InitializeThreading.h */,
E35E035D1B7AB43E0073AD2A /* InspectorInstrumentationObject.cpp */,
E35E035E1B7AB43E0073AD2A /* InspectorInstrumentationObject.h */,
+ A7A8AF2B17ADB5F3005AB174 /* Int8Array.h */,
A7A8AF2C17ADB5F3005AB174 /* Int16Array.h */,
A7A8AF2D17ADB5F3005AB174 /* Int32Array.h */,
- A7A8AF2B17ADB5F3005AB174 /* Int8Array.h */,
BC9BB95B0E19680600DF8855 /* InternalFunction.cpp */,
BC11667A0E199C05008066DD /* InternalFunction.h */,
A1B9E2331B4E0D6700BC7FED /* IntlCollator.cpp */,
@@ -6705,9 +6706,9 @@
BC756FC60E2031B200DE7D12 /* JSGlobalObjectFunctions.cpp */,
BC756FC70E2031B200DE7D12 /* JSGlobalObjectFunctions.h */,
79B819921DD25CF500DDC714 /* JSGlobalObjectInlines.h */,
+ 0F2B66C917B6B5AB00A7AE3F /* JSInt8Array.h */,
0F2B66CA17B6B5AB00A7AE3F /* JSInt16Array.h */,
0F2B66CB17B6B5AB00A7AE3F /* JSInt32Array.h */,
- 0F2B66C917B6B5AB00A7AE3F /* JSInt8Array.h */,
E33F507E1B8429A400413856 /* JSInternalPromise.cpp */,
E33F507F1B8429A400413856 /* JSInternalPromise.h */,
E33F50761B84225700413856 /* JSInternalPromiseConstructor.cpp */,
@@ -6796,10 +6797,10 @@
53F256E11B87E28000B4B768 /* JSTypedArrayViewPrototype.cpp */,
53917E7C1B791106000EBD33 /* JSTypedArrayViewPrototype.h */,
6507D2970E871E4A00D7D896 /* JSTypeInfo.h */,
+ 0F2B66D217B6B5AB00A7AE3F /* JSUint8Array.h */,
+ 0F2B66D317B6B5AB00A7AE3F /* JSUint8ClampedArray.h */,
0F2B66D417B6B5AB00A7AE3F /* JSUint16Array.h */,
0F2B66D517B6B5AB00A7AE3F /* JSUint32Array.h */,
- 0F2B66D217B6B5AB00A7AE3F /* JSUint8Array.h */,
- 0F2B66D317B6B5AB00A7AE3F /* JSUint8ClampedArray.h */,
A7CA3AE117DA41AE006538AF /* JSWeakMap.cpp */,
A7CA3AE217DA41AE006538AF /* JSWeakMap.h */,
709FB8611AE335C60039D069 /* JSWeakSet.cpp */,
@@ -7008,11 +7009,11 @@
0F2D4DE019832D91007D4B19 /* TypeProfilerLog.h */,
0F2D4DE319832D91007D4B19 /* TypeSet.cpp */,
0F2D4DE419832D91007D4B19 /* TypeSet.h */,
+ A7A8AF3017ADB5F3005AB174 /* Uint8Array.h */,
+ A7A8AF3117ADB5F3005AB174 /* Uint8ClampedArray.h */,
A7A8AF3217ADB5F3005AB174 /* Uint16Array.h */,
866739D113BFDE710023D87C /* Uint16WithFraction.h */,
A7A8AF3317ADB5F3005AB174 /* Uint32Array.h */,
- A7A8AF3017ADB5F3005AB174 /* Uint8Array.h */,
- A7A8AF3117ADB5F3005AB174 /* Uint8ClampedArray.h */,
0FE050231AA9095600D33B33 /* VarOffset.cpp */,
0FE050241AA9095600D33B33 /* VarOffset.h */,
E18E3A570DF9278C00D90B34 /* VM.cpp */,
@@ -7053,6 +7054,8 @@
86B5822F14D2373B00A9C306 /* CodeProfile.h */,
8603CEF214C7546400AE59E3 /* CodeProfiling.cpp */,
8603CEF314C7546400AE59E3 /* CodeProfiling.h */,
+ 0F4F11E7209BCDA100709654 /* CompilerTimingScope.cpp */,
+ 0F4F11E6209BCDA100709654 /* CompilerTimingScope.h */,
FE4BFF291AD476E700088F87 /* FunctionOverrides.cpp */,
FE4BFF2A1AD476E700088F87 /* FunctionOverrides.h */,
FEA0C4001CDD7D0E00481991 /* FunctionWhitelist.cpp */,
@@ -8775,6 +8778,7 @@
0F2B66AC17B6B53F00A7AE3F /* GCIncomingRefCounted.h in Headers */,
0F2B66AD17B6B54500A7AE3F /* GCIncomingRefCountedInlines.h in Headers */,
0F2B66AE17B6B54500A7AE3F /* GCIncomingRefCountedSet.h in Headers */,
+ 0F4F11E8209BCDAB00709654 /* CompilerTimingScope.h in Headers */,
0F2B66AF17B6B54500A7AE3F /* GCIncomingRefCountedSetInlines.h in Headers */,
2AABCDE718EF294200002096 /* GCLogging.h in Headers */,
0F9715311EB28BEE00A1645D /* GCRequest.h in Headers */,
Modified: trunk/Source/_javascript_Core/Sources.txt (231337 => 231338)
--- trunk/Source/_javascript_Core/Sources.txt 2018-05-04 00:40:18 UTC (rev 231337)
+++ trunk/Source/_javascript_Core/Sources.txt 2018-05-04 00:41:58 UTC (rev 231338)
@@ -159,7 +159,6 @@
b3/B3StackSlot.cpp
b3/B3SwitchCase.cpp
b3/B3SwitchValue.cpp
-b3/B3TimingScope.cpp
b3/B3Type.cpp
b3/B3UpsilonValue.cpp
b3/B3UseCounts.cpp
@@ -708,6 +707,7 @@
runtime/CommonSlowPaths.cpp
runtime/CommonSlowPathsExceptions.cpp
runtime/CompilationResult.cpp
+tools/CompilerTimingScope.cpp
runtime/Completion.cpp
runtime/ConfigFile.cpp
runtime/ConsoleClient.cpp
Modified: trunk/Source/_javascript_Core/b3/B3Common.cpp (231337 => 231338)
--- trunk/Source/_javascript_Core/b3/B3Common.cpp 2018-05-04 00:40:18 UTC (rev 231337)
+++ trunk/Source/_javascript_Core/b3/B3Common.cpp 2018-05-04 00:41:58 UTC (rev 231338)
@@ -65,11 +65,6 @@
return Options::verboseValidationFailure();
}
-bool shouldMeasurePhaseTiming()
-{
- return Options::logB3PhaseTimes();
-}
-
std::optional<GPRReg> pinnedExtendedOffsetAddrRegister()
{
#if CPU(ARM64)
Modified: trunk/Source/_javascript_Core/b3/B3Common.h (231337 => 231338)
--- trunk/Source/_javascript_Core/b3/B3Common.h 2018-05-04 00:40:18 UTC (rev 231337)
+++ trunk/Source/_javascript_Core/b3/B3Common.h 2018-05-04 00:41:58 UTC (rev 231338)
@@ -45,7 +45,6 @@
bool shouldValidateIR();
bool shouldValidateIRAtEachPhase();
bool shouldSaveIRBeforePhase();
-bool shouldMeasurePhaseTiming();
template<typename BitsType, typename InputType>
inline bool isIdentical(InputType left, InputType right)
Deleted: trunk/Source/_javascript_Core/b3/B3TimingScope.cpp (231337 => 231338)
--- trunk/Source/_javascript_Core/b3/B3TimingScope.cpp 2018-05-04 00:40:18 UTC (rev 231337)
+++ trunk/Source/_javascript_Core/b3/B3TimingScope.cpp 2018-05-04 00:41:58 UTC (rev 231338)
@@ -1,85 +0,0 @@
-/*
- * Copyright (C) 2015-2017 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "B3TimingScope.h"
-
-#if ENABLE(B3_JIT)
-
-#include "B3Common.h"
-#include <wtf/DataLog.h>
-#include <wtf/HashMap.h>
-#include <wtf/Lock.h>
-
-namespace JSC { namespace B3 {
-
-namespace {
-
-class State {
- WTF_MAKE_NONCOPYABLE(State);
- WTF_MAKE_FAST_ALLOCATED;
-public:
- State() { }
-
- Seconds addToTotal(const char* name, Seconds duration)
- {
- auto locker = holdLock(lock);
- return totals.add(name, Seconds(0)).iterator->value += duration;
- }
-
-private:
- HashMap<const char*, Seconds> totals;
- Lock lock;
-};
-
-State& state()
-{
- static Atomic<State*> s_state;
- return ensurePointer(s_state, [] { return new State(); });
-}
-
-} // anonymous namespace
-
-TimingScope::TimingScope(const char* name)
- : m_name(name)
-{
- if (shouldMeasurePhaseTiming())
- m_before = MonotonicTime::now();
-}
-
-TimingScope::~TimingScope()
-{
- if (shouldMeasurePhaseTiming()) {
- Seconds duration = MonotonicTime::now() - m_before;
- dataLog(
- "[B3] ", m_name, " took: ", duration.milliseconds(), " ms ",
- "(total: ", state().addToTotal(m_name, duration).milliseconds(), " ms).\n");
- }
-}
-
-} } // namespace JSC::B3
-
-#endif // ENABLE(B3_JIT)
-
Modified: trunk/Source/_javascript_Core/b3/B3TimingScope.h (231337 => 231338)
--- trunk/Source/_javascript_Core/b3/B3TimingScope.h 2018-05-04 00:40:18 UTC (rev 231337)
+++ trunk/Source/_javascript_Core/b3/B3TimingScope.h 2018-05-04 00:41:58 UTC (rev 231338)
@@ -27,20 +27,16 @@
#if ENABLE(B3_JIT)
-#include <wtf/MonotonicTime.h>
-#include <wtf/Noncopyable.h>
+#include "CompilerTimingScope.h"
namespace JSC { namespace B3 {
-class TimingScope {
- WTF_MAKE_NONCOPYABLE(TimingScope);
+class TimingScope : public CompilerTimingScope {
public:
- TimingScope(const char* name);
- ~TimingScope();
-
-private:
- const char* m_name;
- MonotonicTime m_before;
+ TimingScope(const char* name)
+ : CompilerTimingScope("B3", name)
+ {
+ }
};
} } // namespace JSC::B3
Modified: trunk/Source/_javascript_Core/dfg/DFGPhase.h (231337 => 231338)
--- trunk/Source/_javascript_Core/dfg/DFGPhase.h 2018-05-04 00:40:18 UTC (rev 231337)
+++ trunk/Source/_javascript_Core/dfg/DFGPhase.h 2018-05-04 00:41:58 UTC (rev 231338)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2011-2018 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,6 +27,7 @@
#if ENABLE(DFG_JIT)
+#include "CompilerTimingScope.h"
#include "DFGCommon.h"
#include "DFGGraph.h"
@@ -76,17 +77,10 @@
template<typename PhaseType>
bool runAndLog(PhaseType& phase)
{
- MonotonicTime before { };
-
- if (UNLIKELY(Options::reportDFGPhaseTimes()))
- before = MonotonicTime::now();
-
+ CompilerTimingScope timingScope("DFG", phase.name());
+
bool result = phase.run();
- if (UNLIKELY(Options::reportDFGPhaseTimes())) {
- MonotonicTime after = MonotonicTime::now();
- dataLogF("Phase %s took %.4f ms\n", phase.name(), (after - before).milliseconds());
- }
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 (231337 => 231338)
--- trunk/Source/_javascript_Core/dfg/DFGPlan.cpp 2018-05-04 00:40:18 UTC (rev 231337)
+++ trunk/Source/_javascript_Core/dfg/DFGPlan.cpp 2018-05-04 00:41:58 UTC (rev 231338)
@@ -181,7 +181,7 @@
CompilationScope compilationScope;
- if (logCompilationChanges(mode) || Options::reportDFGPhaseTimes())
+ if (logCompilationChanges(mode) || Options::logPhaseTimes())
dataLog("DFG(Plan) compiling ", *codeBlock, " with ", mode, ", number of instructions = ", codeBlock->instructionCount(), "\n");
CompilationPath path = compileInThreadImpl();
Modified: trunk/Source/_javascript_Core/runtime/Options.cpp (231337 => 231338)
--- trunk/Source/_javascript_Core/runtime/Options.cpp 2018-05-04 00:40:18 UTC (rev 231337)
+++ trunk/Source/_javascript_Core/runtime/Options.cpp 2018-05-04 00:41:58 UTC (rev 231338)
@@ -426,7 +426,7 @@
|| Options::reportBaselineCompileTimes()
|| Options::reportDFGCompileTimes()
|| Options::reportFTLCompileTimes()
- || Options::reportDFGPhaseTimes()
+ || Options::logPhaseTimes()
|| Options::verboseCFA()
|| Options::verboseDFGFailure()
|| Options::verboseFTLFailure())
Modified: trunk/Source/_javascript_Core/runtime/Options.h (231337 => 231338)
--- trunk/Source/_javascript_Core/runtime/Options.h 2018-05-04 00:40:18 UTC (rev 231337)
+++ trunk/Source/_javascript_Core/runtime/Options.h 2018-05-04 00:41:58 UTC (rev 231338)
@@ -205,7 +205,6 @@
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, reportParseTimes, false, Normal, "dumps JS function signature and the time it took to parse") \
v(bool, reportBytecodeCompileTimes, false, Normal, "dumps JS function signature and the time it took to bytecode compile") \
@@ -434,7 +433,7 @@
v(unsigned, fireOSRExitFuzzAt, 0, Normal, nullptr) \
v(unsigned, fireOSRExitFuzzAtOrAfter, 0, Normal, nullptr) \
\
- v(bool, logB3PhaseTimes, false, Normal, nullptr) \
+ v(bool, logPhaseTimes, false, Normal, nullptr) \
v(double, rareBlockPenalty, 0.001, Normal, nullptr) \
v(bool, airLinearScanVerbose, false, Normal, nullptr) \
v(bool, airLinearScanSpillsEverything, false, Normal, nullptr) \
Added: trunk/Source/_javascript_Core/tools/CompilerTimingScope.cpp (0 => 231338)
--- trunk/Source/_javascript_Core/tools/CompilerTimingScope.cpp (rev 0)
+++ trunk/Source/_javascript_Core/tools/CompilerTimingScope.cpp 2018-05-04 00:41:58 UTC (rev 231338)
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2015-2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CompilerTimingScope.h"
+
+#include "Options.h"
+#include <wtf/DataLog.h>
+#include <wtf/HashMap.h>
+#include <wtf/Lock.h>
+
+namespace JSC {
+
+namespace {
+
+class CompilerTimingScopeState {
+ WTF_MAKE_NONCOPYABLE(CompilerTimingScopeState);
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ CompilerTimingScopeState() { }
+
+ Seconds addToTotal(const char* compilerName, const char* name, Seconds duration)
+ {
+ auto locker = holdLock(lock);
+ return totals.add(std::make_pair(compilerName, name), Seconds(0)).iterator->value += duration;
+ }
+
+private:
+ HashMap<std::pair<const char*, const char*>, Seconds> totals;
+ Lock lock;
+};
+
+CompilerTimingScopeState& compilerTimingScopeState()
+{
+ static Atomic<CompilerTimingScopeState*> s_state;
+ return ensurePointer(s_state, [] { return new CompilerTimingScopeState(); });
+}
+
+} // anonymous namespace
+
+CompilerTimingScope::CompilerTimingScope(const char* compilerName, const char* name)
+ : m_compilerName(compilerName)
+ , m_name(name)
+{
+ if (Options::logPhaseTimes())
+ m_before = MonotonicTime::now();
+}
+
+CompilerTimingScope::~CompilerTimingScope()
+{
+ if (Options::logPhaseTimes()) {
+ Seconds duration = MonotonicTime::now() - m_before;
+ dataLog(
+ "[", m_compilerName, "] ", m_name, " took: ", duration.milliseconds(), " ms ",
+ "(total: ", compilerTimingScopeState().addToTotal(m_compilerName, m_name, duration).milliseconds(),
+ " ms).\n");
+ }
+}
+
+} // namespace JSC
+
+
Added: trunk/Source/_javascript_Core/tools/CompilerTimingScope.h (0 => 231338)
--- trunk/Source/_javascript_Core/tools/CompilerTimingScope.h (rev 0)
+++ trunk/Source/_javascript_Core/tools/CompilerTimingScope.h 2018-05-04 00:41:58 UTC (rev 231338)
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2015-2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <wtf/MonotonicTime.h>
+#include <wtf/Noncopyable.h>
+
+namespace JSC {
+
+// FIXME: We should find some way of reconciling the differences between WTF::TimingScope and this class. The differences
+// are:
+// - CompilerTimingScope knows to only do work when --logPhaseTimes=true, while TimingScope is unconditional.
+// - CompilerTimingScope reports totals on every run, while TimingScope reports averages periodically.
+
+class CompilerTimingScope {
+ WTF_MAKE_NONCOPYABLE(CompilerTimingScope);
+public:
+ CompilerTimingScope(const char* compilerName, const char* name);
+ ~CompilerTimingScope();
+
+private:
+ const char* m_compilerName;
+ const char* m_name;
+ MonotonicTime m_before;
+};
+
+} // namespace JSC
+