• oliver@apple.com's avatar
    Improve effectiveness of function-level caching · 27e0eed2
    oliver@apple.com authored
    https://bugs.webkit.org/show_bug.cgi?id=101667
    
    Reviewed by Filip Pizlo.
    
    Added a random-eviction based cache for unlinked functions, and switch
    UnlinkedFunctionExecutable's code references to Weak<>, thereby letting
    us remove the explicit UnlinkedFunctionExecutable::clearCode() calls that
    were being triggered by GC.
    
    Refactored the random eviction part of the CodeCache into a separate data
    structure so that I didn't have to duplicate the code again, and then used
    that for the new function cache.
    
    * bytecode/UnlinkedCodeBlock.cpp:
    (JSC::UnlinkedFunctionExecutable::visitChildren):
    (JSC::UnlinkedFunctionExecutable::codeBlockFor):
    * bytecode/UnlinkedCodeBlock.h:
    (JSC::UnlinkedFunctionExecutable::clearCodeForRecompilation):
    (UnlinkedFunctionExecutable):
    * debugger/Debugger.cpp:
    * runtime/CodeCache.cpp:
    (JSC::CodeCache::getCodeBlock):
    (JSC::CodeCache::generateFunctionCodeBlock):
    (JSC::CodeCache::getFunctionExecutableFromGlobalCode):
    (JSC::CodeCache::usedFunctionCode):
    (JSC):
    * runtime/Executable.cpp:
    (JSC::FunctionExecutable::clearUnlinkedCodeForRecompilationIfNotCompiling):
    (JSC::FunctionExecutable::clearCode):
    * runtime/Executable.h:
    (FunctionExecutable):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@133975 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    27e0eed2
CodeCache.cpp 8.54 KB