• ggaren@apple.com's avatar
    Do one lookup per code cache insertion instead of two · 55cf8267
    ggaren@apple.com authored
    Reviewed by Sam Weinig.
    Deployed the idiomatic "add null value" trick to avoid a second hash
    lookup when inserting an item.
    * runtime/CodeCache.cpp:
    (JSC::CodeCacheMap::pruneSlowCase): Factored this into a helper function
    to improve clarity and get some code off the hot path.
    (JSC::CodeCache::getFunctionExecutableFromGlobalCode): Use the add() API
    to avoid two hash lookups. Be sure to remove items if parsing fails,
    otherwise we'll leave nulls in the table. (I'm guessing that caching parse
    errors is not a win.)
    * runtime/CodeCache.h:
    (JSC::CodeCacheMap::add): Combined find() and set() into add().
    (JSC::CodeCacheMap::prune): Refactored to support above changes.
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@143949 268f45cc-cd09-0410-ab3c-d52691b4dbfc
CodeCache.cpp 6.72 KB