Renamed XLarge* => Large*
authorggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 26 Aug 2016 20:18:00 +0000 (20:18 +0000)
committerggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 26 Aug 2016 20:18:00 +0000 (20:18 +0000)
https://bugs.webkit.org/show_bug.cgi?id=161261

Reviewed by Andreas Kling.

XLarge is not a thing anymore: We just have Small and Large.

* bmalloc.xcodeproj/project.pbxproj:
* bmalloc/Heap.cpp:
(bmalloc::Heap::splitAndAllocate):
(bmalloc::Heap::tryAllocateLarge):
(bmalloc::Heap::shrinkLarge):
(bmalloc::Heap::deallocateLarge):
* bmalloc/Heap.h:
* bmalloc/LargeMap.cpp: Copied from Source/bmalloc/bmalloc/XLargeMap.cpp.
(bmalloc::LargeMap::remove):
(bmalloc::LargeMap::add):
(bmalloc::XLargeMap::remove): Deleted.
(bmalloc::XLargeMap::add): Deleted.
* bmalloc/LargeMap.h: Copied from Source/bmalloc/bmalloc/XLargeMap.h.
(bmalloc::LargeMap::ranges):
(bmalloc::XLargeMap::ranges): Deleted.
* bmalloc/LargeRange.h: Copied from Source/bmalloc/bmalloc/XLargeRange.h.
(bmalloc::LargeRange::LargeRange):
(bmalloc::LargeRange::operator<):
(bmalloc::canMerge):
(bmalloc::merge):
(bmalloc::LargeRange::split):
(bmalloc::XLargeRange::XLargeRange): Deleted.
(bmalloc::XLargeRange::operator<): Deleted.
(bmalloc::XLargeRange::split): Deleted.
* bmalloc/VMHeap.cpp:
(bmalloc::VMHeap::tryAllocateLargeChunk):
* bmalloc/VMHeap.h:
* bmalloc/XLargeMap.cpp: Removed.
* bmalloc/XLargeMap.h: Removed.
* bmalloc/XLargeRange.h: Removed.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205032 268f45cc-cd09-0410-ab3c-d52691b4dbfc

PerformanceTests/MallocBench/MallocBench.xcodeproj/project.pbxproj
PerformanceTests/MallocBench/run-malloc-benchmarks
Source/bmalloc/ChangeLog
Source/bmalloc/bmalloc.xcodeproj/project.pbxproj
Source/bmalloc/bmalloc/Heap.cpp
Source/bmalloc/bmalloc/Heap.h
Source/bmalloc/bmalloc/LargeMap.cpp [moved from Source/bmalloc/bmalloc/XLargeMap.cpp with 88% similarity]
Source/bmalloc/bmalloc/LargeMap.h [moved from Source/bmalloc/bmalloc/XLargeMap.h with 84% similarity]
Source/bmalloc/bmalloc/LargeRange.h [moved from Source/bmalloc/bmalloc/XLargeRange.h with 71% similarity]
Source/bmalloc/bmalloc/VMHeap.cpp
Source/bmalloc/bmalloc/VMHeap.h

index 3a61c7d..2be36cb 100644 (file)
                                GCC_PRECOMPILE_PREFIX_HEADER = NO;
                                PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO;
                                PRODUCT_NAME = "$(TARGET_NAME)";
+                               SDKROOT = iphoneos.internal;
                        };
                        name = Debug;
                };
                                );
                                PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO;
                                PRODUCT_NAME = "$(TARGET_NAME)";
+                               SDKROOT = iphoneos.internal;
                        };
                        name = Release;
                };
index 1ee0458..e57a4db 100755 (executable)
@@ -7,51 +7,16 @@ $binDir = "#{File.expand_path(File.dirname(__FILE__))}"
 $productDir = `perl -e 'use lib \"#{$binDir}/../../Tools/Scripts\"; use webkitdirs; print productDir()'`
 
 $benchmarks_all = [
-    # Single-threaded benchmarks.
-    "churn",
-    "list_allocate",
-    "tree_allocate",
-    "tree_churn",
-    "fragment",
-    "fragment_iterate",
-    "medium",
-    "big",
-
-    # Benchmarks based on browser recordings.
-    "facebook",
-    "reddit",
-    "flickr",
-    "theverge",
-    "nimlang",
-
-    # Multi-threaded benchmark variants.
     "message_one",
     "message_many",
     "churn --parallel",
     "list_allocate --parallel",
     "tree_allocate --parallel",
     "tree_churn --parallel",
-    # "facebook --parallel",
-    # "reddit --parallel",
-    # "flickr --parallel",
-    # "theverge --parallel",
-    # "nimlang --use-thread-id",
-    "fragment --parallel",
-    "fragment_iterate --parallel",
-
-    # These tests often crash TCMalloc: <rdar://problem/13657137>.
-    "medium --parallel",
-    "big --parallel",
-
-    # Enable these tests to test memory footprint. The way they run is not
-    # really compatible with throughput testing.
-    # "reddit_memory_warning --runs 0",
-    # "flickr_memory_warning --runs 0",
-    # "theverge_memory_warning --runs 0",
-
-    # Enable this test to test shrinking back down from a large heap while a process remains active.
-    # The way it runs is not really compatible with throughput testing.
-    # "balloon"
+    "facebook --parallel",
+    "reddit --parallel",
+    "flickr --parallel",
+    "theverge --parallel",
 ]
 
 $benchmarks_memory = [
index ade921d..0741c75 100644 (file)
@@ -1,3 +1,43 @@
+2016-08-26  Geoffrey Garen  <ggaren@apple.com>
+
+        Renamed XLarge* => Large*
+        https://bugs.webkit.org/show_bug.cgi?id=161261
+
+        Reviewed by Andreas Kling.
+
+        XLarge is not a thing anymore: We just have Small and Large.
+
+        * bmalloc.xcodeproj/project.pbxproj:
+        * bmalloc/Heap.cpp:
+        (bmalloc::Heap::splitAndAllocate):
+        (bmalloc::Heap::tryAllocateLarge):
+        (bmalloc::Heap::shrinkLarge):
+        (bmalloc::Heap::deallocateLarge):
+        * bmalloc/Heap.h:
+        * bmalloc/LargeMap.cpp: Copied from Source/bmalloc/bmalloc/XLargeMap.cpp.
+        (bmalloc::LargeMap::remove):
+        (bmalloc::LargeMap::add):
+        (bmalloc::XLargeMap::remove): Deleted.
+        (bmalloc::XLargeMap::add): Deleted.
+        * bmalloc/LargeMap.h: Copied from Source/bmalloc/bmalloc/XLargeMap.h.
+        (bmalloc::LargeMap::ranges):
+        (bmalloc::XLargeMap::ranges): Deleted.
+        * bmalloc/LargeRange.h: Copied from Source/bmalloc/bmalloc/XLargeRange.h.
+        (bmalloc::LargeRange::LargeRange):
+        (bmalloc::LargeRange::operator<):
+        (bmalloc::canMerge):
+        (bmalloc::merge):
+        (bmalloc::LargeRange::split):
+        (bmalloc::XLargeRange::XLargeRange): Deleted.
+        (bmalloc::XLargeRange::operator<): Deleted.
+        (bmalloc::XLargeRange::split): Deleted.
+        * bmalloc/VMHeap.cpp:
+        (bmalloc::VMHeap::tryAllocateLargeChunk):
+        * bmalloc/VMHeap.h:
+        * bmalloc/XLargeMap.cpp: Removed.
+        * bmalloc/XLargeMap.h: Removed.
+        * bmalloc/XLargeRange.h: Removed.
+
 2016-08-26  Gavin Barraclough  <barraclough@apple.com>
 
         bmalloc: speed up the lock slow path
index 7f7a2ec..27c81f9 100644 (file)
                1448C30018F3754600502839 /* mbmalloc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1448C2FF18F3754300502839 /* mbmalloc.cpp */; };
                1448C30118F3754C00502839 /* bmalloc.h in Headers */ = {isa = PBXBuildFile; fileRef = 1448C2FE18F3754300502839 /* bmalloc.h */; settings = {ATTRIBUTES = (Private, ); }; };
                144BE11F1CA346520099C8C0 /* Object.h in Headers */ = {isa = PBXBuildFile; fileRef = 144BE11E1CA346520099C8C0 /* Object.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               144C07F41C7B70260051BB6A /* XLargeMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 144C07F21C7B70260051BB6A /* XLargeMap.cpp */; };
-               144C07F51C7B70260051BB6A /* XLargeMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 144C07F31C7B70260051BB6A /* XLargeMap.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               144C07F41C7B70260051BB6A /* LargeMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 144C07F21C7B70260051BB6A /* LargeMap.cpp */; };
+               144C07F51C7B70260051BB6A /* LargeMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 144C07F31C7B70260051BB6A /* LargeMap.h */; settings = {ATTRIBUTES = (Private, ); }; };
                147DC6E31CA5B70B00724E8D /* Chunk.h in Headers */ = {isa = PBXBuildFile; fileRef = 147DC6E21CA5B70B00724E8D /* Chunk.h */; settings = {ATTRIBUTES = (Private, ); }; };
                14895D911A3A319C0006235D /* Environment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14895D8F1A3A319C0006235D /* Environment.cpp */; };
                14895D921A3A319C0006235D /* Environment.h in Headers */ = {isa = PBXBuildFile; fileRef = 14895D901A3A319C0006235D /* Environment.h */; settings = {ATTRIBUTES = (Private, ); }; };
                14C8992B1CC485E70027A057 /* Map.h in Headers */ = {isa = PBXBuildFile; fileRef = 14C8992A1CC485E70027A057 /* Map.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               14C8992D1CC578330027A057 /* XLargeRange.h in Headers */ = {isa = PBXBuildFile; fileRef = 14C8992C1CC578330027A057 /* XLargeRange.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               14C8992D1CC578330027A057 /* LargeRange.h in Headers */ = {isa = PBXBuildFile; fileRef = 14C8992C1CC578330027A057 /* LargeRange.h */; settings = {ATTRIBUTES = (Private, ); }; };
                14C919C918FCC59F0028DB43 /* BPlatform.h in Headers */ = {isa = PBXBuildFile; fileRef = 14C919C818FCC59F0028DB43 /* BPlatform.h */; settings = {ATTRIBUTES = (Private, ); }; };
                14CC394C18EA8858004AFE34 /* libbmalloc.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 14F271BE18EA3963008C152F /* libbmalloc.a */; };
                14DD789018F48CEB00950702 /* Sizes.h in Headers */ = {isa = PBXBuildFile; fileRef = 145F6874179DF84100D65598 /* Sizes.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -92,8 +92,8 @@
                1448C2FE18F3754300502839 /* bmalloc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = bmalloc.h; path = bmalloc/bmalloc.h; sourceTree = "<group>"; };
                1448C2FF18F3754300502839 /* mbmalloc.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = mbmalloc.cpp; path = bmalloc/mbmalloc.cpp; sourceTree = "<group>"; };
                144BE11E1CA346520099C8C0 /* Object.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Object.h; path = bmalloc/Object.h; sourceTree = "<group>"; };
-               144C07F21C7B70260051BB6A /* XLargeMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = XLargeMap.cpp; path = bmalloc/XLargeMap.cpp; sourceTree = "<group>"; };
-               144C07F31C7B70260051BB6A /* XLargeMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XLargeMap.h; path = bmalloc/XLargeMap.h; sourceTree = "<group>"; };
+               144C07F21C7B70260051BB6A /* LargeMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LargeMap.cpp; path = bmalloc/LargeMap.cpp; sourceTree = "<group>"; };
+               144C07F31C7B70260051BB6A /* LargeMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LargeMap.h; path = bmalloc/LargeMap.h; sourceTree = "<group>"; };
                144DCED617A649D90093B2F2 /* Mutex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Mutex.h; path = bmalloc/Mutex.h; sourceTree = "<group>"; };
                144F7BFB18BFC517003537F3 /* VMHeap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = VMHeap.cpp; path = bmalloc/VMHeap.cpp; sourceTree = "<group>"; };
                144F7BFC18BFC517003537F3 /* VMHeap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VMHeap.h; path = bmalloc/VMHeap.h; sourceTree = "<group>"; };
                14B650C718F39F4800751968 /* DebugRelease.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = DebugRelease.xcconfig; sourceTree = "<group>"; };
                14B650C918F3A04200751968 /* mbmalloc.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = mbmalloc.xcconfig; sourceTree = "<group>"; };
                14C8992A1CC485E70027A057 /* Map.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Map.h; path = bmalloc/Map.h; sourceTree = "<group>"; };
-               14C8992C1CC578330027A057 /* XLargeRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XLargeRange.h; path = bmalloc/XLargeRange.h; sourceTree = "<group>"; };
+               14C8992C1CC578330027A057 /* LargeRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LargeRange.h; path = bmalloc/LargeRange.h; sourceTree = "<group>"; };
                14C919C818FCC59F0028DB43 /* BPlatform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BPlatform.h; path = bmalloc/BPlatform.h; sourceTree = "<group>"; };
                14CC394418EA8743004AFE34 /* libmbmalloc.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libmbmalloc.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
                14D9DB4517F2447100EAAB79 /* FixedVector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = FixedVector.h; path = bmalloc/FixedVector.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
                147AAA9C18CE6010002201E4 /* heap: large */ = {
                        isa = PBXGroup;
                        children = (
-                               144C07F21C7B70260051BB6A /* XLargeMap.cpp */,
-                               144C07F31C7B70260051BB6A /* XLargeMap.h */,
-                               14C8992C1CC578330027A057 /* XLargeRange.h */,
+                               144C07F21C7B70260051BB6A /* LargeMap.cpp */,
+                               144C07F31C7B70260051BB6A /* LargeMap.h */,
+                               14C8992C1CC578330027A057 /* LargeRange.h */,
                        );
                        name = "heap: large";
                        sourceTree = "<group>";
                                14C8992B1CC485E70027A057 /* Map.h in Headers */,
                                14DD78BD18F48D6B00950702 /* SmallPage.h in Headers */,
                                14DD78C818F48D7500950702 /* FixedVector.h in Headers */,
-                               14C8992D1CC578330027A057 /* XLargeRange.h in Headers */,
-                               144C07F51C7B70260051BB6A /* XLargeMap.h in Headers */,
+                               14C8992D1CC578330027A057 /* LargeRange.h in Headers */,
+                               144C07F51C7B70260051BB6A /* LargeMap.h in Headers */,
                                147DC6E31CA5B70B00724E8D /* Chunk.h in Headers */,
                                14DD78BC18F48D6B00950702 /* SmallLine.h in Headers */,
                                14DD789818F48D4A00950702 /* Allocator.h in Headers */,
                                4426E2801C838EE0008EB042 /* Logging.cpp in Sources */,
                                14F271C718EA3990008C152F /* Heap.cpp in Sources */,
                                14F271C918EA3990008C152F /* VMHeap.cpp in Sources */,
-                               144C07F41C7B70260051BB6A /* XLargeMap.cpp in Sources */,
+                               144C07F41C7B70260051BB6A /* LargeMap.cpp in Sources */,
                                14F271C818EA3990008C152F /* ObjectType.cpp in Sources */,
                                14F271C518EA397E008C152F /* Deallocator.cpp in Sources */,
                                14F271C418EA397B008C152F /* Cache.cpp in Sources */,
index ac0d7de..0bb65e7 100644 (file)
@@ -305,21 +305,21 @@ void Heap::allocateSmallBumpRangesByObject(
     }
 }
 
-XLargeRange Heap::splitAndAllocate(XLargeRange& range, size_t alignment, size_t size)
+LargeRange Heap::splitAndAllocate(LargeRange& range, size_t alignment, size_t size)
 {
-    XLargeRange prev;
-    XLargeRange next;
+    LargeRange prev;
+    LargeRange next;
 
     size_t alignmentMask = alignment - 1;
     if (test(range.begin(), alignmentMask)) {
         size_t prefixSize = roundUpToMultipleOf(alignment, range.begin()) - range.begin();
-        std::pair<XLargeRange, XLargeRange> pair = range.split(prefixSize);
+        std::pair<LargeRange, LargeRange> pair = range.split(prefixSize);
         prev = pair.first;
         range = pair.second;
     }
 
     if (range.size() - size > size / pageSizeWasteFactor) {
-        std::pair<XLargeRange, XLargeRange> pair = range.split(size);
+        std::pair<LargeRange, LargeRange> pair = range.split(size);
         range = pair.first;
         next = pair.second;
     }
@@ -357,7 +357,7 @@ void* Heap::tryAllocateLarge(std::lock_guard<StaticMutex>& lock, size_t alignmen
         return nullptr;
     alignment = roundedAlignment;
 
-    XLargeRange range = m_largeFree.remove(alignment, size);
+    LargeRange range = m_largeFree.remove(alignment, size);
     if (!range) {
         range = m_vmHeap.tryAllocateLargeChunk(lock, alignment, size);
         if (!range)
@@ -392,7 +392,7 @@ void Heap::shrinkLarge(std::lock_guard<StaticMutex>&, const Range& object, size_
     BASSERT(object.size() > newSize);
 
     size_t size = m_largeAllocated.remove(object.begin());
-    XLargeRange range = XLargeRange(object, size);
+    LargeRange range = LargeRange(object, size);
     splitAndAllocate(range, alignment, newSize);
 
     m_scavenger.run();
@@ -401,7 +401,7 @@ void Heap::shrinkLarge(std::lock_guard<StaticMutex>&, const Range& object, size_
 void Heap::deallocateLarge(std::lock_guard<StaticMutex>&, void* object)
 {
     size_t size = m_largeAllocated.remove(object);
-    m_largeFree.add(XLargeRange(object, size, size));
+    m_largeFree.add(LargeRange(object, size, size));
     
     m_scavenger.run();
 }
index 9c2da24..b1ef75f 100644 (file)
@@ -29,6 +29,7 @@
 #include "AsyncTask.h"
 #include "BumpRange.h"
 #include "Environment.h"
+#include "LargeMap.h"
 #include "LineMetadata.h"
 #include "List.h"
 #include "Map.h"
@@ -38,7 +39,6 @@
 #include "SmallPage.h"
 #include "VMHeap.h"
 #include "Vector.h"
-#include "XLargeMap.h"
 #include <array>
 #include <mutex>
 
@@ -94,7 +94,7 @@ private:
     void mergeLargeLeft(EndTag*&, BeginTag*&, Range&, bool& inVMHeap);
     void mergeLargeRight(EndTag*&, BeginTag*&, Range&, bool& inVMHeap);
 
-    XLargeRange splitAndAllocate(XLargeRange&, size_t alignment, size_t);
+    LargeRange splitAndAllocate(LargeRange&, size_t alignment, size_t);
 
     void concurrentScavenge();
     void scavengeSmallPages(std::unique_lock<StaticMutex>&, std::chrono::milliseconds);
@@ -108,7 +108,7 @@ private:
     std::array<List<SmallPage>, pageClassCount> m_smallPages;
 
     Map<void*, size_t, LargeObjectHash> m_largeAllocated;
-    XLargeMap m_largeFree;
+    LargeMap m_largeFree;
 
     Map<Chunk*, ObjectType, ChunkHash> m_objectTypes;
 
similarity index 88%
rename from Source/bmalloc/bmalloc/XLargeMap.cpp
rename to Source/bmalloc/bmalloc/LargeMap.cpp
index 99b8b79..443ad91 100644 (file)
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#include "XLargeMap.h"
+#include "LargeMap.h"
 #include <utility>
 
 namespace bmalloc {
 
-XLargeRange XLargeMap::remove(size_t alignment, size_t size)
+LargeRange LargeMap::remove(size_t alignment, size_t size)
 {
     size_t alignmentMask = alignment - 1;
 
-    XLargeRange* candidate = m_free.end();
-    for (XLargeRange* it = m_free.begin(); it != m_free.end(); ++it) {
+    LargeRange* candidate = m_free.end();
+    for (LargeRange* it = m_free.begin(); it != m_free.end(); ++it) {
         if (it->size() < size)
             continue;
 
@@ -57,14 +57,14 @@ XLargeRange XLargeMap::remove(size_t alignment, size_t size)
     }
     
     if (candidate == m_free.end())
-        return XLargeRange();
+        return LargeRange();
 
     return m_free.pop(candidate);
 }
 
-void XLargeMap::add(const XLargeRange& range)
+void LargeMap::add(const LargeRange& range)
 {
-    XLargeRange merged = range;
+    LargeRange merged = range;
 
     for (size_t i = 0; i < m_free.size(); ++i) {
         if (!canMerge(merged, m_free[i]))
similarity index 84%
rename from Source/bmalloc/bmalloc/XLargeMap.h
rename to Source/bmalloc/bmalloc/LargeMap.h
index cd2f16d..2ad94b0 100644 (file)
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#ifndef XLargeMap_h
-#define XLargeMap_h
+#ifndef LargeMap_h
+#define LargeMap_h
 
+#include "LargeRange.h"
 #include "Vector.h"
-#include "XLargeRange.h"
 #include <algorithm>
 
 namespace bmalloc {
 
-class XLargeMap {
+class LargeMap {
 public:
-    void add(const XLargeRange&);
-    XLargeRange remove(size_t alignment, size_t);
-    Vector<XLargeRange>& ranges() { return m_free; }
+    void add(const LargeRange&);
+    LargeRange remove(size_t alignment, size_t);
+    Vector<LargeRange>& ranges() { return m_free; }
 
 private:
-    Vector<XLargeRange> m_free;
+    Vector<LargeRange> m_free;
 };
 
 } // namespace bmalloc
 
-#endif // XLargeMap_h
+#endif // LargeMap_h
similarity index 71%
rename from Source/bmalloc/bmalloc/XLargeRange.h
rename to Source/bmalloc/bmalloc/LargeRange.h
index 45013e1..935aec7 100644 (file)
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#ifndef XLargeRange_h
-#define XLargeRange_h
+#ifndef LargeRange_h
+#define LargeRange_h
+
+#include "BAssert.h"
+#include "Range.h"
 
 namespace bmalloc {
 
-class XLargeRange : public Range {
+class LargeRange : public Range {
 public:
-    XLargeRange()
+    LargeRange()
         : Range()
         , m_physicalSize(0)
     {
     }
 
-    XLargeRange(const Range& other, size_t physicalSize)
+    LargeRange(const Range& other, size_t physicalSize)
         : Range(other)
         , m_physicalSize(physicalSize)
     {
     }
 
-    XLargeRange(void* begin, size_t size, size_t physicalSize)
+    LargeRange(void* begin, size_t size, size_t physicalSize)
         : Range(begin, size)
         , m_physicalSize(physicalSize)
     {
@@ -51,16 +54,16 @@ public:
     size_t physicalSize() const { return m_physicalSize; }
     void setPhysicalSize(size_t physicalSize) { m_physicalSize = physicalSize; }
 
-    std::pair<XLargeRange, XLargeRange> split(size_t) const;
+    std::pair<LargeRange, LargeRange> split(size_t) const;
 
     bool operator<(const void* other) const { return begin() < other; }
-    bool operator<(const XLargeRange& other) const { return begin() < other.begin(); }
+    bool operator<(const LargeRange& other) const { return begin() < other.begin(); }
 
 private:
     size_t m_physicalSize;
 };
 
-inline bool canMerge(const XLargeRange& a, const XLargeRange& b)
+inline bool canMerge(const LargeRange& a, const LargeRange& b)
 {
     if (a.end() == b.begin())
         return true;
@@ -71,37 +74,37 @@ inline bool canMerge(const XLargeRange& a, const XLargeRange& b)
     return false;
 }
 
-inline XLargeRange merge(const XLargeRange& a, const XLargeRange& b)
+inline LargeRange merge(const LargeRange& a, const LargeRange& b)
 {
-    const XLargeRange& left = std::min(a, b);
+    const LargeRange& left = std::min(a, b);
     if (left.size() == left.physicalSize()) {
-        return XLargeRange(
+        return LargeRange(
             left.begin(),
             a.size() + b.size(),
             a.physicalSize() + b.physicalSize());
     }
 
-    return XLargeRange(
+    return LargeRange(
         left.begin(),
         a.size() + b.size(),
         left.physicalSize());
 }
 
-inline std::pair<XLargeRange, XLargeRange> XLargeRange::split(size_t size) const
+inline std::pair<LargeRange, LargeRange> LargeRange::split(size_t size) const
 {
     BASSERT(size <= this->size());
     
     if (size <= physicalSize()) {
-        XLargeRange left(begin(), size, size);
-        XLargeRange right(left.end(), this->size() - size, physicalSize() - size);
+        LargeRange left(begin(), size, size);
+        LargeRange right(left.end(), this->size() - size, physicalSize() - size);
         return std::make_pair(left, right);
     }
 
-    XLargeRange left(begin(), size, physicalSize());
-    XLargeRange right(left.end(), this->size() - size, 0);
+    LargeRange left(begin(), size, physicalSize());
+    LargeRange right(left.end(), this->size() - size, 0);
     return std::make_pair(left, right);
 }
 
 } // namespace bmalloc
 
-#endif // XLargeRange_h
+#endif // LargeRange_h
index 92e274d..74d8792 100644 (file)
 
 namespace bmalloc {
 
-XLargeRange VMHeap::tryAllocateLargeChunk(std::lock_guard<StaticMutex>&, size_t alignment, size_t size)
+LargeRange VMHeap::tryAllocateLargeChunk(std::lock_guard<StaticMutex>&, size_t alignment, size_t size)
 {
     // We allocate VM in aligned multiples to increase the chances that
     // the OS will provide contiguous ranges that we can merge.
     size_t roundedAlignment = roundUpToMultipleOf<chunkSize>(alignment);
     if (roundedAlignment < alignment) // Check for overflow
-        return XLargeRange();
+        return LargeRange();
     alignment = roundedAlignment;
 
     size_t roundedSize = roundUpToMultipleOf<chunkSize>(size);
     if (roundedSize < size) // Check for overflow
-        return XLargeRange();
+        return LargeRange();
     size = roundedSize;
 
     void* memory = tryVMAllocate(alignment, size);
     if (!memory)
-        return XLargeRange();
+        return LargeRange();
 
     Chunk* chunk = static_cast<Chunk*>(memory);
     
@@ -53,7 +53,7 @@ XLargeRange VMHeap::tryAllocateLargeChunk(std::lock_guard<StaticMutex>&, size_t
     m_zone.addRange(Range(chunk->bytes(), size));
 #endif
 
-    return XLargeRange(chunk->bytes(), size, 0);
+    return LargeRange(chunk->bytes(), size, 0);
 }
 
 void VMHeap::allocateSmallChunk(std::lock_guard<StaticMutex>& lock, size_t pageClass)
index 97226cf..b98704a 100644 (file)
@@ -28,9 +28,9 @@
 
 #include "Chunk.h"
 #include "FixedVector.h"
+#include "LargeRange.h"
 #include "Map.h"
 #include "Vector.h"
-#include "XLargeRange.h"
 #if BOS(DARWIN)
 #include "Zone.h"
 #endif
@@ -46,7 +46,7 @@ public:
     SmallPage* allocateSmallPage(std::lock_guard<StaticMutex>&, size_t);
     void deallocateSmallPage(std::unique_lock<StaticMutex>&, size_t, SmallPage*);
 
-    XLargeRange tryAllocateLargeChunk(std::lock_guard<StaticMutex>&, size_t alignment, size_t);
+    LargeRange tryAllocateLargeChunk(std::lock_guard<StaticMutex>&, size_t alignment, size_t);
     
 private:
     void allocateSmallChunk(std::lock_guard<StaticMutex>&, size_t);