• Darius Mercadier's avatar
    [heap] Make FreeListCategory lighter (size-wise) · 604ef7bb
    Darius Mercadier authored
    A recent CL (1762292 and 1765533) changed the FreeList strategy,
    switching to one that uses 46 categories rather than the previous 6 we
    had. This caused a reduction of V8's heap size by about 1-2% on
    average. However, because FreeListCategory is 56 bytes, rather than 4
    bytes as one might expect (2 bytes offset, 1 byte for the category
    type, and 1 byte padding), the overall memory improvement is actually
    lower than that.
    
    For instance, when 256M memory is allocated,
        1000 pages * 46 freelists * 56 bytes = 2.5M overhead
    (ie, 1% overhead)
    
    Ideally, FreeListCategory should only by 4 bytes: 2 bytes for the
    offset of the top() on the page, 1 byte for the category type, and
    1 byte padding.
    
    
    This CL reduces the size of FreeListCategory by 24 bytes by removing
    some fields.
    
    More work should be done to reduce the size even further:
    
      - Remove the available_ counter (this require maintaining byte count
        at the page level rather than in each FreeListCategory; and
        maintaining that counter is not trivial, but doable).
    
      - Use a 16 bits offset to store the top() rather than a pointer.
    
      - Get rid of prev_ and next_: this change is the most
        complicated. It requires storing the space's pages in order, such
        that when one page's freelist is empty, we move on to the next
        page in the space.
    
      - the type_ field might even be removable, since this information can
        be deduced from the FreeListCategory's position in the page's array
        or FreeListCategory.
    
    Bug: v8:9329
    Change-Id: I8fd72cfa31ca12ba0dbf10be3948a72caee15b57
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1773270
    Commit-Queue: Darius Mercadier <dmercadier@google.com>
    Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
    Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#63448}
    604ef7bb
Name
Last commit
Last update
benchmarks Loading commit data...
build_overrides Loading commit data...
custom_deps Loading commit data...
docs Loading commit data...
gni Loading commit data...
include Loading commit data...
infra Loading commit data...
samples Loading commit data...
src Loading commit data...
test Loading commit data...
testing Loading commit data...
third_party Loading commit data...
tools Loading commit data...
.clang-format Loading commit data...
.clang-tidy Loading commit data...
.editorconfig Loading commit data...
.flake8 Loading commit data...
.git-blame-ignore-revs Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.gn Loading commit data...
.vpython Loading commit data...
.ycm_extra_conf.py Loading commit data...
AUTHORS Loading commit data...
BUILD.gn Loading commit data...
CODE_OF_CONDUCT.md Loading commit data...
COMMON_OWNERS Loading commit data...
ChangeLog Loading commit data...
DEPS Loading commit data...
ENG_REVIEW_OWNERS Loading commit data...
INFRA_OWNERS Loading commit data...
INTL_OWNERS Loading commit data...
LICENSE Loading commit data...
LICENSE.fdlibm Loading commit data...
LICENSE.strongtalk Loading commit data...
LICENSE.v8 Loading commit data...
LICENSE.valgrind Loading commit data...
MIPS_OWNERS Loading commit data...
OWNERS Loading commit data...
PPC_OWNERS Loading commit data...
PRESUBMIT.py Loading commit data...
README.md Loading commit data...
S390_OWNERS Loading commit data...
WATCHLISTS Loading commit data...
codereview.settings Loading commit data...