bmalloc should segregate medium-sized objects by line like it does for small-sized...
[WebKit-https.git] / Source / bmalloc / bmalloc / Sizes.h
index b3bde56..b0c5281 100644 (file)
@@ -71,7 +71,7 @@ namespace Sizes {
     static const size_t largeAlignmentShift = 6;
     static_assert(1 << largeAlignmentShift == largeAlignment, "largeAlignmentShift be log2(largeAlignment).");
     static const size_t largeMax = largeChunkSize * 99 / 100; // Plenty of room for metadata.
-    static const size_t largeMin = 1024;
+    static const size_t largeMin = mediumMax;
 
     static const size_t segregatedFreeListSearchDepth = 16;
 
@@ -97,6 +97,12 @@ namespace Sizes {
         static const size_t smallSizeClassMask = (smallMax / alignment) - 1;
         return mask((size - 1ul) / alignment, smallSizeClassMask);
     }
+
+    inline size_t mediumSizeClassFor(size_t size)
+    {
+        static const size_t mediumSizeClassMask = (mediumMax / alignment) - 1;
+        return mask((size - 1ul) / alignment, mediumSizeClassMask);
+    }
 };
 
 using namespace Sizes;