diff options
Diffstat (limited to 'Source/JavaScriptCore/dfg/DFGFixupPhase.cpp')
-rw-r--r-- | Source/JavaScriptCore/dfg/DFGFixupPhase.cpp | 44 |
1 files changed, 16 insertions, 28 deletions
diff --git a/Source/JavaScriptCore/dfg/DFGFixupPhase.cpp b/Source/JavaScriptCore/dfg/DFGFixupPhase.cpp index be5811772..aa2d5dff4 100644 --- a/Source/JavaScriptCore/dfg/DFGFixupPhase.cpp +++ b/Source/JavaScriptCore/dfg/DFGFixupPhase.cpp @@ -116,7 +116,7 @@ private: m_graph.deref(m_compileIndex); nodePtr->setArrayMode(arrayMode); - NodeIndex storage = checkArray(arrayMode, nodePtr->codeOrigin, nodePtr->child1().index(), NoNode, lengthNeedsStorage, nodePtr->shouldGenerate()); + NodeIndex storage = checkArray(arrayMode, nodePtr->codeOrigin, nodePtr->child1().index(), lengthNeedsStorage, nodePtr->shouldGenerate()); if (storage == NoNode) break; @@ -137,17 +137,17 @@ private: m_graph[node.child1()].prediction(), m_graph[node.child2()].prediction())); - blessArrayOperation(node.child1(), node.child2(), 2); + blessArrayOperation(node.child1(), 2); break; } case ArrayPush: { - blessArrayOperation(node.child1(), node.child2(), 2); + blessArrayOperation(node.child1(), 2); break; } case ArrayPop: { - blessArrayOperation(node.child1(), node.child2(), 1); + blessArrayOperation(node.child1(), 1); } case ValueToInt32: { @@ -327,7 +327,7 @@ private: m_graph[child1].prediction(), m_graph[child2].prediction())); - blessArrayOperation(child1, child2, 3); + blessArrayOperation(child1, 3); Node* nodePtr = &m_graph[m_compileIndex]; @@ -375,28 +375,25 @@ private: return nodeIndex; } - NodeIndex checkArray(Array::Mode arrayMode, CodeOrigin codeOrigin, NodeIndex array, NodeIndex index, bool (*storageCheck)(Array::Mode) = canCSEStorage, bool shouldGenerate = true) + NodeIndex checkArray(Array::Mode arrayMode, CodeOrigin codeOrigin, NodeIndex array, bool (*storageCheck)(Array::Mode) = canCSEStorage, bool shouldGenerate = true) { ASSERT(modeIsSpecific(arrayMode)); m_graph.ref(array); if (isEffectful(arrayMode)) { - if (index != NoNode) - m_graph.ref(index); - Node arrayify(Arrayify, codeOrigin, OpInfo(arrayMode), array, index); + Node arrayify(Arrayify, codeOrigin, OpInfo(arrayMode), array); arrayify.ref(); // Once because it's used as a butterfly. arrayify.ref(); // And twice because it's must-generate. NodeIndex arrayifyIndex = m_graph.size(); m_graph.append(arrayify); m_insertionSet.append(m_indexInBlock, arrayifyIndex); + ASSERT(storageCheck == canCSEStorage); ASSERT(shouldGenerate); ASSERT(canCSEStorage(arrayMode)); ASSERT(modeUsesButterfly(arrayMode)); - - if (!storageCheck(arrayMode)) - return NoNode; + return arrayifyIndex; } @@ -418,15 +415,14 @@ private: return addNode(Node(GetIndexedPropertyStorage, codeOrigin, OpInfo(arrayMode), array), shouldGenerate); } - void blessArrayOperation(Edge base, Edge index, unsigned storageChildIdx) + void blessArrayOperation(Edge base, unsigned storageChildIdx) { if (m_graph.m_fixpointState > BeforeFixpoint) return; Node* nodePtr = &m_graph[m_compileIndex]; - switch (nodePtr->arrayMode()) { - case Array::ForceExit: { + if (nodePtr->arrayMode() == Array::ForceExit) { Node forceExit(ForceOSRExit, nodePtr->codeOrigin); forceExit.ref(); NodeIndex forceExitIndex = m_graph.size(); @@ -434,23 +430,15 @@ private: m_insertionSet.append(m_indexInBlock, forceExitIndex); return; } - - case Array::Undecided: - case Array::Unprofiled: - ASSERT_NOT_REACHED(); + + if (!modeIsSpecific(nodePtr->arrayMode())) return; - case Array::Generic: + NodeIndex storage = checkArray(nodePtr->arrayMode(), nodePtr->codeOrigin, base.index()); + if (storage == NoNode) return; - default: { - NodeIndex storage = checkArray(nodePtr->arrayMode(), nodePtr->codeOrigin, base.index(), index.indexUnchecked()); - if (storage == NoNode) - return; - - m_graph.child(m_graph[m_compileIndex], storageChildIdx) = Edge(storage); - return; - } } + m_graph.child(m_graph[m_compileIndex], storageChildIdx) = Edge(storage); } void fixIntEdge(Edge& edge) |