• Seth Brenith's avatar
    Improve Script reuse in isolate compilation cache, part 1 · 25072178
    Seth Brenith authored
    Once the root SharedFunctionInfo for any Script gets its bytecode
    flushed, the Isolate's compilation cache currently evicts that entry, to
    reduce memory usage. However, the associated Script is likely still
    alive, since scripts often declare functions which outlive the initial
    evaluation of the script. If an identical script is loaded later, a
    duplicate Script is created for it, which can waste memory.
    
    In this change, I propose that the compilation cache keys can refer
    weakly to the Script. When the root SharedFunctionInfo gets old, instead
    of deleting the cache entry entirely, we can just drop the strong
    reference to the SharedFunctionInfo. A subsequent lookup in the cache
    will retrieve the Script instead of the root SharedFunctionInfo,
    indicating an opportunity to save some memory by reusing the existing
    Script.
    
    Eventually, all callers to CompilationCache::LookupScript should reuse
    the Script if possible. This change implements only the easy case of
    reusing the Script for synchronous parsing. Follow-up changes will be
    required for the TODO comments left by this change.
    
    Bug: v8:12808
    Change-Id: Ia8b0389441a682de9a43e73329049fd2e7835d3d
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3597106Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
    Commit-Queue: Seth Brenith <seth.brenith@microsoft.com>
    Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#80472}
    25072178
Name
Last commit
Last update
..
api Loading commit data...
asmjs Loading commit data...
ast Loading commit data...
base Loading commit data...
baseline Loading commit data...
bigint Loading commit data...
builtins Loading commit data...
codegen Loading commit data...
common Loading commit data...
compiler Loading commit data...
compiler-dispatcher Loading commit data...
d8 Loading commit data...
date Loading commit data...
debug Loading commit data...
deoptimizer Loading commit data...
diagnostics Loading commit data...
execution Loading commit data...
extensions Loading commit data...
flags Loading commit data...
handles Loading commit data...
heap Loading commit data...
ic Loading commit data...
init Loading commit data...
inspector Loading commit data...
interpreter Loading commit data...
json Loading commit data...
libplatform Loading commit data...
libsampler Loading commit data...
logging Loading commit data...
maglev Loading commit data...
numbers Loading commit data...
objects Loading commit data...
parsing Loading commit data...
profiler Loading commit data...
protobuf Loading commit data...
regexp Loading commit data...
roots Loading commit data...
runtime Loading commit data...
sandbox Loading commit data...
sanitizer Loading commit data...
snapshot Loading commit data...
strings Loading commit data...
tasks Loading commit data...
temporal Loading commit data...
third_party Loading commit data...
torque Loading commit data...
tracing Loading commit data...
trap-handler Loading commit data...
utils Loading commit data...
wasm Loading commit data...
web-snapshot Loading commit data...
zone Loading commit data...
DEPS Loading commit data...
DIR_METADATA Loading commit data...
OWNERS Loading commit data...