• 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
..
api Loading commit data...
asmjs Loading commit data...
ast Loading commit data...
base 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...
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...
sanitizer Loading commit data...
snapshot Loading commit data...
strings Loading commit data...
tasks 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...
zone Loading commit data...
DEPS Loading commit data...
OWNERS Loading commit data...