WebKit Bugzilla
Attachment 339471 Details for
Bug 185270
: Make it easy to log compile times for all optimizing tiers
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
the patch
blah.patch (text/plain), 25.13 KB, created by
Filip Pizlo
on 2018-05-03 14:52:40 PDT
(
hide
)
Description:
the patch
Filename:
MIME Type:
Creator:
Filip Pizlo
Created:
2018-05-03 14:52:40 PDT
Size:
25.13 KB
patch
obsolete
>Index: Source/JavaScriptCore/ChangeLog >=================================================================== >--- Source/JavaScriptCore/ChangeLog (revision 231329) >+++ Source/JavaScriptCore/ChangeLog (working copy) >@@ -1,3 +1,37 @@ >+2018-05-03 Filip Pizlo <fpizlo@apple.com> >+ >+ Make it easy to log compile times for all optimizing tiers >+ https://bugs.webkit.org/show_bug.cgi?id=185270 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ 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. >+ >+ * JavaScriptCore.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): >+ * runtime/CompilerTimingScope.cpp: Added. >+ (JSC::CompilerTimingScope::CompilerTimingScope): >+ (JSC::CompilerTimingScope::~CompilerTimingScope): >+ * runtime/CompilerTimingScope.h: Added. >+ * runtime/Options.cpp: >+ (JSC::recomputeDependentOptions): >+ * runtime/Options.h: >+ > 2018-05-03 Michael Saboff <msaboff@apple.com> > > WebContent crash loading page on seas.upenn.edu @ JavaScriptCore: vmEntryToJavaScript >Index: Source/JavaScriptCore/Sources.txt >=================================================================== >--- Source/JavaScriptCore/Sources.txt (revision 231328) >+++ Source/JavaScriptCore/Sources.txt (working copy) >@@ -159,7 +159,6 @@ b3/B3StackmapValue.cpp > 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/CommonIdentifiers.cpp > runtime/CommonSlowPaths.cpp > runtime/CommonSlowPathsExceptions.cpp > runtime/CompilationResult.cpp >+runtime/CompilerTimingScope.cpp > runtime/Completion.cpp > runtime/ConfigFile.cpp > runtime/ConsoleClient.cpp >Index: Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj >=================================================================== >--- Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj (revision 231328) >+++ Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj (working copy) >@@ -422,6 +422,7 @@ > 0F7DF1461E2BEF6A0095951B /* BlockDirectoryInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F7DF1451E2BEF680095951B /* BlockDirectoryInlines.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 0F7F988C1D9596C800F4F12E /* DFGStoreBarrierClusteringPhase.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F7F988A1D9596C300F4F12E /* DFGStoreBarrierClusteringPhase.h */; }; > 0F8023EA1613832B00A0BA45 /* ByValInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F8023E91613832300A0BA45 /* ByValInfo.h */; settings = {ATTRIBUTES = (Private, ); }; }; >+ 0F818A15209B99AA00A66D9B /* CompilerTimingScope.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F818A13209B99A500A66D9B /* CompilerTimingScope.h */; }; > 0F8335B81639C1EA001443B5 /* ArrayAllocationProfile.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F8335B51639C1E3001443B5 /* ArrayAllocationProfile.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 0F8364B7164B0C110053329A /* DFGBranchDirection.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F8364B5164B0C0E0053329A /* DFGBranchDirection.h */; }; > 0F86A26F1D6F7B3300CB0C92 /* GCTypeMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F86A26E1D6F7B3100CB0C92 /* GCTypeMap.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>"; }; >@@ -2480,6 +2480,8 @@ > 0F7F98891D9596C300F4F12E /* DFGStoreBarrierClusteringPhase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGStoreBarrierClusteringPhase.cpp; path = dfg/DFGStoreBarrierClusteringPhase.cpp; sourceTree = "<group>"; }; > 0F7F988A1D9596C300F4F12E /* DFGStoreBarrierClusteringPhase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGStoreBarrierClusteringPhase.h; path = dfg/DFGStoreBarrierClusteringPhase.h; sourceTree = "<group>"; }; > 0F8023E91613832300A0BA45 /* ByValInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ByValInfo.h; sourceTree = "<group>"; }; >+ 0F818A13209B99A500A66D9B /* CompilerTimingScope.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CompilerTimingScope.h; sourceTree = "<group>"; }; >+ 0F818A14209B99A500A66D9B /* CompilerTimingScope.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CompilerTimingScope.cpp; sourceTree = "<group>"; }; > 0F8335B41639C1E3001443B5 /* ArrayAllocationProfile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ArrayAllocationProfile.cpp; sourceTree = "<group>"; }; > 0F8335B51639C1E3001443B5 /* ArrayAllocationProfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArrayAllocationProfile.h; sourceTree = "<group>"; }; > 0F8364B5164B0C0E0053329A /* DFGBranchDirection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGBranchDirection.h; path = dfg/DFGBranchDirection.h; 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 */, >@@ -6467,6 +6468,8 @@ > 6553A33017A1F1EE008CF6F3 /* CommonSlowPathsExceptions.h */, > A7E5A3A51797432D00E893C0 /* CompilationResult.cpp */, > A7E5A3A61797432D00E893C0 /* CompilationResult.h */, >+ 0F818A14209B99A500A66D9B /* CompilerTimingScope.cpp */, >+ 0F818A13209B99A500A66D9B /* CompilerTimingScope.h */, > 969A09220ED1E09C00F1F681 /* Completion.cpp */, > F5BB2BC5030F772101FCFE1D /* Completion.h */, > 0FDB2CE9174896C7007B3C1B /* ConcurrentJSLock.h */, >@@ -6595,9 +6598,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 +6708,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 +6799,10 @@ > 53F256E11B87E28000B4B768 /* JSTypedArrayViewPrototype.cpp */, > 53917E7C1B791106000EBD33 /* JSTypedArrayViewPrototype.h */, > 6507D2970E871E4A00D7D896 /* JSTypeInfo.h */, >- 0F2B66D417B6B5AB00A7AE3F /* JSUint16Array.h */, >- 0F2B66D517B6B5AB00A7AE3F /* JSUint32Array.h */, > 0F2B66D217B6B5AB00A7AE3F /* JSUint8Array.h */, > 0F2B66D317B6B5AB00A7AE3F /* JSUint8ClampedArray.h */, >+ 0F2B66D417B6B5AB00A7AE3F /* JSUint16Array.h */, >+ 0F2B66D517B6B5AB00A7AE3F /* JSUint32Array.h */, > A7CA3AE117DA41AE006538AF /* JSWeakMap.cpp */, > A7CA3AE217DA41AE006538AF /* JSWeakMap.h */, > 709FB8611AE335C60039D069 /* JSWeakSet.cpp */, >@@ -7008,11 +7011,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 */, >@@ -8623,6 +8626,7 @@ > A741017F179DAF80002EB8BA /* DFGSaneStringGetByValSlowPathGenerator.h in Headers */, > 0F2FCCFD18A60070001A27F8 /* DFGScannable.h in Headers */, > 86ECA3FA132DF25A002B2AD7 /* DFGScoreBoard.h in Headers */, >+ 0F818A15209B99AA00A66D9B /* CompilerTimingScope.h in Headers */, > 0F1E3A67153A21E2000F9456 /* DFGSilentRegisterSavePlan.h in Headers */, > 0FFB921D16D02F300055A5DB /* DFGSlowPathGenerator.h in Headers */, > E322E5A31DA64439006E7709 /* DFGSnippetParams.h in Headers */, >Index: Source/JavaScriptCore/b3/B3Common.cpp >=================================================================== >--- Source/JavaScriptCore/b3/B3Common.cpp (revision 231328) >+++ Source/JavaScriptCore/b3/B3Common.cpp (working copy) >@@ -65,11 +65,6 @@ bool shouldSaveIRBeforePhase() > return Options::verboseValidationFailure(); > } > >-bool shouldMeasurePhaseTiming() >-{ >- return Options::logB3PhaseTimes(); >-} >- > std::optional<GPRReg> pinnedExtendedOffsetAddrRegister() > { > #if CPU(ARM64) >Index: Source/JavaScriptCore/b3/B3Common.h >=================================================================== >--- Source/JavaScriptCore/b3/B3Common.h (revision 231328) >+++ Source/JavaScriptCore/b3/B3Common.h (working copy) >@@ -45,7 +45,6 @@ bool shouldDumpIRAtEachPhase(B3Complitat > bool shouldValidateIR(); > bool shouldValidateIRAtEachPhase(); > bool shouldSaveIRBeforePhase(); >-bool shouldMeasurePhaseTiming(); > > template<typename BitsType, typename InputType> > inline bool isIdentical(InputType left, InputType right) >Index: Source/JavaScriptCore/b3/B3TimingScope.cpp >=================================================================== >--- Source/JavaScriptCore/b3/B3TimingScope.cpp (revision 231328) >+++ Source/JavaScriptCore/b3/B3TimingScope.cpp (nonexistent) >@@ -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) >- >Index: Source/JavaScriptCore/b3/B3TimingScope.h >=================================================================== >--- Source/JavaScriptCore/b3/B3TimingScope.h (revision 231328) >+++ Source/JavaScriptCore/b3/B3TimingScope.h (working copy) >@@ -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 >Index: Source/JavaScriptCore/dfg/DFGPhase.h >=================================================================== >--- Source/JavaScriptCore/dfg/DFGPhase.h (revision 231328) >+++ Source/JavaScriptCore/dfg/DFGPhase.h (working copy) >@@ -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 @@ private: > 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; >Index: Source/JavaScriptCore/dfg/DFGPlan.cpp >=================================================================== >--- Source/JavaScriptCore/dfg/DFGPlan.cpp (revision 231328) >+++ Source/JavaScriptCore/dfg/DFGPlan.cpp (working copy) >@@ -181,7 +181,7 @@ void Plan::compileInThread(ThreadData* t > > 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(); >Index: Source/JavaScriptCore/runtime/CompilerTimingScope.cpp >=================================================================== >--- Source/JavaScriptCore/runtime/CompilerTimingScope.cpp (nonexistent) >+++ Source/JavaScriptCore/runtime/CompilerTimingScope.cpp (working copy) >@@ -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 >+ >+ >Index: Source/JavaScriptCore/runtime/CompilerTimingScope.h >=================================================================== >--- Source/JavaScriptCore/runtime/CompilerTimingScope.h (nonexistent) >+++ Source/JavaScriptCore/runtime/CompilerTimingScope.h (working copy) >@@ -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 >+ >Index: Source/JavaScriptCore/runtime/Options.cpp >=================================================================== >--- Source/JavaScriptCore/runtime/Options.cpp (revision 231328) >+++ Source/JavaScriptCore/runtime/Options.cpp (working copy) >@@ -426,7 +426,7 @@ static void recomputeDependentOptions() > || Options::reportBaselineCompileTimes() > || Options::reportDFGCompileTimes() > || Options::reportFTLCompileTimes() >- || Options::reportDFGPhaseTimes() >+ || Options::logPhaseTimes() > || Options::verboseCFA() > || Options::verboseDFGFailure() > || Options::verboseFTLFailure()) >Index: Source/JavaScriptCore/runtime/Options.h >=================================================================== >--- Source/JavaScriptCore/runtime/Options.h (revision 231328) >+++ Source/JavaScriptCore/runtime/Options.h (working copy) >@@ -205,7 +205,6 @@ constexpr bool enableWebAssemblyStreamin > 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 @@ constexpr bool enableWebAssemblyStreamin > 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) \
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
keith_miller
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 185270
:
339471
|
339481