-
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: Ulan Degenbaev <ulan@chromium.org> Reviewed-by: Michael Lippautz <mlippautz@chromium.org> Cr-Commit-Position: refs/heads/master@{#63448}
604ef7bb