v8/test/cctest/heap
Seth Brenith 2507217839 Improve Script reuse in isolate compilation cache, part 1
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/+/3597106
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Commit-Queue: Seth Brenith <seth.brenith@microsoft.com>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80472}
2022-05-11 14:27:43 +00:00
..
heap-tester.h Reland "Reland "[deoptimizer] Change deopt entries into builtins"" 2020-10-21 06:01:38 +00:00
heap-utils.cc [rwx][mac] Fix component build 2022-05-11 12:33:52 +00:00
heap-utils.h [heap, infra] Remove --local-heaps and --concurrent-allocation flags 2021-02-01 11:01:26 +00:00
test-alloc.cc [rwx][mac] Fix component build 2022-05-11 12:33:52 +00:00
test-array-buffer-tracker.cc [heap] Separate GC phases flag. 2022-04-06 07:23:39 +00:00
test-compaction.cc Revert "Reland^2: [heap] Store size with invalidated object" 2022-05-04 13:32:38 +00:00
test-concurrent-allocation.cc [rwx][mac] Fix component build 2022-05-11 12:33:52 +00:00
test-concurrent-marking.cc heap: Refactor sweeping finalization for young GC 2022-03-08 16:48:43 +00:00
test-external-string-tracker.cc heap: Rename compaction flags 2021-11-10 09:01:59 +00:00
test-heap.cc Improve Script reuse in isolate compilation cache, part 1 2022-05-11 14:27:43 +00:00
test-incremental-marking.cc [test] Make cctest run one test, with maybe custom platform 2022-04-05 09:39:18 +00:00
test-invalidated-slots.cc Revert "Reland^2: [heap] Store size with invalidated object" 2022-05-04 13:32:38 +00:00
test-iterators.cc Reland "[include] Split out v8.h" 2021-08-24 13:08:55 +00:00
test-mark-compact.cc heap: Clean up conservative stack scanning prototype 2022-05-05 10:52:19 +00:00
test-memory-measurement.cc [test] Make cctest run one test, with maybe custom platform 2022-04-05 09:39:18 +00:00
test-page-promotion.cc [heap] Remove flag always_promote_young_mc 2021-11-09 19:37:39 +00:00
test-shared-heap.cc [heap] Find references in client heaps to shared objects in shared GC 2021-12-06 12:00:18 +00:00
test-spaces.cc [rwx][mac] Fix jitless mode 2022-05-10 09:00:23 +00:00
test-unmapper.cc [test] Make cctest run one test, with maybe custom platform 2022-04-05 09:39:18 +00:00
test-weak-references.cc [heap] Separate GC phases flag. 2022-04-06 07:23:39 +00:00
test-write-barrier.cc [heap] Fix failed tests when enabling single generation 2021-04-21 07:33:51 +00:00