Changeset 161126 in webkit for trunk/Source/JavaScriptCore/dfg/DFGDCEPhase.cpp
- Timestamp:
- Dec 29, 2013, 1:50:55 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/dfg/DFGDCEPhase.cpp
r156047 r161126 114 114 fixupBlock(depthFirst[i]); 115 115 } else { 116 RELEASE_ASSERT(m_graph.m_form == ThreadedCPS); 117 116 118 for (BlockIndex blockIndex = 0; blockIndex < m_graph.numBlocks(); ++blockIndex) 117 119 fixupBlock(m_graph.block(blockIndex)); 120 121 cleanVariables(m_graph.m_arguments); 118 122 } 119 123 … … 153 157 if (!block) 154 158 return; 159 160 switch (m_graph.m_form) { 161 case SSA: 162 break; 163 164 case ThreadedCPS: { 165 // Clean up variable links for the block. We need to do this before the actual DCE 166 // because we need to see GetLocals, so we can bypass them in situations where the 167 // vars-at-tail point to a GetLocal, the GetLocal is dead, but the Phi it points 168 // to is alive. 169 170 for (unsigned phiIndex = 0; phiIndex < block->phis.size(); ++phiIndex) { 171 if (!block->phis[phiIndex]->shouldGenerate()) { 172 // FIXME: We could actually free nodes here. Except that it probably 173 // doesn't matter, since we don't add any nodes after this phase. 174 // https://bugs.webkit.org/show_bug.cgi?id=126239 175 block->phis[phiIndex--] = block->phis.last(); 176 block->phis.removeLast(); 177 } 178 } 179 180 cleanVariables(block->variablesAtHead); 181 cleanVariables(block->variablesAtTail); 182 break; 183 } 184 185 default: 186 RELEASE_ASSERT_NOT_REACHED(); 187 return; 188 } 155 189 156 190 for (unsigned indexInBlock = block->size(); indexInBlock--;) { … … 160 194 161 195 switch (node->op()) { 162 case SetLocal:163 196 case MovHint: { 164 ASSERT((node->op() == SetLocal) == (m_graph.m_form == ThreadedCPS)); 165 if (node->child1().willNotHaveCheck()) { 166 // Consider the possibility that UInt32ToNumber is dead but its 167 // child isn't; if so then we should MovHint the child. 168 if (!node->child1()->shouldGenerate() 169 && permitsOSRBackwardRewiring(node->child1()->op())) 170 node->child1() = node->child1()->child1(); 171 172 if (!node->child1()->shouldGenerate()) { 173 node->setOpAndDefaultFlags(ZombieHint); 174 node->child1() = Edge(); 175 break; 176 } 177 node->setOpAndDefaultFlags(MovHint); 197 ASSERT(node->child1().useKind() == UntypedUse); 198 if (!node->child1()->shouldGenerate()) { 199 node->setOpAndDefaultFlags(ZombieHint); 200 node->child1() = Edge(); 178 201 break; 179 202 } 180 node->setOpAndDefaultFlags(MovHintAndCheck); 181 node->setRefCount(1); 203 node->setOpAndDefaultFlags(MovHint); 182 204 break; 183 205 } 184 185 case GetLocal: 186 case SetArgument: { 187 if (m_graph.m_form == ThreadedCPS) { 188 // Leave them as not shouldGenerate. 189 break; 190 } 191 } 192 206 207 case ZombieHint: { 208 // Currently we assume that DCE runs only once. 209 RELEASE_ASSERT_NOT_REACHED(); 210 break; 211 } 212 193 213 default: { 194 214 if (node->flags() & NodeHasVarArgs) { … … 229 249 } 230 250 251 template<typename VariablesVectorType> 252 void cleanVariables(VariablesVectorType& variables) 253 { 254 for (unsigned i = variables.size(); i--;) { 255 Node* node = variables[i]; 256 if (!node) 257 continue; 258 if (node->op() != Phantom && node->shouldGenerate()) 259 continue; 260 if (node->op() == GetLocal) { 261 node = node->child1().node(); 262 ASSERT(node->op() == Phi); 263 if (node->shouldGenerate()) { 264 variables[i] = node; 265 continue; 266 } 267 } 268 variables[i] = 0; 269 } 270 } 271 231 272 Vector<Node*, 128> m_worklist; 232 273 InsertionSet m_insertionSet;
Note:
See TracChangeset
for help on using the changeset viewer.