From 49079f7d3ee6eaacfe941fda75f400f2a4413051 Mon Sep 17 00:00:00 2001 From: "fpizlo@apple.com" Date: Mon, 9 Dec 2013 22:02:46 +0000 Subject: [PATCH] CSE should work in SSA https://bugs.webkit.org/show_bug.cgi?id=125430 Reviewed by Oliver Hunt and Mark Hahnenberg. * dfg/DFGCSEPhase.cpp: (JSC::DFG::CSEPhase::run): (JSC::DFG::CSEPhase::performNodeCSE): * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160328 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Source/JavaScriptCore/ChangeLog | 13 +++++++++++++ Source/JavaScriptCore/dfg/DFGCSEPhase.cpp | 21 +++++++++++++++++---- Source/JavaScriptCore/dfg/DFGPlan.cpp | 1 + 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog index 161c8da63cb..bb4fd1651b5 100644 --- a/Source/JavaScriptCore/ChangeLog +++ b/Source/JavaScriptCore/ChangeLog @@ -1,3 +1,16 @@ +2013-12-08 Filip Pizlo + + CSE should work in SSA + https://bugs.webkit.org/show_bug.cgi?id=125430 + + Reviewed by Oliver Hunt and Mark Hahnenberg. + + * dfg/DFGCSEPhase.cpp: + (JSC::DFG::CSEPhase::run): + (JSC::DFG::CSEPhase::performNodeCSE): + * dfg/DFGPlan.cpp: + (JSC::DFG::Plan::compileInThreadImpl): + 2013-12-09 Joseph Pecoraro Remove docs/make-bytecode-docs.pl diff --git a/Source/JavaScriptCore/dfg/DFGCSEPhase.cpp b/Source/JavaScriptCore/dfg/DFGCSEPhase.cpp index d9dd3a0088e..9effa26d160 100644 --- a/Source/JavaScriptCore/dfg/DFGCSEPhase.cpp +++ b/Source/JavaScriptCore/dfg/DFGCSEPhase.cpp @@ -48,15 +48,21 @@ public: bool run() { - ASSERT((cseMode == NormalCSE) == (m_graph.m_fixpointState == FixpointNotConverged)); ASSERT(m_graph.m_fixpointState != BeforeFixpoint); m_changed = false; m_graph.clearReplacements(); - for (unsigned blockIndex = 0; blockIndex < m_graph.numBlocks(); ++blockIndex) - performBlockCSE(m_graph.block(blockIndex)); + if (m_graph.m_form == SSA) { + Vector depthFirst; + m_graph.getBlocksInDepthFirstOrder(depthFirst); + for (unsigned i = 0; i < depthFirst.size(); ++i) + performBlockCSE(depthFirst[i]); + } else { + for (unsigned blockIndex = 0; blockIndex < m_graph.numBlocks(); ++blockIndex) + performBlockCSE(m_graph.block(blockIndex)); + } return m_changed; } @@ -1015,8 +1021,10 @@ private: if (cseMode == NormalCSE) m_graph.performSubstitution(node); - if (node->op() == SetLocal) + if (node->containsMovHint()) { + ASSERT(node->op() != ZombieHint); node->child1()->mergeFlags(NodeRelevantToOSR); + } switch (node->op()) { @@ -1120,6 +1128,11 @@ private: } case Flush: { + if (m_graph.m_form == SSA) { + // FIXME: Enable Flush store elimination in SSA form. + // https://bugs.webkit.org/show_bug.cgi?id=125429 + break; + } VariableAccessData* variableAccessData = node->variableAccessData(); VirtualRegister local = variableAccessData->local(); Node* replacement = node->child1().node(); diff --git a/Source/JavaScriptCore/dfg/DFGPlan.cpp b/Source/JavaScriptCore/dfg/DFGPlan.cpp index 74d30b41b61..e980bccec6d 100644 --- a/Source/JavaScriptCore/dfg/DFGPlan.cpp +++ b/Source/JavaScriptCore/dfg/DFGPlan.cpp @@ -269,6 +269,7 @@ Plan::CompilationPath Plan::compileInThreadImpl(LongLivedState& longLivedState) performLivenessAnalysis(dfg); performCFA(dfg); performLICM(dfg); + performCSE(dfg); performLivenessAnalysis(dfg); performCFA(dfg); if (Options::validateFTLOSRExitLiveness()) -- GitLab