Changeset 119844 in webkit for trunk/Source/JavaScriptCore/heap/Heap.cpp
- Timestamp:
- Jun 8, 2012, 11:17:16 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/heap/Heap.cpp
r119633 r119844 644 644 } 645 645 646 void Heap::d iscardAllCompiledCode()647 { 648 // If JavaScript is running, it's not safe to recompile, since we'll end649 // up throwing awaycode that is live on the stack.646 void Heap::deleteAllCompiledCode() 647 { 648 // If JavaScript is running, it's not safe to delete code, since we'll end 649 // up deleting code that is live on the stack. 650 650 if (m_globalData->dynamicGlobalObject) 651 651 return; 652 652 653 for (FunctionExecutable* current = m_functions.head(); current; current = current->next()) 654 current->discardCode(); 653 for (ExecutableBase* current = m_compiledCode.head(); current; current = current->next()) { 654 if (!current->isFunctionExecutable()) 655 continue; 656 static_cast<FunctionExecutable*>(current)->clearCodeIfNotCompiling(); 657 } 658 659 m_dfgCodeBlocks.clearMarks(); 660 m_dfgCodeBlocks.deleteUnmarkedJettisonedCodeBlocks(); 661 } 662 663 void Heap::deleteUnmarkedCompiledCode() 664 { 665 ExecutableBase* next; 666 for (ExecutableBase* current = m_compiledCode.head(); current; current = next) { 667 next = current->next(); 668 if (isMarked(current)) 669 continue; 670 671 // We do this because executable memory is limited on some platforms and because 672 // CodeBlock requires eager finalization. 673 ExecutableBase::clearCodeVirtual(current); 674 m_compiledCode.remove(current); 675 } 676 677 m_dfgCodeBlocks.deleteUnmarkedJettisonedCodeBlocks(); 655 678 } 656 679 … … 681 704 double lastGCStartTime = WTF::currentTime(); 682 705 if (lastGCStartTime - m_lastCodeDiscardTime > minute) { 683 d iscardAllCompiledCode();706 deleteAllCompiledCode(); 684 707 m_lastCodeDiscardTime = WTF::currentTime(); 685 708 } … … 704 727 } 705 728 729 JAVASCRIPTCORE_GC_MARKED(); 730 706 731 { 707 732 GCPHASE(FinalizeUnconditionalFinalizers); … … 714 739 m_globalData->smallStrings.finalizeSmallStrings(); 715 740 } 716 717 JAVASCRIPTCORE_GC_MARKED();718 741 719 742 { 720 743 GCPHASE(DeleteCodeBlocks); 721 m_dfgCodeBlocks.deleteUnmarkedJettisonedCodeBlocks();744 deleteUnmarkedCompiledCode(); 722 745 } 723 746 … … 809 832 } 810 833 811 void Heap::addFunctionExecutable(FunctionExecutable* executable) 812 { 813 m_functions.append(executable); 814 } 815 816 void Heap::removeFunctionExecutable(FunctionExecutable* executable) 817 { 818 m_functions.remove(executable); 834 void Heap::addCompiledCode(ExecutableBase* executable) 835 { 836 m_compiledCode.append(executable); 819 837 } 820 838
Note:
See TracChangeset
for help on using the changeset viewer.