bmalloc: segregate small and large objects again, and allocate more objects on the small path
Created attachment 275519 [details] Patch
Attachment 275519 [details] did not pass style-queue: ERROR: Source/bmalloc/bmalloc/Heap.cpp:86: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Source/bmalloc/bmalloc/Heap.cpp:91: Multi line control clauses should use braces. [whitespace/braces] [4] ERROR: Source/bmalloc/bmalloc/Heap.cpp:296: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Source/bmalloc/bmalloc/Heap.cpp:344: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Source/bmalloc/bmalloc/Heap.cpp:403: Place brace on its own line for function definitions. [whitespace/braces] [4] Total errors found: 5 in 13 files If any of these errors are false positives, please file a bug against check-webkit-style.
Comment on attachment 275519 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=275519&action=review > Source/bmalloc/bmalloc/Chunk.h:92 > + // The first few bytes of metadata cover the metadata region, so they're > + // not used. We can steal them to store m_objectType. > + ObjectType m_objectType; > + > + // A chunk is either small or large for its lifetime, so we can union > + // small and large metadata, and then use one or the other at runtime. > + std::array<SmallPage, chunkSize / smallPageSize> m_pages; > + std::array<BoundaryTag, boundaryTagCount> m_boundaryTags; This is neat, but it would be neater if there was an assertion that the object type never overlapped with anything interesting in m_pages or m_boundaryTags.
> This is neat, but it would be neater if there was an assertion that the > object type never overlapped with anything interesting in m_pages or > m_boundaryTags. I wrote this assertion and it demonstrated that we had two problems: (1) Chunk::begin() would provide a pointer that wasn't physical-page-size-aligned on 16kB systems. All pages in this kind of chunk would fail to madvise. (2) If you changed things around so that the first page started at byte 0, which was physical-page-size-aligned, then you would collide with m_objectType. I solved these problems by changing Chunk::begin() to round up to the physical page size, and keeping the first page starting at Chunk::begin(). This wastes a little metadata space on 16kB systems, but not a lot (1.5% vs 1.0%).
Committed r198995: <http://trac.webkit.org/changeset/198995>
From AreWeFastYet, it looks like this could be a 0.5% win on Sunspider.