summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/dfg/DFGPhase.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/JavaScriptCore/dfg/DFGPhase.h')
-rw-r--r--Source/JavaScriptCore/dfg/DFGPhase.h27
1 files changed, 19 insertions, 8 deletions
diff --git a/Source/JavaScriptCore/dfg/DFGPhase.h b/Source/JavaScriptCore/dfg/DFGPhase.h
index 6de043bbd..0fcfc5fa5 100644
--- a/Source/JavaScriptCore/dfg/DFGPhase.h
+++ b/Source/JavaScriptCore/dfg/DFGPhase.h
@@ -23,10 +23,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef DFGPhase_h
-#define DFGPhase_h
-
-#include <wtf/Platform.h>
+#pragma once
#if ENABLE(DFG_JIT)
@@ -51,6 +48,8 @@ public:
const char* name() const { return m_name; }
+ Graph& graph() { return m_graph; }
+
// Each phase must have a run() method.
protected:
@@ -60,6 +59,9 @@ protected:
VM& vm() { return m_graph.m_vm; }
CodeBlock* codeBlock() { return m_graph.m_codeBlock; }
CodeBlock* profiledBlock() { return m_graph.m_profiledBlock; }
+
+ // This runs validation, and uses the graph dump before the phase if possible.
+ void validate();
const char* m_name;
@@ -67,13 +69,25 @@ private:
// Call these hooks when starting and finishing.
void beginPhase();
void endPhase();
+
+ CString m_graphDumpBeforePhase;
};
template<typename PhaseType>
bool runAndLog(PhaseType& phase)
{
+ double before = 0;
+
+ if (UNLIKELY(Options::reportDFGPhaseTimes()))
+ before = monotonicallyIncreasingTimeMS();
+
bool result = phase.run();
- if (result && logCompilationChanges())
+
+ 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;
}
@@ -88,6 +102,3 @@ bool runPhase(Graph& graph)
} } // namespace JSC::DFG
#endif // ENABLE(DFG_JIT)
-
-#endif // DFGPhase_h
-