Diff
Modified: branches/ftlopt/Source/_javascript_Core/ChangeLog (169948 => 169949)
--- branches/ftlopt/Source/_javascript_Core/ChangeLog 2014-06-13 21:13:43 UTC (rev 169948)
+++ branches/ftlopt/Source/_javascript_Core/ChangeLog 2014-06-13 21:30:27 UTC (rev 169949)
@@ -1,3 +1,25 @@
+2014-06-12 Filip Pizlo <fpi...@apple.com>
+
+ [ftlopt] Constant folding and strength reduction should work in SSA
+ https://bugs.webkit.org/show_bug.cgi?id=133839
+
+ Reviewed by Oliver Hunt.
+
+ * dfg/DFGAtTailAbstractState.cpp:
+ (JSC::DFG::AtTailAbstractState::AtTailAbstractState):
+ (JSC::DFG::AtTailAbstractState::forNode):
+ * dfg/DFGAtTailAbstractState.h:
+ * dfg/DFGConstantFoldingPhase.cpp:
+ (JSC::DFG::ConstantFoldingPhase::foldConstants):
+ * dfg/DFGGraph.cpp:
+ (JSC::DFG::Graph::convertToConstant):
+ * dfg/DFGIntegerCheckCombiningPhase.cpp:
+ (JSC::DFG::IntegerCheckCombiningPhase::rangeKeyAndAddend): Fix an unrelated regression that this uncovered.
+ * dfg/DFGLICMPhase.cpp:
+ (JSC::DFG::LICMPhase::LICMPhase):
+ * dfg/DFGPlan.cpp:
+ (JSC::DFG::Plan::compileInThreadImpl):
+
2014-06-11 Filip Pizlo <fpi...@apple.com>
[ftlopt] DFG get_by_id should inline chain accesses with a slightly polymorphic base
Modified: branches/ftlopt/Source/_javascript_Core/dfg/DFGAtTailAbstractState.cpp (169948 => 169949)
--- branches/ftlopt/Source/_javascript_Core/dfg/DFGAtTailAbstractState.cpp 2014-06-13 21:13:43 UTC (rev 169948)
+++ branches/ftlopt/Source/_javascript_Core/dfg/DFGAtTailAbstractState.cpp 2014-06-13 21:30:27 UTC (rev 169949)
@@ -32,8 +32,9 @@
namespace JSC { namespace DFG {
-AtTailAbstractState::AtTailAbstractState()
- : m_block(0)
+AtTailAbstractState::AtTailAbstractState(Graph& graph)
+ : m_graph(graph)
+ , m_block(0)
{
}
@@ -47,7 +48,7 @@
AbstractValue& AtTailAbstractState::forNode(Node* node)
{
HashMap<Node*, AbstractValue>::iterator iter = m_block->ssa->valuesAtTail.find(node);
- ASSERT(iter != m_block->ssa->valuesAtTail.end());
+ DFG_ASSERT(m_graph, node, iter != m_block->ssa->valuesAtTail.end());
return iter->value;
}
Modified: branches/ftlopt/Source/_javascript_Core/dfg/DFGAtTailAbstractState.h (169948 => 169949)
--- branches/ftlopt/Source/_javascript_Core/dfg/DFGAtTailAbstractState.h 2014-06-13 21:13:43 UTC (rev 169948)
+++ branches/ftlopt/Source/_javascript_Core/dfg/DFGAtTailAbstractState.h 2014-06-13 21:30:27 UTC (rev 169949)
@@ -36,7 +36,7 @@
class AtTailAbstractState {
public:
- AtTailAbstractState();
+ AtTailAbstractState(Graph&);
~AtTailAbstractState();
@@ -63,6 +63,7 @@
void setFoundConstants(bool) { }
private:
+ Graph& m_graph;
BasicBlock* m_block;
};
Modified: branches/ftlopt/Source/_javascript_Core/dfg/DFGConstantFoldingPhase.cpp (169948 => 169949)
--- branches/ftlopt/Source/_javascript_Core/dfg/DFGConstantFoldingPhase.cpp 2014-06-13 21:13:43 UTC (rev 169948)
+++ branches/ftlopt/Source/_javascript_Core/dfg/DFGConstantFoldingPhase.cpp 2014-06-13 21:30:27 UTC (rev 169949)
@@ -294,11 +294,6 @@
NodeOrigin origin = node->origin;
AdjacencyList children = node->children;
- if (node->op() == GetLocal)
- m_graph.dethread();
- else
- ASSERT(!node->hasVariableAccessData(m_graph));
-
m_graph.convertToConstant(node, value);
m_insertionSet.insertNode(
indexInBlock, SpecNone, Phantom, origin, children);
Modified: branches/ftlopt/Source/_javascript_Core/dfg/DFGGraph.cpp (169948 => 169949)
--- branches/ftlopt/Source/_javascript_Core/dfg/DFGGraph.cpp 2014-06-13 21:13:43 UTC (rev 169948)
+++ branches/ftlopt/Source/_javascript_Core/dfg/DFGGraph.cpp 2014-06-13 21:30:27 UTC (rev 169949)
@@ -957,10 +957,12 @@
{
if (value->structure())
assertIsWatched(value->structure());
- if (node->op() == GetLocal)
- dethread();
- else
- ASSERT(!node->hasVariableAccessData(*this));
+ if (m_form == ThreadedCPS) {
+ if (node->op() == GetLocal)
+ dethread();
+ else
+ ASSERT(!node->hasVariableAccessData(*this));
+ }
node->convertToConstant(value);
}
Modified: branches/ftlopt/Source/_javascript_Core/dfg/DFGIntegerCheckCombiningPhase.cpp (169948 => 169949)
--- branches/ftlopt/Source/_javascript_Core/dfg/DFGIntegerCheckCombiningPhase.cpp 2014-06-13 21:13:43 UTC (rev 169948)
+++ branches/ftlopt/Source/_javascript_Core/dfg/DFGIntegerCheckCombiningPhase.cpp 2014-06-13 21:30:27 UTC (rev 169949)
@@ -331,7 +331,7 @@
} else if (
index->op() == ArithAdd
&& index->isBinaryUseKind(Int32Use)
- && node->child2()->isInt32Constant()) {
+ && index->child2()->isInt32Constant()) {
source = index->child1();
addend = index->child2()->asInt32();
} else {
Modified: branches/ftlopt/Source/_javascript_Core/dfg/DFGLICMPhase.cpp (169948 => 169949)
--- branches/ftlopt/Source/_javascript_Core/dfg/DFGLICMPhase.cpp 2014-06-13 21:13:43 UTC (rev 169948)
+++ branches/ftlopt/Source/_javascript_Core/dfg/DFGLICMPhase.cpp 2014-06-13 21:30:27 UTC (rev 169949)
@@ -62,6 +62,7 @@
public:
LICMPhase(Graph& graph)
: Phase(graph, "LICM")
+ , m_state(graph)
, m_interpreter(graph, m_state)
{
}
Modified: branches/ftlopt/Source/_javascript_Core/dfg/DFGPlan.cpp (169948 => 169949)
--- branches/ftlopt/Source/_javascript_Core/dfg/DFGPlan.cpp 2014-06-13 21:13:43 UTC (rev 169948)
+++ branches/ftlopt/Source/_javascript_Core/dfg/DFGPlan.cpp 2014-06-13 21:30:27 UTC (rev 169949)
@@ -264,8 +264,6 @@
if (logCompilationChanges(mode))
dataLogF("DFG optimization fixpoint converged in %u iterations.\n", count);
- dfg.m_fixpointState = FixpointConverged;
-
// If we're doing validation, then run some analyses, to give them an opportunity
// to self-validate. Now is as good a time as any to do this.
if (validationEnabled()) {
@@ -275,6 +273,8 @@
switch (mode) {
case DFGMode: {
+ dfg.m_fixpointState = FixpointConverged;
+
performTierUpCheckInjection(dfg);
performStoreBarrierElision(dfg);
@@ -314,12 +314,20 @@
performCSE(dfg);
performLivenessAnalysis(dfg);
performCFA(dfg);
+ performConstantFolding(dfg);
+ if (performStrengthReduction(dfg)) {
+ // State-at-tail and state-at-head will be invalid if we did strength reduction since
+ // it might increase live ranges.
+ performLivenessAnalysis(dfg);
+ performCFA(dfg);
+ }
performLICM(dfg);
performIntegerCheckCombining(dfg);
performCSE(dfg);
// At this point we're not allowed to do any further code motion because our reasoning
// about code motion assumes that it's OK to insert GC points in random places.
+ dfg.m_fixpointState = FixpointConverged;
performStoreBarrierElision(dfg);
performLivenessAnalysis(dfg);