<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[198700] trunk/Source/bmalloc</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/198700">198700</a></dd>
<dt>Author</dt> <dd>ggaren@apple.com</dd>
<dt>Date</dt> <dd>2016-03-25 16:44:53 -0700 (Fri, 25 Mar 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>2016-03-25  Geoffrey Garen  &lt;ggaren@apple.com&gt;

        Unreviewed, rolling in <a href="http://trac.webkit.org/projects/webkit/changeset/198679">r198679</a>.

        <a href="http://trac.webkit.org/projects/webkit/changeset/198679">r198679</a> was just a rename. The regression was caused by <a href="http://trac.webkit.org/projects/webkit/changeset/198675">r198675</a> and then
        fixed in <a href="http://trac.webkit.org/projects/webkit/changeset/198693">r198693</a>.

        Restored changeset:

        &quot;bmalloc: Renamed LargeChunk =&gt; Chunk&quot;
        https://bugs.webkit.org/show_bug.cgi?id=155894
        http://trac.webkit.org/changeset/198679</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourcebmallocChangeLog">trunk/Source/bmalloc/ChangeLog</a></li>
<li><a href="#trunkSourcebmallocbmallocAllocatorcpp">trunk/Source/bmalloc/bmalloc/Allocator.cpp</a></li>
<li><a href="#trunkSourcebmallocbmallocBoundaryTagh">trunk/Source/bmalloc/bmalloc/BoundaryTag.h</a></li>
<li><a href="#trunkSourcebmallocbmallocDeallocatorcpp">trunk/Source/bmalloc/bmalloc/Deallocator.cpp</a></li>
<li><a href="#trunkSourcebmallocbmallocFreeListcpp">trunk/Source/bmalloc/bmalloc/FreeList.cpp</a></li>
<li><a href="#trunkSourcebmallocbmallocHeapcpp">trunk/Source/bmalloc/bmalloc/Heap.cpp</a></li>
<li><a href="#trunkSourcebmallocbmallocLargeObjecth">trunk/Source/bmalloc/bmalloc/LargeObject.h</a></li>
<li><a href="#trunkSourcebmallocbmallocObjecth">trunk/Source/bmalloc/bmalloc/Object.h</a></li>
<li><a href="#trunkSourcebmallocbmallocObjectTypecpp">trunk/Source/bmalloc/bmalloc/ObjectType.cpp</a></li>
<li><a href="#trunkSourcebmallocbmallocSizesh">trunk/Source/bmalloc/bmalloc/Sizes.h</a></li>
<li><a href="#trunkSourcebmallocbmallocVMHeapcpp">trunk/Source/bmalloc/bmalloc/VMHeap.cpp</a></li>
<li><a href="#trunkSourcebmallocbmallocVMHeaph">trunk/Source/bmalloc/bmalloc/VMHeap.h</a></li>
<li><a href="#trunkSourcebmallocbmallocZonecpp">trunk/Source/bmalloc/bmalloc/Zone.cpp</a></li>
<li><a href="#trunkSourcebmallocbmallocZoneh">trunk/Source/bmalloc/bmalloc/Zone.h</a></li>
<li><a href="#trunkSourcebmallocbmallocxcodeprojprojectpbxproj">trunk/Source/bmalloc/bmalloc.xcodeproj/project.pbxproj</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourcebmallocbmallocChunkh">trunk/Source/bmalloc/bmalloc/Chunk.h</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourcebmallocbmallocLargeChunkh">trunk/Source/bmalloc/bmalloc/LargeChunk.h</a></li>
<li><a href="#trunkSourcebmallocbmallocSmallAllocatorh">trunk/Source/bmalloc/bmalloc/SmallAllocator.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourcebmallocChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/bmalloc/ChangeLog (198699 => 198700)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/bmalloc/ChangeLog        2016-03-25 23:27:18 UTC (rev 198699)
+++ trunk/Source/bmalloc/ChangeLog        2016-03-25 23:44:53 UTC (rev 198700)
</span><span class="lines">@@ -1,5 +1,18 @@
</span><span class="cx"> 2016-03-25  Geoffrey Garen  &lt;ggaren@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Unreviewed, rolling in r198679.
+
+        r198679 was just a rename. The regression was caused by r198675 and then
+        fixed in r198693.
+
+        Restored changeset:
+
+        &quot;bmalloc: Renamed LargeChunk =&gt; Chunk&quot;
+        https://bugs.webkit.org/show_bug.cgi?id=155894
+        http://trac.webkit.org/changeset/198679
+
+2016-03-25  Geoffrey Garen  &lt;ggaren@apple.com&gt;
+
</ins><span class="cx">         Unreviewed, try to fix a crash seen on the bots.
</span><span class="cx"> 
</span><span class="cx">         * bmalloc/Allocator.cpp:
</span></span></pre></div>
<a id="trunkSourcebmallocbmallocAllocatorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/bmalloc/bmalloc/Allocator.cpp (198699 => 198700)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/bmalloc/bmalloc/Allocator.cpp        2016-03-25 23:27:18 UTC (rev 198699)
+++ trunk/Source/bmalloc/bmalloc/Allocator.cpp        2016-03-25 23:44:53 UTC (rev 198700)
</span><span class="lines">@@ -25,9 +25,9 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;Allocator.h&quot;
</span><span class="cx"> #include &quot;BAssert.h&quot;
</span><ins>+#include &quot;Chunk.h&quot;
</ins><span class="cx"> #include &quot;Deallocator.h&quot;
</span><span class="cx"> #include &quot;Heap.h&quot;
</span><del>-#include &quot;LargeChunk.h&quot;
</del><span class="cx"> #include &quot;LargeObject.h&quot;
</span><span class="cx"> #include &quot;PerProcess.h&quot;
</span><span class="cx"> #include &quot;Sizes.h&quot;
</span><span class="lines">@@ -91,7 +91,7 @@
</span><span class="cx">         size = std::max(largeMin, roundUpToMultipleOf&lt;largeAlignment&gt;(size));
</span><span class="cx">         alignment = roundUpToMultipleOf&lt;largeAlignment&gt;(alignment);
</span><span class="cx">         size_t unalignedSize = largeMin + alignment - largeAlignment + size;
</span><del>-        if (unalignedSize &lt;= largeMax &amp;&amp; alignment &lt;= largeChunkSize / 2) {
</del><ins>+        if (unalignedSize &lt;= largeMax &amp;&amp; alignment &lt;= chunkSize / 2) {
</ins><span class="cx">             std::lock_guard&lt;StaticMutex&gt; lock(PerProcess&lt;Heap&gt;::mutex());
</span><span class="cx">             m_deallocator.processObjectLog(lock);
</span><span class="cx">             return PerProcess&lt;Heap&gt;::getFastCase()-&gt;allocateLarge(lock, alignment, size, unalignedSize);
</span></span></pre></div>
<a id="trunkSourcebmallocbmallocBoundaryTagh"></a>
<div class="modfile"><h4>Modified: trunk/Source/bmalloc/bmalloc/BoundaryTag.h (198699 => 198700)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/bmalloc/bmalloc/BoundaryTag.h        2016-03-25 23:27:18 UTC (rev 198699)
+++ trunk/Source/bmalloc/bmalloc/BoundaryTag.h        2016-03-25 23:44:53 UTC (rev 198700)
</span><span class="lines">@@ -36,12 +36,12 @@
</span><span class="cx"> 
</span><span class="cx"> class BeginTag;
</span><span class="cx"> class EndTag;
</span><del>-class LargeChunk;
</del><ins>+class Chunk;
</ins><span class="cx"> class Range;
</span><span class="cx"> 
</span><span class="cx"> class BoundaryTag {
</span><span class="cx"> public:
</span><del>-    static Range init(LargeChunk*);
</del><ins>+    static Range init(Chunk*);
</ins><span class="cx">     static unsigned compactBegin(void*);
</span><span class="cx"> 
</span><span class="cx">     bool isFree() { return m_isFree; }
</span></span></pre></div>
<a id="trunkSourcebmallocbmallocChunkhfromrev198685trunkSourcebmallocbmallocChunkh"></a>
<div class="copfile"><h4>Copied: trunk/Source/bmalloc/bmalloc/Chunk.h (from rev 198685, trunk/Source/bmalloc/bmalloc/Chunk.h) (0 => 198700)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/bmalloc/bmalloc/Chunk.h                                (rev 0)
+++ trunk/Source/bmalloc/bmalloc/Chunk.h        2016-03-25 23:44:53 UTC (rev 198700)
</span><span class="lines">@@ -0,0 +1,239 @@
</span><ins>+/*
+ * Copyright (C) 2014 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 Chunk_h
+#define Chunk_h
+
+#include &quot;BeginTag.h&quot;
+#include &quot;EndTag.h&quot;
+#include &quot;Object.h&quot;
+#include &quot;ObjectType.h&quot;
+#include &quot;Sizes.h&quot;
+#include &quot;SmallLine.h&quot;
+#include &quot;SmallPage.h&quot;
+#include &quot;VMAllocate.h&quot;
+#include &lt;array&gt;
+
+namespace bmalloc {
+
+class Chunk {
+public:
+    static Chunk* get(void*);
+
+    static BeginTag* beginTag(void*);
+    static EndTag* endTag(void*, size_t);
+
+    Chunk(std::lock_guard&lt;StaticMutex&gt;&amp;);
+
+    size_t offset(void*);
+
+    void* object(size_t offset);
+    SmallPage* page(size_t offset);
+    SmallLine* line(size_t offset);
+
+    SmallPage* pageBegin() { return Object(m_memory).page(); }
+    SmallPage* pageEnd() { return m_pages.end(); }
+    
+    SmallLine* lines() { return m_lines.begin(); }
+    SmallPage* pages() { return m_pages.begin(); }
+
+    char* begin() { return m_memory; }
+    char* end() { return reinterpret_cast&lt;char*&gt;(this) + chunkSize; }
+
+private:
+    static const size_t boundaryTagCount = chunkSize / largeMin;
+    static_assert(boundaryTagCount &gt; 2, &quot;Chunk must have space for two sentinel boundary tags&quot;);
+
+    // Our metadata layout includes a left and right edge sentinel.
+    // Metadata takes up enough space to leave at least the first two
+    // boundary tag slots unused.
+    //
+    //      So, boundary tag space looks like this:
+    //
+    //          [OOXXXXX...]
+    //
+    //      And BoundaryTag::get subtracts one, producing:
+    //
+    //          [OXXXXX...O].
+    //
+    // We use the X's for boundary tags and the O's for edge sentinels.
+
+    std::array&lt;SmallLine, chunkSize / smallLineSize&gt; m_lines;
+    std::array&lt;SmallPage, chunkSize / vmPageSize&gt; m_pages;
+    std::array&lt;BoundaryTag, boundaryTagCount&gt; m_boundaryTags;
+    char m_memory[] __attribute__((aligned(2 * smallMax + 0)));
+};
+
+static_assert(sizeof(Chunk) + largeMax &lt;= chunkSize, &quot;largeMax is too big&quot;);
+static_assert(
+    sizeof(Chunk) % vmPageSize + 2 * smallMax &lt;= vmPageSize,
+    &quot;the first page of object memory in a small chunk must be able to allocate smallMax&quot;);
+
+inline Chunk::Chunk(std::lock_guard&lt;StaticMutex&gt;&amp; lock)
+{
+    Range range(begin(), end() - begin());
+    BASSERT(range.size() &lt;= largeObjectMax);
+
+    BeginTag* beginTag = Chunk::beginTag(range.begin());
+    beginTag-&gt;setRange(range);
+    beginTag-&gt;setFree(true);
+    beginTag-&gt;setVMState(VMState::Virtual);
+
+    EndTag* endTag = Chunk::endTag(range.begin(), range.size());
+    endTag-&gt;init(beginTag);
+
+    // Mark the left and right edges of our range as allocated. This naturally
+    // prevents merging logic from overflowing left (into metadata) or right
+    // (beyond our chunk), without requiring special-case checks.
+
+    EndTag* leftSentinel = beginTag-&gt;prev();
+    BASSERT(leftSentinel &gt;= m_boundaryTags.begin());
+    BASSERT(leftSentinel &lt; m_boundaryTags.end());
+    leftSentinel-&gt;initSentinel();
+
+    BeginTag* rightSentinel = endTag-&gt;next();
+    BASSERT(rightSentinel &gt;= m_boundaryTags.begin());
+    BASSERT(rightSentinel &lt; m_boundaryTags.end());
+    rightSentinel-&gt;initSentinel();
+
+    // Track the memory used for metadata by allocating imaginary objects.
+    for (char* it = reinterpret_cast&lt;char*&gt;(this); it &lt; m_memory; it += smallLineSize) {
+        Object object(it);
+        object.line()-&gt;ref(lock);
+        object.page()-&gt;ref(lock);
+    }
+}
+
+inline Chunk* Chunk::get(void* object)
+{
+    return static_cast&lt;Chunk*&gt;(mask(object, chunkMask));
+}
+
+inline BeginTag* Chunk::beginTag(void* object)
+{
+    Chunk* chunk = get(object);
+    size_t boundaryTagNumber = (static_cast&lt;char*&gt;(object) - reinterpret_cast&lt;char*&gt;(chunk)) / largeMin - 1; // - 1 to offset from the right sentinel.
+    return static_cast&lt;BeginTag*&gt;(&amp;chunk-&gt;m_boundaryTags[boundaryTagNumber]);
+}
+
+inline EndTag* Chunk::endTag(void* object, size_t size)
+{
+    Chunk* chunk = get(object);
+    char* end = static_cast&lt;char*&gt;(object) + size;
+
+    // We subtract largeMin before computing the end pointer's boundary tag. An
+    // object's size need not be an even multiple of largeMin. Subtracting
+    // largeMin rounds down to the last boundary tag prior to our neighbor.
+
+    size_t boundaryTagNumber = (end - largeMin - reinterpret_cast&lt;char*&gt;(chunk)) / largeMin - 1; // - 1 to offset from the right sentinel.
+    return static_cast&lt;EndTag*&gt;(&amp;chunk-&gt;m_boundaryTags[boundaryTagNumber]);
+}
+
+inline size_t Chunk::offset(void* object)
+{
+    BASSERT(object &gt;= this);
+    BASSERT(object &lt; reinterpret_cast&lt;char*&gt;(this) + chunkSize);
+    return static_cast&lt;char*&gt;(object) - reinterpret_cast&lt;char*&gt;(this);
+}
+
+inline void* Chunk::object(size_t offset)
+{
+    return reinterpret_cast&lt;char*&gt;(this) + offset;
+}
+
+inline SmallPage* Chunk::page(size_t offset)
+{
+    size_t pageNumber = offset / vmPageSize;
+    return &amp;m_pages[pageNumber];
+}
+
+inline SmallLine* Chunk::line(size_t offset)
+{
+    size_t lineNumber = offset / smallLineSize;
+    return &amp;m_lines[lineNumber];
+}
+
+inline char* SmallLine::begin()
+{
+    Chunk* chunk = Chunk::get(this);
+    size_t lineNumber = this - chunk-&gt;lines();
+    size_t offset = lineNumber * smallLineSize;
+    return &amp;reinterpret_cast&lt;char*&gt;(chunk)[offset];
+}
+
+inline char* SmallLine::end()
+{
+    return begin() + smallLineSize;
+}
+
+inline SmallLine* SmallPage::begin()
+{
+    Chunk* chunk = Chunk::get(this);
+    size_t pageNumber = this - chunk-&gt;pages();
+    size_t lineNumber = pageNumber * smallLineCount;
+    return &amp;chunk-&gt;lines()[lineNumber];
+}
+
+inline SmallLine* SmallPage::end()
+{
+    return begin() + smallLineCount;
+}
+
+inline Object::Object(void* object)
+    : m_chunk(Chunk::get(object))
+    , m_offset(m_chunk-&gt;offset(object))
+{
+}
+
+inline Object::Object(Chunk* chunk, void* object)
+    : m_chunk(chunk)
+    , m_offset(m_chunk-&gt;offset(object))
+{
+    BASSERT(chunk == Chunk::get(object));
+}
+
+inline void* Object::begin()
+{
+    return m_chunk-&gt;object(m_offset);
+}
+
+inline void* Object::pageBegin()
+{
+    return m_chunk-&gt;object(roundDownToMultipleOf(vmPageSize, m_offset));
+}
+
+inline SmallLine* Object::line()
+{
+    return m_chunk-&gt;line(m_offset);
+}
+
+inline SmallPage* Object::page()
+{
+    return m_chunk-&gt;page(m_offset);
+}
+
+}; // namespace bmalloc
+
+#endif // Chunk
</ins></span></pre></div>
<a id="trunkSourcebmallocbmallocDeallocatorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/bmalloc/bmalloc/Deallocator.cpp (198699 => 198700)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/bmalloc/bmalloc/Deallocator.cpp        2016-03-25 23:27:18 UTC (rev 198699)
+++ trunk/Source/bmalloc/bmalloc/Deallocator.cpp        2016-03-25 23:44:53 UTC (rev 198700)
</span><span class="lines">@@ -24,7 +24,7 @@
</span><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> #include &quot;BAssert.h&quot;
</span><del>-#include &quot;LargeChunk.h&quot;
</del><ins>+#include &quot;Chunk.h&quot;
</ins><span class="cx"> #include &quot;Deallocator.h&quot;
</span><span class="cx"> #include &quot;Heap.h&quot;
</span><span class="cx"> #include &quot;Inline.h&quot;
</span></span></pre></div>
<a id="trunkSourcebmallocbmallocFreeListcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/bmalloc/bmalloc/FreeList.cpp (198699 => 198700)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/bmalloc/bmalloc/FreeList.cpp        2016-03-25 23:27:18 UTC (rev 198699)
+++ trunk/Source/bmalloc/bmalloc/FreeList.cpp        2016-03-25 23:44:53 UTC (rev 198700)
</span><span class="lines">@@ -23,8 +23,8 @@
</span><span class="cx">  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-#include &quot;LargeChunk.h&quot;
</del><span class="cx"> #include &quot;FreeList.h&quot;
</span><ins>+#include &quot;Chunk.h&quot;
</ins><span class="cx"> #include &quot;Vector.h&quot;
</span><span class="cx"> 
</span><span class="cx"> namespace bmalloc {
</span></span></pre></div>
<a id="trunkSourcebmallocbmallocHeapcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/bmalloc/bmalloc/Heap.cpp (198699 => 198700)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/bmalloc/bmalloc/Heap.cpp        2016-03-25 23:27:18 UTC (rev 198699)
+++ trunk/Source/bmalloc/bmalloc/Heap.cpp        2016-03-25 23:44:53 UTC (rev 198700)
</span><span class="lines">@@ -25,7 +25,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;Heap.h&quot;
</span><span class="cx"> #include &quot;BumpAllocator.h&quot;
</span><del>-#include &quot;LargeChunk.h&quot;
</del><ins>+#include &quot;Chunk.h&quot;
</ins><span class="cx"> #include &quot;LargeObject.h&quot;
</span><span class="cx"> #include &quot;PerProcess.h&quot;
</span><span class="cx"> #include &quot;SmallLine.h&quot;
</span><span class="lines">@@ -334,7 +334,7 @@
</span><span class="cx">     BASSERT(unalignedSize &lt;= largeMax);
</span><span class="cx">     BASSERT(unalignedSize &gt;= largeMin);
</span><span class="cx">     BASSERT(unalignedSize == roundUpToMultipleOf&lt;largeAlignment&gt;(unalignedSize));
</span><del>-    BASSERT(alignment &lt;= largeChunkSize / 2);
</del><ins>+    BASSERT(alignment &lt;= chunkSize / 2);
</ins><span class="cx">     BASSERT(alignment &gt;= largeAlignment);
</span><span class="cx">     BASSERT(isPowerOfTwo(alignment));
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourcebmallocbmallocLargeChunkh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/bmalloc/bmalloc/LargeChunk.h (198699 => 198700)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/bmalloc/bmalloc/LargeChunk.h        2016-03-25 23:27:18 UTC (rev 198699)
+++ trunk/Source/bmalloc/bmalloc/LargeChunk.h        2016-03-25 23:44:53 UTC (rev 198700)
</span><span class="lines">@@ -1,239 +0,0 @@
</span><del>-/*
- * Copyright (C) 2014 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 LargeChunk_h
-#define LargeChunk_h
-
-#include &quot;BeginTag.h&quot;
-#include &quot;EndTag.h&quot;
-#include &quot;Object.h&quot;
-#include &quot;ObjectType.h&quot;
-#include &quot;Sizes.h&quot;
-#include &quot;SmallLine.h&quot;
-#include &quot;SmallPage.h&quot;
-#include &quot;VMAllocate.h&quot;
-#include &lt;array&gt;
-
-namespace bmalloc {
-
-class LargeChunk {
-public:
-    static LargeChunk* get(void*);
-
-    static BeginTag* beginTag(void*);
-    static EndTag* endTag(void*, size_t);
-
-    LargeChunk(std::lock_guard&lt;StaticMutex&gt;&amp;);
-
-    size_t offset(void*);
-
-    void* object(size_t offset);
-    SmallPage* page(size_t offset);
-    SmallLine* line(size_t offset);
-
-    SmallPage* pageBegin() { return Object(m_memory).page(); }
-    SmallPage* pageEnd() { return m_pages.end(); }
-    
-    SmallLine* lines() { return m_lines.begin(); }
-    SmallPage* pages() { return m_pages.begin(); }
-
-    char* begin() { return m_memory; }
-    char* end() { return reinterpret_cast&lt;char*&gt;(this) + largeChunkSize; }
-
-private:
-    static const size_t boundaryTagCount = largeChunkSize / largeMin;
-    static_assert(boundaryTagCount &gt; 2, &quot;LargeChunk must have space for two sentinel boundary tags&quot;);
-
-    // Our metadata layout includes a left and right edge sentinel.
-    // Metadata takes up enough space to leave at least the first two
-    // boundary tag slots unused.
-    //
-    //      So, boundary tag space looks like this:
-    //
-    //          [OOXXXXX...]
-    //
-    //      And BoundaryTag::get subtracts one, producing:
-    //
-    //          [OXXXXX...O].
-    //
-    // We use the X's for boundary tags and the O's for edge sentinels.
-
-    std::array&lt;SmallLine, largeChunkSize / smallLineSize&gt; m_lines;
-    std::array&lt;SmallPage, largeChunkSize / vmPageSize&gt; m_pages;
-    std::array&lt;BoundaryTag, boundaryTagCount&gt; m_boundaryTags;
-    char m_memory[] __attribute__((aligned(2 * smallMax + 0)));
-};
-
-static_assert(sizeof(LargeChunk) + largeMax &lt;= largeChunkSize, &quot;largeMax is too big&quot;);
-static_assert(
-    sizeof(LargeChunk) % vmPageSize + 2 * smallMax &lt;= vmPageSize,
-    &quot;the first page of object memory in a small chunk must be able to allocate smallMax&quot;);
-
-inline LargeChunk::LargeChunk(std::lock_guard&lt;StaticMutex&gt;&amp; lock)
-{
-    Range range(begin(), end() - begin());
-    BASSERT(range.size() &lt;= largeObjectMax);
-
-    BeginTag* beginTag = LargeChunk::beginTag(range.begin());
-    beginTag-&gt;setRange(range);
-    beginTag-&gt;setFree(true);
-    beginTag-&gt;setVMState(VMState::Virtual);
-
-    EndTag* endTag = LargeChunk::endTag(range.begin(), range.size());
-    endTag-&gt;init(beginTag);
-
-    // Mark the left and right edges of our range as allocated. This naturally
-    // prevents merging logic from overflowing left (into metadata) or right
-    // (beyond our chunk), without requiring special-case checks.
-
-    EndTag* leftSentinel = beginTag-&gt;prev();
-    BASSERT(leftSentinel &gt;= m_boundaryTags.begin());
-    BASSERT(leftSentinel &lt; m_boundaryTags.end());
-    leftSentinel-&gt;initSentinel();
-
-    BeginTag* rightSentinel = endTag-&gt;next();
-    BASSERT(rightSentinel &gt;= m_boundaryTags.begin());
-    BASSERT(rightSentinel &lt; m_boundaryTags.end());
-    rightSentinel-&gt;initSentinel();
-
-    // Track the memory used for metadata by allocating imaginary objects.
-    for (char* it = reinterpret_cast&lt;char*&gt;(this); it &lt; m_memory; it += smallLineSize) {
-        Object object(it);
-        object.line()-&gt;ref(lock);
-        object.page()-&gt;ref(lock);
-    }
-}
-
-inline LargeChunk* LargeChunk::get(void* object)
-{
-    return static_cast&lt;LargeChunk*&gt;(mask(object, largeChunkMask));
-}
-
-inline BeginTag* LargeChunk::beginTag(void* object)
-{
-    LargeChunk* chunk = get(object);
-    size_t boundaryTagNumber = (static_cast&lt;char*&gt;(object) - reinterpret_cast&lt;char*&gt;(chunk)) / largeMin - 1; // - 1 to offset from the right sentinel.
-    return static_cast&lt;BeginTag*&gt;(&amp;chunk-&gt;m_boundaryTags[boundaryTagNumber]);
-}
-
-inline EndTag* LargeChunk::endTag(void* object, size_t size)
-{
-    LargeChunk* chunk = get(object);
-    char* end = static_cast&lt;char*&gt;(object) + size;
-
-    // We subtract largeMin before computing the end pointer's boundary tag. An
-    // object's size need not be an even multiple of largeMin. Subtracting
-    // largeMin rounds down to the last boundary tag prior to our neighbor.
-
-    size_t boundaryTagNumber = (end - largeMin - reinterpret_cast&lt;char*&gt;(chunk)) / largeMin - 1; // - 1 to offset from the right sentinel.
-    return static_cast&lt;EndTag*&gt;(&amp;chunk-&gt;m_boundaryTags[boundaryTagNumber]);
-}
-
-inline size_t LargeChunk::offset(void* object)
-{
-    BASSERT(object &gt;= this);
-    BASSERT(object &lt; reinterpret_cast&lt;char*&gt;(this) + largeChunkSize);
-    return static_cast&lt;char*&gt;(object) - reinterpret_cast&lt;char*&gt;(this);
-}
-
-inline void* LargeChunk::object(size_t offset)
-{
-    return reinterpret_cast&lt;char*&gt;(this) + offset;
-}
-
-inline SmallPage* LargeChunk::page(size_t offset)
-{
-    size_t pageNumber = offset / vmPageSize;
-    return &amp;m_pages[pageNumber];
-}
-
-inline SmallLine* LargeChunk::line(size_t offset)
-{
-    size_t lineNumber = offset / smallLineSize;
-    return &amp;m_lines[lineNumber];
-}
-
-inline char* SmallLine::begin()
-{
-    LargeChunk* chunk = LargeChunk::get(this);
-    size_t lineNumber = this - chunk-&gt;lines();
-    size_t offset = lineNumber * smallLineSize;
-    return &amp;reinterpret_cast&lt;char*&gt;(chunk)[offset];
-}
-
-inline char* SmallLine::end()
-{
-    return begin() + smallLineSize;
-}
-
-inline SmallLine* SmallPage::begin()
-{
-    LargeChunk* chunk = LargeChunk::get(this);
-    size_t pageNumber = this - chunk-&gt;pages();
-    size_t lineNumber = pageNumber * smallLineCount;
-    return &amp;chunk-&gt;lines()[lineNumber];
-}
-
-inline SmallLine* SmallPage::end()
-{
-    return begin() + smallLineCount;
-}
-
-inline Object::Object(void* object)
-    : m_chunk(LargeChunk::get(object))
-    , m_offset(m_chunk-&gt;offset(object))
-{
-}
-
-inline Object::Object(LargeChunk* chunk, void* object)
-    : m_chunk(chunk)
-    , m_offset(m_chunk-&gt;offset(object))
-{
-    BASSERT(chunk == LargeChunk::get(object));
-}
-
-inline void* Object::begin()
-{
-    return m_chunk-&gt;object(m_offset);
-}
-
-inline void* Object::pageBegin()
-{
-    return m_chunk-&gt;object(roundDownToMultipleOf(vmPageSize, m_offset));
-}
-
-inline SmallLine* Object::line()
-{
-    return m_chunk-&gt;line(m_offset);
-}
-
-inline SmallPage* Object::page()
-{
-    return m_chunk-&gt;page(m_offset);
-}
-
-}; // namespace bmalloc
-
-#endif // LargeChunk
</del></span></pre></div>
<a id="trunkSourcebmallocbmallocLargeObjecth"></a>
<div class="modfile"><h4>Modified: trunk/Source/bmalloc/bmalloc/LargeObject.h (198699 => 198700)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/bmalloc/bmalloc/LargeObject.h        2016-03-25 23:27:18 UTC (rev 198699)
+++ trunk/Source/bmalloc/bmalloc/LargeObject.h        2016-03-25 23:44:53 UTC (rev 198700)
</span><span class="lines">@@ -27,8 +27,8 @@
</span><span class="cx"> #define LargeObject_h
</span><span class="cx"> 
</span><span class="cx"> #include &quot;BeginTag.h&quot;
</span><ins>+#include &quot;Chunk.h&quot;
</ins><span class="cx"> #include &quot;EndTag.h&quot;
</span><del>-#include &quot;LargeChunk.h&quot;
</del><span class="cx"> #include &quot;Range.h&quot;
</span><span class="cx"> 
</span><span class="cx"> namespace bmalloc {
</span><span class="lines">@@ -85,16 +85,16 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> inline LargeObject::LargeObject(void* object)
</span><del>-    : m_beginTag(LargeChunk::beginTag(object))
-    , m_endTag(LargeChunk::endTag(object, m_beginTag-&gt;size()))
</del><ins>+    : m_beginTag(Chunk::beginTag(object))
+    , m_endTag(Chunk::endTag(object, m_beginTag-&gt;size()))
</ins><span class="cx">     , m_object(object)
</span><span class="cx"> {
</span><span class="cx">     validate();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> inline LargeObject::LargeObject(DoNotValidateTag, void* object)
</span><del>-    : m_beginTag(LargeChunk::beginTag(object))
-    , m_endTag(LargeChunk::endTag(object, m_beginTag-&gt;size()))
</del><ins>+    : m_beginTag(Chunk::beginTag(object))
+    , m_endTag(Chunk::endTag(object, m_beginTag-&gt;size()))
</ins><span class="cx">     , m_object(object)
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="lines">@@ -194,7 +194,7 @@
</span><span class="cx">         prev-&gt;clear();
</span><span class="cx">         beginTag-&gt;clear();
</span><span class="cx"> 
</span><del>-        beginTag = LargeChunk::beginTag(range.begin());
</del><ins>+        beginTag = Chunk::beginTag(range.begin());
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     BeginTag* next = endTag-&gt;next();
</span><span class="lines">@@ -206,7 +206,7 @@
</span><span class="cx">         endTag-&gt;clear();
</span><span class="cx">         next-&gt;clear();
</span><span class="cx"> 
</span><del>-        endTag = LargeChunk::endTag(range.begin(), range.size());
</del><ins>+        endTag = Chunk::endTag(range.begin(), range.size());
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     beginTag-&gt;setRange(range);
</span><span class="lines">@@ -225,9 +225,9 @@
</span><span class="cx">     BASSERT(leftover.size() &gt;= largeMin);
</span><span class="cx"> 
</span><span class="cx">     BeginTag* splitBeginTag = m_beginTag;
</span><del>-    EndTag* splitEndTag = LargeChunk::endTag(split.begin(), size);
</del><ins>+    EndTag* splitEndTag = Chunk::endTag(split.begin(), size);
</ins><span class="cx"> 
</span><del>-    BeginTag* leftoverBeginTag = LargeChunk::beginTag(leftover.begin());
</del><ins>+    BeginTag* leftoverBeginTag = Chunk::beginTag(leftover.begin());
</ins><span class="cx">     EndTag* leftoverEndTag = m_endTag;
</span><span class="cx"> 
</span><span class="cx">     splitBeginTag-&gt;setRange(split);
</span></span></pre></div>
<a id="trunkSourcebmallocbmallocObjecth"></a>
<div class="modfile"><h4>Modified: trunk/Source/bmalloc/bmalloc/Object.h (198699 => 198700)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/bmalloc/bmalloc/Object.h        2016-03-25 23:27:18 UTC (rev 198699)
+++ trunk/Source/bmalloc/bmalloc/Object.h        2016-03-25 23:44:53 UTC (rev 198700)
</span><span class="lines">@@ -28,16 +28,16 @@
</span><span class="cx"> 
</span><span class="cx"> namespace bmalloc {
</span><span class="cx"> 
</span><del>-class LargeChunk;
</del><ins>+class Chunk;
</ins><span class="cx"> class SmallLine;
</span><span class="cx"> class SmallPage;
</span><span class="cx"> 
</span><span class="cx"> class Object {
</span><span class="cx"> public:
</span><span class="cx">     Object(void*);
</span><del>-    Object(LargeChunk*, void*);
</del><ins>+    Object(Chunk*, void*);
</ins><span class="cx">     
</span><del>-    LargeChunk* chunk() { return m_chunk; }
</del><ins>+    Chunk* chunk() { return m_chunk; }
</ins><span class="cx">     void* begin();
</span><span class="cx">     void* pageBegin();
</span><span class="cx"> 
</span><span class="lines">@@ -45,7 +45,7 @@
</span><span class="cx">     SmallPage* page();
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    LargeChunk* m_chunk;
</del><ins>+    Chunk* m_chunk;
</ins><span class="cx">     size_t m_offset;
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourcebmallocbmallocObjectTypecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/bmalloc/bmalloc/ObjectType.cpp (198699 => 198700)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/bmalloc/bmalloc/ObjectType.cpp        2016-03-25 23:27:18 UTC (rev 198699)
+++ trunk/Source/bmalloc/bmalloc/ObjectType.cpp        2016-03-25 23:44:53 UTC (rev 198700)
</span><span class="lines">@@ -25,7 +25,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;ObjectType.h&quot;
</span><span class="cx"> 
</span><del>-#include &quot;LargeChunk.h&quot;
</del><ins>+#include &quot;Chunk.h&quot;
</ins><span class="cx"> #include &quot;Object.h&quot;
</span><span class="cx"> 
</span><span class="cx"> namespace bmalloc {
</span></span></pre></div>
<a id="trunkSourcebmallocbmallocSizesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/bmalloc/bmalloc/Sizes.h (198699 => 198700)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/bmalloc/bmalloc/Sizes.h        2016-03-25 23:27:18 UTC (rev 198699)
+++ trunk/Source/bmalloc/bmalloc/Sizes.h        2016-03-25 23:44:53 UTC (rev 198700)
</span><span class="lines">@@ -58,15 +58,15 @@
</span><span class="cx">     static const size_t smallMax = 1 * kB;
</span><span class="cx">     static const size_t maskSizeClassMax = 512;
</span><span class="cx"> 
</span><del>-    static const size_t largeChunkSize = 2 * MB;
-    static const size_t largeChunkMask = ~(largeChunkSize - 1ul);
</del><ins>+    static const size_t chunkSize = 2 * MB;
+    static const size_t chunkMask = ~(chunkSize - 1ul);
</ins><span class="cx"> 
</span><span class="cx">     static const size_t largeAlignment = 64;
</span><span class="cx">     static const size_t largeMin = smallMax;
</span><del>-    static const size_t largeObjectMax = largeChunkSize;
</del><ins>+    static const size_t largeObjectMax = chunkSize;
</ins><span class="cx">     static const size_t largeMax = largeObjectMax / 2;
</span><span class="cx"> 
</span><del>-    static const size_t xLargeAlignment = largeChunkSize;
</del><ins>+    static const size_t xLargeAlignment = chunkSize;
</ins><span class="cx">     static const size_t xLargeMask = ~(xLargeAlignment - 1);
</span><span class="cx">     static const size_t xLargeMax = std::numeric_limits&lt;size_t&gt;::max() - xLargeAlignment; // Make sure that rounding up to xLargeAlignment does not overflow.
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourcebmallocbmallocSmallAllocatorh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/bmalloc/bmalloc/SmallAllocator.h ( => )</h4>
<pre class="diff"><span>
<span class="info">Modified: trunk/Source/bmalloc/bmalloc/VMHeap.cpp
===================================================================
</span><del>--- trunk/Source/bmalloc/bmalloc/VMHeap.cpp        2016-03-25 23:27:18 UTC (rev 198699)
</del><ins>+++ trunk/Source/bmalloc/bmalloc/VMHeap.cpp        2016-03-25 23:44:53 UTC (rev 198700)
</ins><span class="lines">@@ -35,16 +35,16 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-LargeObject VMHeap::allocateLargeChunk(std::lock_guard&lt;StaticMutex&gt;&amp; lock)
</del><ins>+LargeObject VMHeap::allocateChunk(std::lock_guard&lt;StaticMutex&gt;&amp; lock)
</ins><span class="cx"> {
</span><del>-    LargeChunk* largeChunk =
-        new (vmAllocate(largeChunkSize, largeChunkSize)) LargeChunk(lock);
</del><ins>+    Chunk* chunk =
+        new (vmAllocate(chunkSize, chunkSize)) Chunk(lock);
</ins><span class="cx"> 
</span><span class="cx"> #if BOS(DARWIN)
</span><del>-    m_zone.addLargeChunk(largeChunk);
</del><ins>+    m_zone.addChunk(chunk);
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    return LargeObject(largeChunk-&gt;begin());
</del><ins>+    return LargeObject(chunk-&gt;begin());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace bmalloc
</span></span></pre></div>
<a id="trunkSourcebmallocbmallocVMHeaph"></a>
<div class="modfile"><h4>Modified: trunk/Source/bmalloc/bmalloc/VMHeap.h (198699 => 198700)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/bmalloc/bmalloc/VMHeap.h        2016-03-25 23:27:18 UTC (rev 198699)
+++ trunk/Source/bmalloc/bmalloc/VMHeap.h        2016-03-25 23:44:53 UTC (rev 198700)
</span><span class="lines">@@ -27,8 +27,8 @@
</span><span class="cx"> #define VMHeap_h
</span><span class="cx"> 
</span><span class="cx"> #include &quot;AsyncTask.h&quot;
</span><ins>+#include &quot;Chunk.h&quot;
</ins><span class="cx"> #include &quot;FixedVector.h&quot;
</span><del>-#include &quot;LargeChunk.h&quot;
</del><span class="cx"> #include &quot;LargeObject.h&quot;
</span><span class="cx"> #include &quot;Range.h&quot;
</span><span class="cx"> #include &quot;SegregatedFreeList.h&quot;
</span><span class="lines">@@ -54,7 +54,7 @@
</span><span class="cx">     void deallocateLargeObject(std::unique_lock&lt;StaticMutex&gt;&amp;, LargeObject);
</span><span class="cx">     
</span><span class="cx"> private:
</span><del>-    LargeObject allocateLargeChunk(std::lock_guard&lt;StaticMutex&gt;&amp;);
</del><ins>+    LargeObject allocateChunk(std::lock_guard&lt;StaticMutex&gt;&amp;);
</ins><span class="cx"> 
</span><span class="cx">     SegregatedFreeList m_largeObjects;
</span><span class="cx"> 
</span><span class="lines">@@ -69,7 +69,7 @@
</span><span class="cx">         return largeObject;
</span><span class="cx"> 
</span><span class="cx">     BASSERT(size &lt;= largeMax);
</span><del>-    return allocateLargeChunk(lock);
</del><ins>+    return allocateChunk(lock);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> inline LargeObject VMHeap::allocateLargeObject(std::lock_guard&lt;StaticMutex&gt;&amp; lock, size_t alignment, size_t size, size_t unalignedSize)
</span><span class="lines">@@ -78,7 +78,7 @@
</span><span class="cx">         return largeObject;
</span><span class="cx"> 
</span><span class="cx">     BASSERT(unalignedSize &lt;= largeMax);
</span><del>-    return allocateLargeChunk(lock);
</del><ins>+    return allocateChunk(lock);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> inline void VMHeap::deallocateLargeObject(std::unique_lock&lt;StaticMutex&gt;&amp; lock, LargeObject largeObject)
</span></span></pre></div>
<a id="trunkSourcebmallocbmallocZonecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/bmalloc/bmalloc/Zone.cpp (198699 => 198700)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/bmalloc/bmalloc/Zone.cpp        2016-03-25 23:27:18 UTC (rev 198699)
+++ trunk/Source/bmalloc/bmalloc/Zone.cpp        2016-03-25 23:44:53 UTC (rev 198700)
</span><span class="lines">@@ -88,8 +88,8 @@
</span><span class="cx"> static kern_return_t enumerator(task_t task, void* context, unsigned type_mask, vm_address_t zone_address, memory_reader_t reader, vm_range_recorder_t recorder)
</span><span class="cx"> {
</span><span class="cx">     Zone remoteZone(task, reader, zone_address);
</span><del>-    for (auto* largeChunk : remoteZone.largeChunks()) {
-        vm_range_t range = { reinterpret_cast&lt;vm_address_t&gt;(largeChunk), largeChunkSize };
</del><ins>+    for (auto* chunk : remoteZone.chunks()) {
+        vm_range_t range = { reinterpret_cast&lt;vm_address_t&gt;(chunk), chunkSize };
</ins><span class="cx"> 
</span><span class="cx">         if ((type_mask &amp; MALLOC_PTR_REGION_RANGE_TYPE))
</span><span class="cx">             (*recorder)(task, context, MALLOC_PTR_REGION_RANGE_TYPE, &amp;range, 1);
</span></span></pre></div>
<a id="trunkSourcebmallocbmallocZoneh"></a>
<div class="modfile"><h4>Modified: trunk/Source/bmalloc/bmalloc/Zone.h (198699 => 198700)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/bmalloc/bmalloc/Zone.h        2016-03-25 23:27:18 UTC (rev 198699)
+++ trunk/Source/bmalloc/bmalloc/Zone.h        2016-03-25 23:44:53 UTC (rev 198700)
</span><span class="lines">@@ -31,7 +31,7 @@
</span><span class="cx"> 
</span><span class="cx"> namespace bmalloc {
</span><span class="cx"> 
</span><del>-class LargeChunk;
</del><ins>+class Chunk;
</ins><span class="cx"> 
</span><span class="cx"> class Zone : public malloc_zone_t {
</span><span class="cx"> public:
</span><span class="lines">@@ -41,30 +41,30 @@
</span><span class="cx">     Zone();
</span><span class="cx">     Zone(task_t, memory_reader_t, vm_address_t);
</span><span class="cx"> 
</span><del>-    void addLargeChunk(LargeChunk*);
-    FixedVector&lt;LargeChunk*, capacity&gt;&amp; largeChunks() { return m_largeChunks; }
</del><ins>+    void addChunk(Chunk*);
+    FixedVector&lt;Chunk*, capacity&gt;&amp; chunks() { return m_chunks; }
</ins><span class="cx">     
</span><span class="cx"> private:
</span><span class="cx">     // This vector has two purposes:
</span><del>-    //     (1) It stores the list of LargeChunks so that we can enumerate
-    //         each LargeChunk and request that it be scanned if reachable.
-    //     (2) It roots a pointer to each LargeChunk in a global non-malloc
-    //         VM region, making each LargeChunk appear reachable, and therefore
</del><ins>+    //     (1) It stores the list of Chunks so that we can enumerate
+    //         each Chunk and request that it be scanned if reachable.
+    //     (2) It roots a pointer to each Chunk in a global non-malloc
+    //         VM region, making each Chunk appear reachable, and therefore
</ins><span class="cx">     //         ensuring that the leaks tool will scan it. (The leaks tool
</span><span class="cx">     //         conservatively scans all writeable VM regions that are not malloc
</span><span class="cx">     //         regions, and then scans malloc regions using the introspection API.)
</span><span class="cx">     // This prevents the leaks tool from reporting false positive leaks for
</span><span class="cx">     // objects pointed to from bmalloc memory -- though it also prevents the
</span><span class="cx">     // leaks tool from finding any leaks in bmalloc memory.
</span><del>-    FixedVector&lt;LargeChunk*, capacity&gt; m_largeChunks;
</del><ins>+    FixedVector&lt;Chunk*, capacity&gt; m_chunks;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><del>-inline void Zone::addLargeChunk(LargeChunk* largeChunk)
</del><ins>+inline void Zone::addChunk(Chunk* chunk)
</ins><span class="cx"> {
</span><del>-    if (m_largeChunks.size() == m_largeChunks.capacity())
</del><ins>+    if (m_chunks.size() == m_chunks.capacity())
</ins><span class="cx">         return;
</span><span class="cx">     
</span><del>-    m_largeChunks.push(largeChunk);
</del><ins>+    m_chunks.push(chunk);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace bmalloc
</span></span></pre></div>
<a id="trunkSourcebmallocbmallocxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/bmalloc/bmalloc.xcodeproj/project.pbxproj (198699 => 198700)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/bmalloc/bmalloc.xcodeproj/project.pbxproj        2016-03-25 23:27:18 UTC (rev 198699)
+++ trunk/Source/bmalloc/bmalloc.xcodeproj/project.pbxproj        2016-03-25 23:44:53 UTC (rev 198700)
</span><span class="lines">@@ -25,13 +25,13 @@
</span><span class="cx">                 144C07F41C7B70260051BB6A /* XLargeMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 144C07F21C7B70260051BB6A /* XLargeMap.cpp */; };
</span><span class="cx">                 144C07F51C7B70260051BB6A /* XLargeMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 144C07F31C7B70260051BB6A /* XLargeMap.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 146041E71C7FF2EF00E9F94E /* SortedVector.h in Headers */ = {isa = PBXBuildFile; fileRef = 146041E61C7FF2EF00E9F94E /* SortedVector.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><ins>+                147DC6E31CA5B70B00724E8D /* Chunk.h in Headers */ = {isa = PBXBuildFile; fileRef = 147DC6E21CA5B70B00724E8D /* Chunk.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 14895D911A3A319C0006235D /* Environment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14895D8F1A3A319C0006235D /* Environment.cpp */; };
</span><span class="cx">                 14895D921A3A319C0006235D /* Environment.h in Headers */ = {isa = PBXBuildFile; fileRef = 14895D901A3A319C0006235D /* Environment.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 14C6216F1A9A9A6200E72293 /* LargeObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 14C6216E1A9A9A6200E72293 /* LargeObject.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 14C919C918FCC59F0028DB43 /* BPlatform.h in Headers */ = {isa = PBXBuildFile; fileRef = 14C919C818FCC59F0028DB43 /* BPlatform.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 14CC394C18EA8858004AFE34 /* libbmalloc.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 14F271BE18EA3963008C152F /* libbmalloc.a */; };
</span><span class="cx">                 14D2CD9B1AA12CFB00770440 /* VMState.h in Headers */ = {isa = PBXBuildFile; fileRef = 14D2CD9A1AA12CFB00770440 /* VMState.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><del>-                14DD788C18F48CAE00950702 /* LargeChunk.h in Headers */ = {isa = PBXBuildFile; fileRef = 147AAA8818CD17CE002201E4 /* LargeChunk.h */; settings = {ATTRIBUTES = (Private, ); }; };
</del><span class="cx">                 14DD788D18F48CC600950702 /* BeginTag.h in Headers */ = {isa = PBXBuildFile; fileRef = 1417F64518B54A700076FA3F /* BeginTag.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 14DD788E18F48CCD00950702 /* BoundaryTag.h in Headers */ = {isa = PBXBuildFile; fileRef = 1485655E18A43AF900ED6942 /* BoundaryTag.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 14DD789018F48CEB00950702 /* Sizes.h in Headers */ = {isa = PBXBuildFile; fileRef = 145F6874179DF84100D65598 /* Sizes.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -119,7 +119,7 @@
</span><span class="cx">                 146BEE2118C845AE0002D5A2 /* SegregatedFreeList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SegregatedFreeList.cpp; path = bmalloc/SegregatedFreeList.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 1479E21217A1A255006D4E9D /* Vector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = Vector.h; path = bmalloc/Vector.h; sourceTree = &quot;&lt;group&gt;&quot;; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
</span><span class="cx">                 1479E21417A1A63E006D4E9D /* VMAllocate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = VMAllocate.h; path = bmalloc/VMAllocate.h; sourceTree = &quot;&lt;group&gt;&quot;; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
</span><del>-                147AAA8818CD17CE002201E4 /* LargeChunk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LargeChunk.h; path = bmalloc/LargeChunk.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><ins>+                147DC6E21CA5B70B00724E8D /* Chunk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Chunk.h; path = bmalloc/Chunk.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 1485655E18A43AF900ED6942 /* BoundaryTag.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BoundaryTag.h; path = bmalloc/BoundaryTag.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 1485656018A43DBA00ED6942 /* ObjectType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ObjectType.h; path = bmalloc/ObjectType.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 14895D8F1A3A319C0006235D /* Environment.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Environment.cpp; path = bmalloc/Environment.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -218,7 +218,6 @@
</span><span class="cx">                                 1417F64618B54A700076FA3F /* EndTag.h */,
</span><span class="cx">                                 143EF9AD1A9FABF6004F5C77 /* FreeList.cpp */,
</span><span class="cx">                                 143EF9AE1A9FABF6004F5C77 /* FreeList.h */,
</span><del>-                                147AAA8818CD17CE002201E4 /* LargeChunk.h */,
</del><span class="cx">                                 14C6216E1A9A9A6200E72293 /* LargeObject.h */,
</span><span class="cx">                                 146BEE2118C845AE0002D5A2 /* SegregatedFreeList.cpp */,
</span><span class="cx">                                 146BEE1E18C841C50002D5A2 /* SegregatedFreeList.h */,
</span><span class="lines">@@ -256,6 +255,7 @@
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><span class="cx">                                 140FA00219CE429C00FFD3C8 /* BumpRange.h */,
</span><ins>+                                147DC6E21CA5B70B00724E8D /* Chunk.h */,
</ins><span class="cx">                                 14895D8F1A3A319C0006235D /* Environment.cpp */,
</span><span class="cx">                                 14895D901A3A319C0006235D /* Environment.h */,
</span><span class="cx">                                 14DA320E18875D9F007269E0 /* Heap.cpp */,
</span><span class="lines">@@ -313,7 +313,6 @@
</span><span class="cx">                         files = (
</span><span class="cx">                                 14DD78CF18F48D7500950702 /* Vector.h in Headers */,
</span><span class="cx">                                 14C919C918FCC59F0028DB43 /* BPlatform.h in Headers */,
</span><del>-                                14DD788C18F48CAE00950702 /* LargeChunk.h in Headers */,
</del><span class="cx">                                 14DD789218F48CFC00950702 /* EndTag.h in Headers */,
</span><span class="cx">                                 1440AFCB1A95261100837FAA /* Zone.h in Headers */,
</span><span class="cx">                                 140FA00519CE4B6800FFD3C8 /* LineMetadata.h in Headers */,
</span><span class="lines">@@ -348,6 +347,7 @@
</span><span class="cx">                                 14DD78C818F48D7500950702 /* FixedVector.h in Headers */,
</span><span class="cx">                                 144C07F51C7B70260051BB6A /* XLargeMap.h in Headers */,
</span><span class="cx">                                 14D2CD9B1AA12CFB00770440 /* VMState.h in Headers */,
</span><ins>+                                147DC6E31CA5B70B00724E8D /* Chunk.h in Headers */,
</ins><span class="cx">                                 14DD78BC18F48D6B00950702 /* SmallLine.h in Headers */,
</span><span class="cx">                                 14DD789818F48D4A00950702 /* Allocator.h in Headers */,
</span><span class="cx">                                 14DD78CB18F48D7500950702 /* PerProcess.h in Headers */,
</span></span></pre>
</div>
</div>

</body>
</html>