Changeset 183497 in webkit for trunk/Source/JavaScriptCore/dfg/DFGDCEPhase.cpp
- Timestamp:
- Apr 28, 2015, 12:27:23 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/dfg/DFGDCEPhase.cpp
r183401 r183497 51 51 m_graph.computeRefCounts(); 52 52 53 if (m_graph.m_form == SSA) { 54 for (BasicBlock* block : m_graph.blocksInPreOrder()) 55 fixupBlock(block); 56 57 // This is like cleanVariables, but has a much simpler approach to GetLocal. 58 for (unsigned i = m_graph.m_arguments.size(); i--;) { 59 Node* node = m_graph.m_arguments[i]; 60 if (!node) 61 continue; 62 if (node->op() != Phantom && node->op() != Check && node->shouldGenerate()) 63 continue; 64 m_graph.m_arguments[i] = nullptr; 65 } 66 } else { 67 RELEASE_ASSERT(m_graph.m_form == ThreadedCPS); 68 69 for (BlockIndex blockIndex = 0; blockIndex < m_graph.numBlocks(); ++blockIndex) 70 fixupBlock(m_graph.block(blockIndex)); 71 cleanVariables(m_graph.m_arguments); 72 } 53 for (BasicBlock* block : m_graph.blocksInPreOrder()) 54 fixupBlock(block); 73 55 56 cleanVariables(m_graph.m_arguments); 57 74 58 // Just do a basic Phantom/Check clean-up. 75 59 for (BlockIndex blockIndex = m_graph.numBlocks(); blockIndex--;) { … … 105 89 if (!block) 106 90 return; 107 108 switch (m_graph.m_form) { 109 case SSA: 110 break; 111 112 case ThreadedCPS: { 113 // Clean up variable links for the block. We need to do this before the actual DCE 114 // because we need to see GetLocals, so we can bypass them in situations where the 115 // vars-at-tail point to a GetLocal, the GetLocal is dead, but the Phi it points 116 // to is alive. 117 91 92 if (m_graph.m_form == ThreadedCPS) { 118 93 for (unsigned phiIndex = 0; phiIndex < block->phis.size(); ++phiIndex) { 119 if (!block->phis[phiIndex]->shouldGenerate()) { 120 // FIXME: We could actually free nodes here. Except that it probably 121 // doesn't matter, since we don't add any nodes after this phase. 122 // https://bugs.webkit.org/show_bug.cgi?id=126239 94 Node* phi = block->phis[phiIndex]; 95 if (!phi->shouldGenerate()) { 96 m_graph.m_allocator.free(phi); 123 97 block->phis[phiIndex--] = block->phis.last(); 124 98 block->phis.removeLast(); … … 128 102 cleanVariables(block->variablesAtHead); 129 103 cleanVariables(block->variablesAtTail); 130 break;131 }132 133 default:134 RELEASE_ASSERT_NOT_REACHED();135 return;136 104 } 137 105 … … 142 110 continue; 143 111 144 switch (node->op()) { 145 case MovHint: 146 case ZombieHint: 147 // These are not killable. (They once were.) 148 RELEASE_ASSERT_NOT_REACHED(); 112 if (node->flags() & NodeHasVarArgs) { 113 for (unsigned childIdx = node->firstChild(); childIdx < node->firstChild() + node->numChildren(); childIdx++) { 114 Edge edge = m_graph.m_varArgChildren[childIdx]; 115 116 if (!edge || edge.willNotHaveCheck()) 117 continue; 118 119 m_insertionSet.insertNode(indexInBlock, SpecNone, Check, node->origin, edge); 120 } 149 121 150 default: { 151 if (node->flags() & NodeHasVarArgs) { 152 for (unsigned childIdx = node->firstChild(); childIdx < node->firstChild() + node->numChildren(); childIdx++) { 153 Edge edge = m_graph.m_varArgChildren[childIdx]; 154 155 if (!edge || edge.isProved() || edge.willNotHaveCheck()) 156 continue; 157 158 m_insertionSet.insertNode(indexInBlock, SpecNone, Check, node->origin, edge); 159 } 160 161 node->convertToPhantom(); 162 node->children.reset(); 163 node->setRefCount(1); 164 break; 165 } 166 167 node->convertToCheck(); 168 for (unsigned i = 0; i < AdjacencyList::Size; ++i) { 169 Edge edge = node->children.child(i); 170 if (!edge) 171 continue; 172 if (edge.isProved() || edge.willNotHaveCheck()) 173 node->children.removeEdge(i--); 174 } 122 node->setOpAndDefaultFlags(Check); 123 node->children.reset(); 175 124 node->setRefCount(1); 176 break; 177 } } 125 continue; 126 } 127 128 node->remove(); 129 node->setRefCount(1); 178 130 } 179 131 … … 188 140 if (!node) 189 141 continue; 190 if (node->op() != Phantom && node->op() !=Check && node->shouldGenerate())142 if (node->op() != Check && node->shouldGenerate()) 191 143 continue; 192 if (node->op() == GetLocal) { 193 node = node->child1().node(); 194 195 ASSERT(node->op() == Phi || node->op() == SetArgument); 196 197 if (node->shouldGenerate()) { 198 variables[i] = node; 199 continue; 200 } 201 } 202 variables[i] = 0; 144 variables[i] = nullptr; 203 145 } 204 146 }
Note:
See TracChangeset
for help on using the changeset viewer.