Title: [205032] trunk
Revision
205032
Author
[email protected]
Date
2016-08-26 13:18:00 -0700 (Fri, 26 Aug 2016)

Log Message

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.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/PerformanceTests/MallocBench/MallocBench.xcodeproj/project.pbxproj (205031 => 205032)


--- trunk/PerformanceTests/MallocBench/MallocBench.xcodeproj/project.pbxproj	2016-08-26 18:12:56 UTC (rev 205031)
+++ trunk/PerformanceTests/MallocBench/MallocBench.xcodeproj/project.pbxproj	2016-08-26 20:18:00 UTC (rev 205032)
@@ -433,6 +433,7 @@
 				GCC_PRECOMPILE_PREFIX_HEADER = NO;
 				PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO;
 				PRODUCT_NAME = "$(TARGET_NAME)";
+				SDKROOT = iphoneos.internal;
 			};
 			name = Debug;
 		};
@@ -448,6 +449,7 @@
 				);
 				PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO;
 				PRODUCT_NAME = "$(TARGET_NAME)";
+				SDKROOT = iphoneos.internal;
 			};
 			name = Release;
 		};

Modified: trunk/PerformanceTests/MallocBench/run-malloc-benchmarks (205031 => 205032)


--- trunk/PerformanceTests/MallocBench/run-malloc-benchmarks	2016-08-26 18:12:56 UTC (rev 205031)
+++ trunk/PerformanceTests/MallocBench/run-malloc-benchmarks	2016-08-26 20:18:00 UTC (rev 205032)
@@ -7,24 +7,6 @@
 $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",
@@ -31,27 +13,10 @@
     "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 = [

Modified: trunk/Source/bmalloc/ChangeLog (205031 => 205032)


--- trunk/Source/bmalloc/ChangeLog	2016-08-26 18:12:56 UTC (rev 205031)
+++ trunk/Source/bmalloc/ChangeLog	2016-08-26 20:18:00 UTC (rev 205032)
@@ -1,3 +1,43 @@
+2016-08-26  Geoffrey Garen  <[email protected]>
+
+        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  <[email protected]>
 
         bmalloc: speed up the lock slow path

Modified: trunk/Source/bmalloc/bmalloc/Heap.cpp (205031 => 205032)


--- trunk/Source/bmalloc/bmalloc/Heap.cpp	2016-08-26 18:12:56 UTC (rev 205031)
+++ trunk/Source/bmalloc/bmalloc/Heap.cpp	2016-08-26 20:18:00 UTC (rev 205032)
@@ -305,21 +305,21 @@
     }
 }
 
-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 @@
         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 @@
     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::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();
 }

Modified: trunk/Source/bmalloc/bmalloc/Heap.h (205031 => 205032)


--- trunk/Source/bmalloc/bmalloc/Heap.h	2016-08-26 18:12:56 UTC (rev 205031)
+++ trunk/Source/bmalloc/bmalloc/Heap.h	2016-08-26 20:18:00 UTC (rev 205032)
@@ -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 @@
     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 @@
     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;
 

Copied: trunk/Source/bmalloc/bmalloc/LargeMap.cpp (from rev 204993, trunk/Source/bmalloc/bmalloc/XLargeMap.cpp) (0 => 205032)


--- trunk/Source/bmalloc/bmalloc/LargeMap.cpp	                        (rev 0)
+++ trunk/Source/bmalloc/bmalloc/LargeMap.cpp	2016-08-26 20:18:00 UTC (rev 205032)
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include "LargeMap.h"
+#include <utility>
+
+namespace bmalloc {
+
+LargeRange LargeMap::remove(size_t alignment, size_t size)
+{
+    size_t alignmentMask = alignment - 1;
+
+    LargeRange* candidate = m_free.end();
+    for (LargeRange* it = m_free.begin(); it != m_free.end(); ++it) {
+        if (it->size() < size)
+            continue;
+
+        if (candidate != m_free.end() && candidate->begin() < it->begin())
+            continue;
+
+        if (test(it->begin(), alignmentMask)) {
+            char* aligned = roundUpToMultipleOf(alignment, it->begin());
+            if (aligned < it->begin()) // Check for overflow.
+                continue;
+
+            char* alignedEnd = aligned + size;
+            if (alignedEnd < aligned) // Check for overflow.
+                continue;
+
+            if (alignedEnd > it->end())
+                continue;
+        }
+
+        candidate = it;
+    }
+    
+    if (candidate == m_free.end())
+        return LargeRange();
+
+    return m_free.pop(candidate);
+}
+
+void LargeMap::add(const LargeRange& range)
+{
+    LargeRange merged = range;
+
+    for (size_t i = 0; i < m_free.size(); ++i) {
+        if (!canMerge(merged, m_free[i]))
+            continue;
+
+        merged = merge(merged, m_free.pop(i--));
+    }
+    
+    m_free.push(merged);
+}
+
+} // namespace bmalloc

Copied: trunk/Source/bmalloc/bmalloc/LargeMap.h (from rev 204993, trunk/Source/bmalloc/bmalloc/XLargeMap.h) (0 => 205032)


--- trunk/Source/bmalloc/bmalloc/LargeMap.h	                        (rev 0)
+++ trunk/Source/bmalloc/bmalloc/LargeMap.h	2016-08-26 20:18:00 UTC (rev 205032)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#ifndef LargeMap_h
+#define LargeMap_h
+
+#include "LargeRange.h"
+#include "Vector.h"
+#include <algorithm>
+
+namespace bmalloc {
+
+class LargeMap {
+public:
+    void add(const LargeRange&);
+    LargeRange remove(size_t alignment, size_t);
+    Vector<LargeRange>& ranges() { return m_free; }
+
+private:
+    Vector<LargeRange> m_free;
+};
+
+} // namespace bmalloc
+
+#endif // LargeMap_h

Copied: trunk/Source/bmalloc/bmalloc/LargeRange.h (from rev 204993, trunk/Source/bmalloc/bmalloc/XLargeRange.h) (0 => 205032)


--- trunk/Source/bmalloc/bmalloc/LargeRange.h	                        (rev 0)
+++ trunk/Source/bmalloc/bmalloc/LargeRange.h	2016-08-26 20:18:00 UTC (rev 205032)
@@ -0,0 +1,110 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#ifndef LargeRange_h
+#define LargeRange_h
+
+#include "BAssert.h"
+#include "Range.h"
+
+namespace bmalloc {
+
+class LargeRange : public Range {
+public:
+    LargeRange()
+        : Range()
+        , m_physicalSize(0)
+    {
+    }
+
+    LargeRange(const Range& other, size_t physicalSize)
+        : Range(other)
+        , m_physicalSize(physicalSize)
+    {
+    }
+
+    LargeRange(void* begin, size_t size, size_t physicalSize)
+        : Range(begin, size)
+        , m_physicalSize(physicalSize)
+    {
+    }
+
+    size_t physicalSize() const { return m_physicalSize; }
+    void setPhysicalSize(size_t physicalSize) { m_physicalSize = physicalSize; }
+
+    std::pair<LargeRange, LargeRange> split(size_t) const;
+
+    bool operator<(const void* other) const { return begin() < other; }
+    bool operator<(const LargeRange& other) const { return begin() < other.begin(); }
+
+private:
+    size_t m_physicalSize;
+};
+
+inline bool canMerge(const LargeRange& a, const LargeRange& b)
+{
+    if (a.end() == b.begin())
+        return true;
+    
+    if (b.end() == a.begin())
+        return true;
+    
+    return false;
+}
+
+inline LargeRange merge(const LargeRange& a, const LargeRange& b)
+{
+    const LargeRange& left = std::min(a, b);
+    if (left.size() == left.physicalSize()) {
+        return LargeRange(
+            left.begin(),
+            a.size() + b.size(),
+            a.physicalSize() + b.physicalSize());
+    }
+
+    return LargeRange(
+        left.begin(),
+        a.size() + b.size(),
+        left.physicalSize());
+}
+
+inline std::pair<LargeRange, LargeRange> LargeRange::split(size_t size) const
+{
+    BASSERT(size <= this->size());
+    
+    if (size <= physicalSize()) {
+        LargeRange left(begin(), size, size);
+        LargeRange right(left.end(), this->size() - size, physicalSize() - size);
+        return std::make_pair(left, right);
+    }
+
+    LargeRange left(begin(), size, physicalSize());
+    LargeRange right(left.end(), this->size() - size, 0);
+    return std::make_pair(left, right);
+}
+
+} // namespace bmalloc
+
+#endif // LargeRange_h

Modified: trunk/Source/bmalloc/bmalloc/VMHeap.cpp (205031 => 205032)


--- trunk/Source/bmalloc/bmalloc/VMHeap.cpp	2016-08-26 18:12:56 UTC (rev 205031)
+++ trunk/Source/bmalloc/bmalloc/VMHeap.cpp	2016-08-26 20:18:00 UTC (rev 205032)
@@ -29,23 +29,23 @@
 
 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 @@
     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)

Modified: trunk/Source/bmalloc/bmalloc/VMHeap.h (205031 => 205032)


--- trunk/Source/bmalloc/bmalloc/VMHeap.h	2016-08-26 18:12:56 UTC (rev 205031)
+++ trunk/Source/bmalloc/bmalloc/VMHeap.h	2016-08-26 20:18:00 UTC (rev 205032)
@@ -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 @@
     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);

Deleted: trunk/Source/bmalloc/bmalloc/XLargeMap.cpp (205031 => 205032)


--- trunk/Source/bmalloc/bmalloc/XLargeMap.cpp	2016-08-26 18:12:56 UTC (rev 205031)
+++ trunk/Source/bmalloc/bmalloc/XLargeMap.cpp	2016-08-26 20:18:00 UTC (rev 205032)
@@ -1,79 +0,0 @@
-/*
- * Copyright (C) 2016 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-#include "XLargeMap.h"
-#include <utility>
-
-namespace bmalloc {
-
-XLargeRange XLargeMap::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) {
-        if (it->size() < size)
-            continue;
-
-        if (candidate != m_free.end() && candidate->begin() < it->begin())
-            continue;
-
-        if (test(it->begin(), alignmentMask)) {
-            char* aligned = roundUpToMultipleOf(alignment, it->begin());
-            if (aligned < it->begin()) // Check for overflow.
-                continue;
-
-            char* alignedEnd = aligned + size;
-            if (alignedEnd < aligned) // Check for overflow.
-                continue;
-
-            if (alignedEnd > it->end())
-                continue;
-        }
-
-        candidate = it;
-    }
-    
-    if (candidate == m_free.end())
-        return XLargeRange();
-
-    return m_free.pop(candidate);
-}
-
-void XLargeMap::add(const XLargeRange& range)
-{
-    XLargeRange merged = range;
-
-    for (size_t i = 0; i < m_free.size(); ++i) {
-        if (!canMerge(merged, m_free[i]))
-            continue;
-
-        merged = merge(merged, m_free.pop(i--));
-    }
-    
-    m_free.push(merged);
-}
-
-} // namespace bmalloc

Deleted: trunk/Source/bmalloc/bmalloc/XLargeMap.h (205031 => 205032)


--- trunk/Source/bmalloc/bmalloc/XLargeMap.h	2016-08-26 18:12:56 UTC (rev 205031)
+++ trunk/Source/bmalloc/bmalloc/XLargeMap.h	2016-08-26 20:18:00 UTC (rev 205032)
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2016 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-#ifndef XLargeMap_h
-#define XLargeMap_h
-
-#include "Vector.h"
-#include "XLargeRange.h"
-#include <algorithm>
-
-namespace bmalloc {
-
-class XLargeMap {
-public:
-    void add(const XLargeRange&);
-    XLargeRange remove(size_t alignment, size_t);
-    Vector<XLargeRange>& ranges() { return m_free; }
-
-private:
-    Vector<XLargeRange> m_free;
-};
-
-} // namespace bmalloc
-
-#endif // XLargeMap_h

Deleted: trunk/Source/bmalloc/bmalloc/XLargeRange.h (205031 => 205032)


--- trunk/Source/bmalloc/bmalloc/XLargeRange.h	2016-08-26 18:12:56 UTC (rev 205031)
+++ trunk/Source/bmalloc/bmalloc/XLargeRange.h	2016-08-26 20:18:00 UTC (rev 205032)
@@ -1,107 +0,0 @@
-/*
- * Copyright (C) 2016 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-#ifndef XLargeRange_h
-#define XLargeRange_h
-
-namespace bmalloc {
-
-class XLargeRange : public Range {
-public:
-    XLargeRange()
-        : Range()
-        , m_physicalSize(0)
-    {
-    }
-
-    XLargeRange(const Range& other, size_t physicalSize)
-        : Range(other)
-        , m_physicalSize(physicalSize)
-    {
-    }
-
-    XLargeRange(void* begin, size_t size, size_t physicalSize)
-        : Range(begin, size)
-        , m_physicalSize(physicalSize)
-    {
-    }
-
-    size_t physicalSize() const { return m_physicalSize; }
-    void setPhysicalSize(size_t physicalSize) { m_physicalSize = physicalSize; }
-
-    std::pair<XLargeRange, XLargeRange> split(size_t) const;
-
-    bool operator<(const void* other) const { return begin() < other; }
-    bool operator<(const XLargeRange& other) const { return begin() < other.begin(); }
-
-private:
-    size_t m_physicalSize;
-};
-
-inline bool canMerge(const XLargeRange& a, const XLargeRange& b)
-{
-    if (a.end() == b.begin())
-        return true;
-    
-    if (b.end() == a.begin())
-        return true;
-    
-    return false;
-}
-
-inline XLargeRange merge(const XLargeRange& a, const XLargeRange& b)
-{
-    const XLargeRange& left = std::min(a, b);
-    if (left.size() == left.physicalSize()) {
-        return XLargeRange(
-            left.begin(),
-            a.size() + b.size(),
-            a.physicalSize() + b.physicalSize());
-    }
-
-    return XLargeRange(
-        left.begin(),
-        a.size() + b.size(),
-        left.physicalSize());
-}
-
-inline std::pair<XLargeRange, XLargeRange> XLargeRange::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);
-        return std::make_pair(left, right);
-    }
-
-    XLargeRange left(begin(), size, physicalSize());
-    XLargeRange right(left.end(), this->size() - size, 0);
-    return std::make_pair(left, right);
-}
-
-} // namespace bmalloc
-
-#endif // XLargeRange_h

Modified: trunk/Source/bmalloc/bmalloc.xcodeproj/project.pbxproj (205031 => 205032)


--- trunk/Source/bmalloc/bmalloc.xcodeproj/project.pbxproj	2016-08-26 18:12:56 UTC (rev 205031)
+++ trunk/Source/bmalloc/bmalloc.xcodeproj/project.pbxproj	2016-08-26 20:18:00 UTC (rev 205032)
@@ -19,13 +19,13 @@
 		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>"; };
@@ -115,7 +115,7 @@
 		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; };
@@ -190,9 +190,9 @@
 		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>";
@@ -322,8 +322,8 @@
 				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 */,
@@ -417,7 +417,7 @@
 				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 */,
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to