Changeset 144862 in webkit for trunk/Source/JavaScriptCore/dfg/DFGGraph.cpp
- Timestamp:
- Mar 5, 2013, 6:27:16 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/dfg/DFGGraph.cpp
r143654 r144862 57 57 , m_form(LoadStore) 58 58 , m_unificationState(LocallyUnified) 59 , m_refCountState(EverythingIsLive) 59 60 { 60 61 ASSERT(m_profiledBlock); … … 313 314 { 314 315 dataLog("DFG for ", CodeBlockWithJITType(m_codeBlock, JITCode::DFGJIT), ":\n"); 315 dataLog(" Fixpoint state: ", m_fixpointState, "; Form: ", m_form, "; Unification state: ", m_unificationState, " \n");316 dataLog(" Fixpoint state: ", m_fixpointState, "; Form: ", m_form, "; Unification state: ", m_unificationState, "; Ref count state: ", m_refCountState, "\n"); 316 317 317 318 Node* lastNode = 0; … … 347 348 } 348 349 349 void Graph::refChildren(Node* op)350 {351 DFG_NODE_DO_TO_CHILDREN(*this, op, ref);352 }353 354 void Graph::derefChildren(Node* op)355 {356 DFG_NODE_DO_TO_CHILDREN(*this, op, deref);357 }358 359 350 void Graph::dethread() 360 351 { … … 389 380 390 381 successor->m_predecessors.append(blockIndex); 391 }392 393 void Graph::collectGarbage()394 {395 SamplingRegion samplingRegion("DFG Garbage Collection");396 397 // First reset the counts to 0 for all nodes.398 for (BlockIndex blockIndex = 0; blockIndex < m_blocks.size(); ++blockIndex) {399 BasicBlock* block = m_blocks[blockIndex].get();400 if (!block)401 continue;402 for (unsigned indexInBlock = block->size(); indexInBlock--;)403 block->at(indexInBlock)->setRefCount(0);404 for (unsigned phiIndex = block->phis.size(); phiIndex--;)405 block->phis[phiIndex]->setRefCount(0);406 }407 408 // Now find the roots: the nodes that are must-generate. Set their ref counts to409 // 1 and put them on the worklist.410 Vector<Node*, 128> worklist;411 for (BlockIndex blockIndex = 0; blockIndex < m_blocks.size(); ++blockIndex) {412 BasicBlock* block = m_blocks[blockIndex].get();413 if (!block)414 continue;415 for (unsigned indexInBlock = block->size(); indexInBlock--;) {416 Node* node = block->at(indexInBlock);417 if (!(node->flags() & NodeMustGenerate))418 continue;419 node->setRefCount(1);420 worklist.append(node);421 }422 }423 424 while (!worklist.isEmpty()) {425 Node* node = worklist.last();426 worklist.removeLast();427 ASSERT(node->shouldGenerate()); // It should not be on the worklist unless it's ref'ed.428 if (node->flags() & NodeHasVarArgs) {429 for (unsigned childIdx = node->firstChild();430 childIdx < node->firstChild() + node->numChildren();431 ++childIdx) {432 if (!m_varArgChildren[childIdx])433 continue;434 Node* childNode = m_varArgChildren[childIdx].node();435 if (childNode->postfixRef())436 continue;437 worklist.append(childNode);438 }439 } else if (node->child1()) {440 if (!node->child1()->postfixRef())441 worklist.append(node->child1().node());442 if (node->child2()) {443 if (!node->child2()->postfixRef())444 worklist.append(node->child2().node());445 if (node->child3()) {446 if (!node->child3()->postfixRef())447 worklist.append(node->child3().node());448 }449 }450 }451 }452 382 } 453 383
Note:
See TracChangeset
for help on using the changeset viewer.