<!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>[203621] trunk/Source/JavaScriptCore</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/203621">203621</a></dd>
<dt>Author</dt> <dd>fpizlo@apple.com</dd>
<dt>Date</dt> <dd>2016-07-22 15:14:44 -0700 (Fri, 22 Jul 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Teach MarkedSpace how to allocate auxiliary storage
https://bugs.webkit.org/show_bug.cgi?id=160053

Reviewed by Sam Weinig.
        
Previously, we had two kinds of subspaces in MarkedSpace: destructor and non-destructor. This
was described using &quot;bool needsDestruction&quot; that would get passed around. We'd iterate over
these spaces using duplicated code - one loop for destructors and one for non-destructors, or
a single loop that does one thing for destructors and one for non-destructors.
        
But now we want a third subspace: non-destructor non-JSCell, aka Auxiliary.
        
So, this changes all of the reflection and iteration over subspaces to use functors, so that
the looping is written once and reused. Most places don't even have to know that there is a
third subspace; they just know that they must do things for each subspace, for each
allocator, or for each block - and the functor magic handles it for you.
        
To make this somewhat nice, this change also fixes how we describe subspaces. Instead of a
bool, we now have AllocatorAttributes, which is a struct. If we ever add more subspaces, we
can add fields to AllocatorAttributes to describe how those subspaces differ. For now it just
contains two properties: a DestructionMode and a HeapCell::Kind. The DesctructionMode
replaces bool needsDestruction. I deliberately used a non-class enum to avoid tautologies.
DestructionMode has two members: NeedsDestruction and DoesNotNeedDestruction. I almost went
with DestructionMode::Needed and DestructionMode::NotNeeded, but I felt like that involves
more typing and doesn't actually avoid any kind of namespace issues.
        
This is intended to have no behavior change other than the addition of a totally unused
space, which should always be empty. So hopefully it doesn't cost anything.

* CMakeLists.txt:
* JavaScriptCore.xcodeproj/project.pbxproj:
* heap/AllocatorAttributes.cpp: Added.
(JSC::AllocatorAttributes::dump):
* heap/AllocatorAttributes.h: Added.
(JSC::AllocatorAttributes::AllocatorAttributes):
* heap/DestructionMode.cpp: Added.
(WTF::printInternal):
* heap/DestructionMode.h: Added.
* heap/Heap.h:
* heap/MarkedAllocator.cpp:
(JSC::MarkedAllocator::allocateBlock):
(JSC::MarkedAllocator::addBlock):
* heap/MarkedAllocator.h:
(JSC::MarkedAllocator::cellSize):
(JSC::MarkedAllocator::attributes):
(JSC::MarkedAllocator::needsDestruction):
(JSC::MarkedAllocator::destruction):
(JSC::MarkedAllocator::cellKind):
(JSC::MarkedAllocator::heap):
(JSC::MarkedAllocator::takeLastActiveBlock):
(JSC::MarkedAllocator::MarkedAllocator):
(JSC::MarkedAllocator::init):
(JSC::MarkedAllocator::allocate):
* heap/MarkedBlock.cpp:
(JSC::MarkedBlock::create):
(JSC::MarkedBlock::destroy):
(JSC::MarkedBlock::MarkedBlock):
(JSC::MarkedBlock::callDestructor):
(JSC::MarkedBlock::sweep):
(JSC::MarkedBlock::stopAllocating):
(JSC::MarkedBlock::didRetireBlock):
* heap/MarkedBlock.h:
(JSC::MarkedBlock::cellSize):
(JSC::MarkedBlock::attributes):
(JSC::MarkedBlock::needsDestruction):
(JSC::MarkedBlock::destruction):
(JSC::MarkedBlock::cellKind):
(JSC::MarkedBlock::size):
(JSC::MarkedBlock::forEachCell):
(JSC::MarkedBlock::forEachLiveCell):
(JSC::MarkedBlock::forEachDeadCell):
* heap/MarkedSpace.cpp:
(JSC::MarkedSpace::MarkedSpace):
(JSC::MarkedSpace::~MarkedSpace):
(JSC::MarkedSpace::lastChanceToFinalize):
(JSC::MarkedSpace::resetAllocators):
(JSC::MarkedSpace::forEachAllocator):
(JSC::MarkedSpace::stopAllocating):
(JSC::MarkedSpace::resumeAllocating):
(JSC::MarkedSpace::isPagedOut):
(JSC::MarkedSpace::freeBlock):
(JSC::MarkedSpace::shrink):
(JSC::MarkedSpace::clearNewlyAllocated):
(JSC::clearNewlyAllocatedInBlock): Deleted.
* heap/MarkedSpace.h:
(JSC::MarkedSpace::subspaceForObjectsWithDestructor):
(JSC::MarkedSpace::subspaceForObjectsWithoutDestructor):
(JSC::MarkedSpace::subspaceForAuxiliaryData):
(JSC::MarkedSpace::allocatorFor):
(JSC::MarkedSpace::destructorAllocatorFor):
(JSC::MarkedSpace::auxiliaryAllocatorFor):
(JSC::MarkedSpace::allocateWithoutDestructor):
(JSC::MarkedSpace::allocateWithDestructor):
(JSC::MarkedSpace::allocateAuxiliary):
(JSC::MarkedSpace::forEachBlock):
(JSC::MarkedSpace::didAddBlock):
(JSC::MarkedSpace::capacity):
(JSC::MarkedSpace::forEachSubspace):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreCMakeListstxt">trunk/Source/JavaScriptCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj">trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceJavaScriptCoreheapHeaph">trunk/Source/JavaScriptCore/heap/Heap.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreheapMarkedAllocatorcpp">trunk/Source/JavaScriptCore/heap/MarkedAllocator.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreheapMarkedAllocatorh">trunk/Source/JavaScriptCore/heap/MarkedAllocator.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreheapMarkedBlockcpp">trunk/Source/JavaScriptCore/heap/MarkedBlock.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreheapMarkedBlockh">trunk/Source/JavaScriptCore/heap/MarkedBlock.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreheapMarkedSpacecpp">trunk/Source/JavaScriptCore/heap/MarkedSpace.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreheapMarkedSpaceh">trunk/Source/JavaScriptCore/heap/MarkedSpace.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreheapAllocatorAttributescpp">trunk/Source/JavaScriptCore/heap/AllocatorAttributes.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreheapAllocatorAttributesh">trunk/Source/JavaScriptCore/heap/AllocatorAttributes.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreheapDestructionModecpp">trunk/Source/JavaScriptCore/heap/DestructionMode.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreheapDestructionModeh">trunk/Source/JavaScriptCore/heap/DestructionMode.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/CMakeLists.txt (203620 => 203621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/CMakeLists.txt        2016-07-22 22:14:19 UTC (rev 203620)
+++ trunk/Source/JavaScriptCore/CMakeLists.txt        2016-07-22 22:14:44 UTC (rev 203621)
</span><span class="lines">@@ -434,6 +434,7 @@
</span><span class="cx">     ftl/FTLThunks.cpp
</span><span class="cx">     ftl/FTLValueRange.cpp
</span><span class="cx"> 
</span><ins>+    heap/AllocatorAttributes.cpp
</ins><span class="cx">     heap/CodeBlockSet.cpp
</span><span class="cx">     heap/ConservativeRoots.cpp
</span><span class="cx">     heap/CopiedBlock.cpp
</span><span class="lines">@@ -440,6 +441,7 @@
</span><span class="cx">     heap/CopiedSpace.cpp
</span><span class="cx">     heap/CopyVisitor.cpp
</span><span class="cx">     heap/DeferGC.cpp
</span><ins>+    heap/DestructionMode.cpp
</ins><span class="cx">     heap/EdenGCActivityCallback.cpp
</span><span class="cx">     heap/FullGCActivityCallback.cpp
</span><span class="cx">     heap/GCActivityCallback.cpp
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (203620 => 203621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2016-07-22 22:14:19 UTC (rev 203620)
+++ trunk/Source/JavaScriptCore/ChangeLog        2016-07-22 22:14:44 UTC (rev 203621)
</span><span class="lines">@@ -1,3 +1,104 @@
</span><ins>+2016-07-21  Filip Pizlo  &lt;fpizlo@apple.com&gt;
+
+        Teach MarkedSpace how to allocate auxiliary storage
+        https://bugs.webkit.org/show_bug.cgi?id=160053
+
+        Reviewed by Sam Weinig.
+        
+        Previously, we had two kinds of subspaces in MarkedSpace: destructor and non-destructor. This
+        was described using &quot;bool needsDestruction&quot; that would get passed around. We'd iterate over
+        these spaces using duplicated code - one loop for destructors and one for non-destructors, or
+        a single loop that does one thing for destructors and one for non-destructors.
+        
+        But now we want a third subspace: non-destructor non-JSCell, aka Auxiliary.
+        
+        So, this changes all of the reflection and iteration over subspaces to use functors, so that
+        the looping is written once and reused. Most places don't even have to know that there is a
+        third subspace; they just know that they must do things for each subspace, for each
+        allocator, or for each block - and the functor magic handles it for you.
+        
+        To make this somewhat nice, this change also fixes how we describe subspaces. Instead of a
+        bool, we now have AllocatorAttributes, which is a struct. If we ever add more subspaces, we
+        can add fields to AllocatorAttributes to describe how those subspaces differ. For now it just
+        contains two properties: a DestructionMode and a HeapCell::Kind. The DesctructionMode
+        replaces bool needsDestruction. I deliberately used a non-class enum to avoid tautologies.
+        DestructionMode has two members: NeedsDestruction and DoesNotNeedDestruction. I almost went
+        with DestructionMode::Needed and DestructionMode::NotNeeded, but I felt like that involves
+        more typing and doesn't actually avoid any kind of namespace issues.
+        
+        This is intended to have no behavior change other than the addition of a totally unused
+        space, which should always be empty. So hopefully it doesn't cost anything.
+
+        * CMakeLists.txt:
+        * JavaScriptCore.xcodeproj/project.pbxproj:
+        * heap/AllocatorAttributes.cpp: Added.
+        (JSC::AllocatorAttributes::dump):
+        * heap/AllocatorAttributes.h: Added.
+        (JSC::AllocatorAttributes::AllocatorAttributes):
+        * heap/DestructionMode.cpp: Added.
+        (WTF::printInternal):
+        * heap/DestructionMode.h: Added.
+        * heap/Heap.h:
+        * heap/MarkedAllocator.cpp:
+        (JSC::MarkedAllocator::allocateBlock):
+        (JSC::MarkedAllocator::addBlock):
+        * heap/MarkedAllocator.h:
+        (JSC::MarkedAllocator::cellSize):
+        (JSC::MarkedAllocator::attributes):
+        (JSC::MarkedAllocator::needsDestruction):
+        (JSC::MarkedAllocator::destruction):
+        (JSC::MarkedAllocator::cellKind):
+        (JSC::MarkedAllocator::heap):
+        (JSC::MarkedAllocator::takeLastActiveBlock):
+        (JSC::MarkedAllocator::MarkedAllocator):
+        (JSC::MarkedAllocator::init):
+        (JSC::MarkedAllocator::allocate):
+        * heap/MarkedBlock.cpp:
+        (JSC::MarkedBlock::create):
+        (JSC::MarkedBlock::destroy):
+        (JSC::MarkedBlock::MarkedBlock):
+        (JSC::MarkedBlock::callDestructor):
+        (JSC::MarkedBlock::sweep):
+        (JSC::MarkedBlock::stopAllocating):
+        (JSC::MarkedBlock::didRetireBlock):
+        * heap/MarkedBlock.h:
+        (JSC::MarkedBlock::cellSize):
+        (JSC::MarkedBlock::attributes):
+        (JSC::MarkedBlock::needsDestruction):
+        (JSC::MarkedBlock::destruction):
+        (JSC::MarkedBlock::cellKind):
+        (JSC::MarkedBlock::size):
+        (JSC::MarkedBlock::forEachCell):
+        (JSC::MarkedBlock::forEachLiveCell):
+        (JSC::MarkedBlock::forEachDeadCell):
+        * heap/MarkedSpace.cpp:
+        (JSC::MarkedSpace::MarkedSpace):
+        (JSC::MarkedSpace::~MarkedSpace):
+        (JSC::MarkedSpace::lastChanceToFinalize):
+        (JSC::MarkedSpace::resetAllocators):
+        (JSC::MarkedSpace::forEachAllocator):
+        (JSC::MarkedSpace::stopAllocating):
+        (JSC::MarkedSpace::resumeAllocating):
+        (JSC::MarkedSpace::isPagedOut):
+        (JSC::MarkedSpace::freeBlock):
+        (JSC::MarkedSpace::shrink):
+        (JSC::MarkedSpace::clearNewlyAllocated):
+        (JSC::clearNewlyAllocatedInBlock): Deleted.
+        * heap/MarkedSpace.h:
+        (JSC::MarkedSpace::subspaceForObjectsWithDestructor):
+        (JSC::MarkedSpace::subspaceForObjectsWithoutDestructor):
+        (JSC::MarkedSpace::subspaceForAuxiliaryData):
+        (JSC::MarkedSpace::allocatorFor):
+        (JSC::MarkedSpace::destructorAllocatorFor):
+        (JSC::MarkedSpace::auxiliaryAllocatorFor):
+        (JSC::MarkedSpace::allocateWithoutDestructor):
+        (JSC::MarkedSpace::allocateWithDestructor):
+        (JSC::MarkedSpace::allocateAuxiliary):
+        (JSC::MarkedSpace::forEachBlock):
+        (JSC::MarkedSpace::didAddBlock):
+        (JSC::MarkedSpace::capacity):
+        (JSC::MarkedSpace::forEachSubspace):
+
</ins><span class="cx"> 2016-07-22  Saam Barati  &lt;sbarati@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         REGRESSION(r203537): It made many tests crash on ARMv7 Linux platforms
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj (203620 => 203621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2016-07-22 22:14:19 UTC (rev 203620)
+++ trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2016-07-22 22:14:44 UTC (rev 203621)
</span><span class="lines">@@ -537,6 +537,10 @@
</span><span class="cx">                 0F9495881C57F47500413A48 /* B3StackSlot.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F9495861C57F47500413A48 /* B3StackSlot.h */; };
</span><span class="cx">                 0F952ABC1B487A7700C367C5 /* TrackedReferences.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F952ABA1B487A7700C367C5 /* TrackedReferences.cpp */; };
</span><span class="cx">                 0F952ABD1B487A7700C367C5 /* TrackedReferences.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F952ABB1B487A7700C367C5 /* TrackedReferences.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><ins>+                0F9630391D4192C6005609D9 /* AllocatorAttributes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F9630351D4192C3005609D9 /* AllocatorAttributes.cpp */; };
+                0F96303A1D4192C8005609D9 /* AllocatorAttributes.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F9630361D4192C3005609D9 /* AllocatorAttributes.h */; settings = {ATTRIBUTES = (Private, ); }; };
+                0F96303B1D4192CB005609D9 /* DestructionMode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F9630371D4192C3005609D9 /* DestructionMode.cpp */; };
+                0F96303C1D4192CD005609D9 /* DestructionMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F9630381D4192C3005609D9 /* DestructionMode.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 0F963B3813FC6FE90002D9B2 /* ValueProfile.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F963B3613FC6FDE0002D9B2 /* ValueProfile.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 0F96EBB316676EF6008BADE3 /* CodeBlockWithJITType.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F96EBB116676EF4008BADE3 /* CodeBlockWithJITType.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 0F9749711687ADE400A4FF6A /* JSCellInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F97496F1687ADE200A4FF6A /* JSCellInlines.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -2728,6 +2732,10 @@
</span><span class="cx">                 0F9495861C57F47500413A48 /* B3StackSlot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = B3StackSlot.h; path = b3/B3StackSlot.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 0F952ABA1B487A7700C367C5 /* TrackedReferences.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TrackedReferences.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 0F952ABB1B487A7700C367C5 /* TrackedReferences.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TrackedReferences.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                0F9630351D4192C3005609D9 /* AllocatorAttributes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AllocatorAttributes.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                0F9630361D4192C3005609D9 /* AllocatorAttributes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AllocatorAttributes.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                0F9630371D4192C3005609D9 /* DestructionMode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DestructionMode.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                0F9630381D4192C3005609D9 /* DestructionMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DestructionMode.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 0F963B3613FC6FDE0002D9B2 /* ValueProfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ValueProfile.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 0F96EBB116676EF4008BADE3 /* CodeBlockWithJITType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CodeBlockWithJITType.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 0F97496F1687ADE200A4FF6A /* JSCellInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCellInlines.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -5172,6 +5180,8 @@
</span><span class="cx">                 142E312A134FF0A600AFADB5 /* heap */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><ins>+                                0F9630351D4192C3005609D9 /* AllocatorAttributes.cpp */,
+                                0F9630361D4192C3005609D9 /* AllocatorAttributes.h */,
</ins><span class="cx">                                 0F1C3DD91BBCE09E00E523E4 /* CellState.h */,
</span><span class="cx">                                 0FD8A31117D4326C00CA2C40 /* CodeBlockSet.cpp */,
</span><span class="cx">                                 0FD8A31217D4326C00CA2C40 /* CodeBlockSet.h */,
</span><span class="lines">@@ -5192,6 +5202,8 @@
</span><span class="cx">                                 C218D13F1655CFD50062BB81 /* CopyWorkList.h */,
</span><span class="cx">                                 2A7A58EE1808A4C40020BDF7 /* DeferGC.cpp */,
</span><span class="cx">                                 0F136D4B174AD69B0075B354 /* DeferGC.h */,
</span><ins>+                                0F9630371D4192C3005609D9 /* DestructionMode.cpp */,
+                                0F9630381D4192C3005609D9 /* DestructionMode.h */,
</ins><span class="cx">                                 2A83638318D7D0EE0000EBCC /* EdenGCActivityCallback.cpp */,
</span><span class="cx">                                 2A83638418D7D0EE0000EBCC /* EdenGCActivityCallback.h */,
</span><span class="cx">                                 2A83638718D7D0FE0000EBCC /* FullGCActivityCallback.cpp */,
</span><span class="lines">@@ -7119,6 +7131,7 @@
</span><span class="cx">                                 0FEC851A1BDACDAC0080FF74 /* B3GenericFrequentedBlock.h in Headers */,
</span><span class="cx">                                 0FEC85C31BE167A00080FF74 /* B3HeapRange.h in Headers */,
</span><span class="cx">                                 26718BA51BE99F780052017B /* AirIteratedRegisterCoalescing.h in Headers */,
</span><ins>+                                0F96303C1D4192CD005609D9 /* DestructionMode.h in Headers */,
</ins><span class="cx">                                 0FEC851B1BDACDAC0080FF74 /* B3IndexMap.h in Headers */,
</span><span class="cx">                                 0FEC851C1BDACDAC0080FF74 /* B3IndexSet.h in Headers */,
</span><span class="cx">                                 0FEC85BA1BE1462F0080FF74 /* B3InsertionSet.h in Headers */,
</span><span class="lines">@@ -7556,6 +7569,7 @@
</span><span class="cx">                                 0F0332C818B546EC005F979A /* FTLWeightedTarget.h in Headers */,
</span><span class="cx">                                 0F666EC1183566F900D017F1 /* FullBytecodeLiveness.h in Headers */,
</span><span class="cx">                                 2A83638A18D7D0FE0000EBCC /* FullGCActivityCallback.h in Headers */,
</span><ins>+                                0F96303A1D4192C8005609D9 /* AllocatorAttributes.h in Headers */,
</ins><span class="cx">                                 BC18C4040E16F5CD00B34460 /* FunctionConstructor.h in Headers */,
</span><span class="cx">                                 0FF0F1A016B72A1A005DF95B /* FunctionExecutableDump.h in Headers */,
</span><span class="cx">                                 52B310FB1974AE610080857C /* FunctionHasExecutedCache.h in Headers */,
</span><span class="lines">@@ -9266,6 +9280,7 @@
</span><span class="cx">                                 0F919D0C157EE09F004A4E7D /* JSSymbolTableObject.cpp in Sources */,
</span><span class="cx">                                 70ECA6051AFDBEA200449739 /* JSTemplateRegistryKey.cpp in Sources */,
</span><span class="cx">                                 0F2B66FA17B6B5AB00A7AE3F /* JSTypedArrayConstructors.cpp in Sources */,
</span><ins>+                                0F9630391D4192C6005609D9 /* AllocatorAttributes.cpp in Sources */,
</ins><span class="cx">                                 0F2B66FC17B6B5AB00A7AE3F /* JSTypedArrayPrototypes.cpp in Sources */,
</span><span class="cx">                                 0F2B66FE17B6B5AB00A7AE3F /* JSTypedArrays.cpp in Sources */,
</span><span class="cx">                                 534C457E1BC72549007476A7 /* JSTypedArrayViewConstructor.cpp in Sources */,
</span><span class="lines">@@ -9346,6 +9361,7 @@
</span><span class="cx">                                 969A079A0ED1D3AE00F1F681 /* Opcode.cpp in Sources */,
</span><span class="cx">                                 14280850107EC0D70013E7B2 /* Operations.cpp in Sources */,
</span><span class="cx">                                 0FE228EE1436AB2C00196C48 /* Options.cpp in Sources */,
</span><ins>+                                0F96303B1D4192CB005609D9 /* DestructionMode.cpp in Sources */,
</ins><span class="cx">                                 148F21BC107EC54D0042EC2C /* Parser.cpp in Sources */,
</span><span class="cx">                                 93052C340FB792190048FDC3 /* ParserArena.cpp in Sources */,
</span><span class="cx">                                 0FF9CE731B9CD6D0004EDCA6 /* PolymorphicAccess.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreheapAllocatorAttributescpp"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/heap/AllocatorAttributes.cpp (0 => 203621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/heap/AllocatorAttributes.cpp                                (rev 0)
+++ trunk/Source/JavaScriptCore/heap/AllocatorAttributes.cpp        2016-07-22 22:14:44 UTC (rev 203621)
</span><span class="lines">@@ -0,0 +1,39 @@
</span><ins>+/*
+ * 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 &quot;config.h&quot;
+#include &quot;AllocatorAttributes.h&quot;
+
+#include &lt;wtf/PrintStream.h&gt;
+
+namespace JSC {
+
+void AllocatorAttributes::dump(PrintStream&amp; out) const
+{
+    out.print(&quot;{&quot;, destruction, &quot;, &quot;, cellKind, &quot;}&quot;);
+}
+
+} // namespace JSC
+
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreheapAllocatorAttributesh"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/heap/AllocatorAttributes.h (0 => 203621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/heap/AllocatorAttributes.h                                (rev 0)
+++ trunk/Source/JavaScriptCore/heap/AllocatorAttributes.h        2016-07-22 22:14:44 UTC (rev 203621)
</span><span class="lines">@@ -0,0 +1,44 @@
</span><ins>+/*
+ * 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. 
+ */
+
+#pragma once
+
+#include &quot;DestructionMode.h&quot;
+#include &quot;HeapCell.h&quot;
+#include &lt;wtf/PrintStream.h&gt;
+
+namespace JSC {
+
+struct AllocatorAttributes {
+    AllocatorAttributes() { }
+    
+    void dump(PrintStream&amp; out) const;
+    
+    DestructionMode destruction { DoesNotNeedDestruction };
+    HeapCell::Kind cellKind { HeapCell::JSCell };
+};
+
+} // namespace JSC
+
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreheapDestructionModecpp"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/heap/DestructionMode.cpp (0 => 203621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/heap/DestructionMode.cpp                                (rev 0)
+++ trunk/Source/JavaScriptCore/heap/DestructionMode.cpp        2016-07-22 22:14:44 UTC (rev 203621)
</span><span class="lines">@@ -0,0 +1,50 @@
</span><ins>+/*
+ * 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 &quot;config.h&quot;
+#include &quot;DestructionMode.h&quot;
+
+#include &lt;wtf/PrintStream.h&gt;
+
+namespace WTF {
+
+using namespace JSC;
+
+void printInternal(PrintStream&amp; out, DestructionMode mode)
+{
+    switch (mode) {
+    case NeedsDestruction:
+        out.print(&quot;NeedsDestruction&quot;);
+        return;
+    case DoesNotNeedDestruction:
+        out.print(&quot;DoesNotNeedDestruction&quot;);
+        return;
+    }
+    
+    RELEASE_ASSERT_NOT_REACHED();
+}
+
+} // namespace WTF
+
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreheapDestructionModeh"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/heap/DestructionMode.h (0 => 203621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/heap/DestructionMode.h                                (rev 0)
+++ trunk/Source/JavaScriptCore/heap/DestructionMode.h        2016-07-22 22:14:44 UTC (rev 203621)
</span><span class="lines">@@ -0,0 +1,43 @@
</span><ins>+/*
+ * 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. 
+ */
+
+#pragma once
+
+namespace JSC {
+
+enum DestructionMode : int8_t {
+    DoesNotNeedDestruction,
+    NeedsDestruction
+};
+
+} // namespace JSC
+
+namespace WTF {
+
+class PrintStream;
+void printInternal(PrintStream&amp;, JSC::DestructionMode);
+
+} // namespace WTF
+
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreheapHeaph"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/heap/Heap.h (203620 => 203621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/heap/Heap.h        2016-07-22 22:14:19 UTC (rev 203620)
+++ trunk/Source/JavaScriptCore/heap/Heap.h        2016-07-22 22:14:44 UTC (rev 203621)
</span><span class="lines">@@ -145,6 +145,7 @@
</span><span class="cx">     bool isBusy();
</span><span class="cx">     MarkedSpace::Subspace&amp; subspaceForObjectWithoutDestructor() { return m_objectSpace.subspaceForObjectsWithoutDestructor(); }
</span><span class="cx">     MarkedSpace::Subspace&amp; subspaceForObjectDestructor() { return m_objectSpace.subspaceForObjectsWithDestructor(); }
</span><ins>+    MarkedSpace::Subspace&amp; subspaceForAuxiliaryData() { return m_objectSpace.subspaceForAuxiliaryData(); }
</ins><span class="cx">     template&lt;typename ClassType&gt; MarkedSpace::Subspace&amp; subspaceForObjectOfType();
</span><span class="cx">     MarkedAllocator&amp; allocatorForObjectWithoutDestructor(size_t bytes) { return m_objectSpace.allocatorFor(bytes); }
</span><span class="cx">     MarkedAllocator&amp; allocatorForObjectWithDestructor(size_t bytes) { return m_objectSpace.destructorAllocatorFor(bytes); }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreheapMarkedAllocatorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/heap/MarkedAllocator.cpp (203620 => 203621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/heap/MarkedAllocator.cpp        2016-07-22 22:14:19 UTC (rev 203620)
+++ trunk/Source/JavaScriptCore/heap/MarkedAllocator.cpp        2016-07-22 22:14:44 UTC (rev 203621)
</span><span class="lines">@@ -186,10 +186,7 @@
</span><span class="cx"> 
</span><span class="cx">     size_t cellSize = m_cellSize ? m_cellSize : WTF::roundUpToMultipleOf&lt;MarkedBlock::atomSize&gt;(bytes);
</span><span class="cx"> 
</span><del>-    // FIXME: Support allocating storage in marked blocks. This would mean that allocateBlock()
-    // takes a HeapCell::Kind, or something like that.
-    // https://bugs.webkit.org/show_bug.cgi?id=159658
-    return MarkedBlock::create(*m_heap, this, blockSize, cellSize, m_needsDestruction, HeapCell::JSCell);
</del><ins>+    return MarkedBlock::create(*m_heap, this, blockSize, cellSize, m_attributes);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void MarkedAllocator::addBlock(MarkedBlock* block)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreheapMarkedAllocatorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/heap/MarkedAllocator.h (203620 => 203621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/heap/MarkedAllocator.h        2016-07-22 22:14:19 UTC (rev 203620)
+++ trunk/Source/JavaScriptCore/heap/MarkedAllocator.h        2016-07-22 22:14:44 UTC (rev 203621)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2012, 2013, 2016 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -26,6 +26,7 @@
</span><span class="cx"> #ifndef MarkedAllocator_h
</span><span class="cx"> #define MarkedAllocator_h
</span><span class="cx"> 
</span><ins>+#include &quot;AllocatorAttributes.h&quot;
</ins><span class="cx"> #include &quot;MarkedBlock.h&quot;
</span><span class="cx"> #include &lt;wtf/DoublyLinkedList.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -46,8 +47,11 @@
</span><span class="cx">     void reset();
</span><span class="cx">     void stopAllocating();
</span><span class="cx">     void resumeAllocating();
</span><del>-    size_t cellSize() { return m_cellSize; }
-    bool needsDestruction() { return m_needsDestruction; }
</del><ins>+    size_t cellSize() const { return m_cellSize; }
+    const AllocatorAttributes&amp; attributes() const { return m_attributes; }
+    bool needsDestruction() const { return m_attributes.destruction == NeedsDestruction; }
+    DestructionMode destruction() const { return m_attributes.destruction; }
+    HeapCell::Kind cellKind() const { return m_attributes.cellKind; }
</ins><span class="cx">     void* allocate(size_t);
</span><span class="cx">     Heap* heap() { return m_heap; }
</span><span class="cx">     MarkedBlock* takeLastActiveBlock()
</span><span class="lines">@@ -61,7 +65,7 @@
</span><span class="cx">     
</span><span class="cx">     void addBlock(MarkedBlock*);
</span><span class="cx">     void removeBlock(MarkedBlock*);
</span><del>-    void init(Heap*, MarkedSpace*, size_t cellSize, bool needsDestruction);
</del><ins>+    void init(Heap*, MarkedSpace*, size_t cellSize, const AllocatorAttributes&amp;);
</ins><span class="cx"> 
</span><span class="cx">     bool isPagedOut(double deadline);
</span><span class="cx">    
</span><span class="lines">@@ -81,7 +85,7 @@
</span><span class="cx">     DoublyLinkedList&lt;MarkedBlock&gt; m_blockList;
</span><span class="cx">     DoublyLinkedList&lt;MarkedBlock&gt; m_retiredBlocks;
</span><span class="cx">     size_t m_cellSize;
</span><del>-    bool m_needsDestruction { false };
</del><ins>+    AllocatorAttributes m_attributes;
</ins><span class="cx">     Heap* m_heap;
</span><span class="cx">     MarkedSpace* m_markedSpace;
</span><span class="cx"> };
</span><span class="lines">@@ -101,12 +105,12 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline void MarkedAllocator::init(Heap* heap, MarkedSpace* markedSpace, size_t cellSize, bool needsDestruction)
</del><ins>+inline void MarkedAllocator::init(Heap* heap, MarkedSpace* markedSpace, size_t cellSize, const AllocatorAttributes&amp; attributes)
</ins><span class="cx"> {
</span><span class="cx">     m_heap = heap;
</span><span class="cx">     m_markedSpace = markedSpace;
</span><span class="cx">     m_cellSize = cellSize;
</span><del>-    m_needsDestruction = needsDestruction;
</del><ins>+    m_attributes = attributes;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> inline void* MarkedAllocator::allocate(size_t bytes)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreheapMarkedBlockcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/heap/MarkedBlock.cpp (203620 => 203621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/heap/MarkedBlock.cpp        2016-07-22 22:14:19 UTC (rev 203620)
+++ trunk/Source/JavaScriptCore/heap/MarkedBlock.cpp        2016-07-22 22:14:44 UTC (rev 203621)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2011 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2011, 2016 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -35,7 +35,7 @@
</span><span class="cx"> static const bool computeBalance = false;
</span><span class="cx"> static size_t balance;
</span><span class="cx"> 
</span><del>-MarkedBlock* MarkedBlock::create(Heap&amp; heap, MarkedAllocator* allocator, size_t capacity, size_t cellSize, bool needsDestruction, HeapCell::Kind cellKind)
</del><ins>+MarkedBlock* MarkedBlock::create(Heap&amp; heap, MarkedAllocator* allocator, size_t capacity, size_t cellSize, const AllocatorAttributes&amp; attributes)
</ins><span class="cx"> {
</span><span class="cx">     if (computeBalance) {
</span><span class="cx">         balance++;
</span><span class="lines">@@ -42,7 +42,7 @@
</span><span class="cx">         if (!(balance % 10))
</span><span class="cx">             dataLog(&quot;MarkedBlock Balance: &quot;, balance, &quot;\n&quot;);
</span><span class="cx">     }
</span><del>-    MarkedBlock* block = new (NotNull, fastAlignedMalloc(blockSize, capacity)) MarkedBlock(allocator, capacity, cellSize, needsDestruction, cellKind);
</del><ins>+    MarkedBlock* block = new (NotNull, fastAlignedMalloc(blockSize, capacity)) MarkedBlock(allocator, capacity, cellSize, attributes);
</ins><span class="cx">     heap.didAllocateBlock(capacity);
</span><span class="cx">     return block;
</span><span class="cx"> }
</span><span class="lines">@@ -60,13 +60,12 @@
</span><span class="cx">     heap.didFreeBlock(capacity);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-MarkedBlock::MarkedBlock(MarkedAllocator* allocator, size_t capacity, size_t cellSize, bool needsDestruction, HeapCell::Kind cellKind)
</del><ins>+MarkedBlock::MarkedBlock(MarkedAllocator* allocator, size_t capacity, size_t cellSize, const AllocatorAttributes&amp; attributes)
</ins><span class="cx">     : DoublyLinkedListNode&lt;MarkedBlock&gt;()
</span><span class="cx">     , m_atomsPerCell((cellSize + atomSize - 1) / atomSize)
</span><span class="cx">     , m_endAtom((allocator-&gt;cellSize() ? atomsPerBlock - m_atomsPerCell : firstAtom()) + 1)
</span><span class="cx">     , m_capacity(capacity)
</span><del>-    , m_needsDestruction(needsDestruction)
-    , m_cellKind(cellKind)
</del><ins>+    , m_attributes(attributes)
</ins><span class="cx">     , m_allocator(allocator)
</span><span class="cx">     , m_state(New) // All cells start out unmarked.
</span><span class="cx">     , m_weakSet(allocator-&gt;heap()-&gt;vm(), *this)
</span><span class="lines">@@ -73,6 +72,8 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(allocator);
</span><span class="cx">     HEAP_LOG_BLOCK_STATE_TRANSITION(this);
</span><ins>+    if (m_attributes.cellKind != HeapCell::JSCell)
+        RELEASE_ASSERT(m_attributes.destruction == DoesNotNeedDestruction);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> inline void MarkedBlock::callDestructor(HeapCell* cell)
</span><span class="lines">@@ -134,10 +135,10 @@
</span><span class="cx"> 
</span><span class="cx">     m_weakSet.sweep();
</span><span class="cx"> 
</span><del>-    if (sweepMode == SweepOnly &amp;&amp; !m_needsDestruction)
</del><ins>+    if (sweepMode == SweepOnly &amp;&amp; m_attributes.destruction == DoesNotNeedDestruction)
</ins><span class="cx">         return FreeList();
</span><span class="cx"> 
</span><del>-    if (m_needsDestruction)
</del><ins>+    if (m_attributes.destruction == NeedsDestruction)
</ins><span class="cx">         return sweepHelper&lt;true&gt;(sweepMode);
</span><span class="cx">     return sweepHelper&lt;false&gt;(sweepMode);
</span><span class="cx"> }
</span><span class="lines">@@ -216,7 +217,7 @@
</span><span class="cx">     FreeCell* next;
</span><span class="cx">     for (FreeCell* current = head; current; current = next) {
</span><span class="cx">         next = current-&gt;next;
</span><del>-        if (m_needsDestruction)
</del><ins>+        if (m_attributes.destruction == NeedsDestruction)
</ins><span class="cx">             reinterpret_cast&lt;HeapCell*&gt;(current)-&gt;zap();
</span><span class="cx">         clearNewlyAllocated(current);
</span><span class="cx">     }
</span><span class="lines">@@ -294,7 +295,7 @@
</span><span class="cx">     FreeCell* next;
</span><span class="cx">     for (FreeCell* current = head; current; current = next) {
</span><span class="cx">         next = current-&gt;next;
</span><del>-        if (m_needsDestruction)
</del><ins>+        if (m_attributes.destruction == NeedsDestruction)
</ins><span class="cx">             reinterpret_cast&lt;HeapCell*&gt;(current)-&gt;zap();
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreheapMarkedBlockh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/heap/MarkedBlock.h (203620 => 203621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/heap/MarkedBlock.h        2016-07-22 22:14:19 UTC (rev 203620)
+++ trunk/Source/JavaScriptCore/heap/MarkedBlock.h        2016-07-22 22:14:44 UTC (rev 203621)
</span><span class="lines">@@ -1,7 +1,7 @@
</span><span class="cx"> /*
</span><span class="cx">  *  Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
</span><span class="cx">  *  Copyright (C) 2001 Peter Kelly (pmk@post.com)
</span><del>- *  Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2011 Apple Inc. All rights reserved.
</del><ins>+ *  Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2016 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  *  This library is free software; you can redistribute it and/or
</span><span class="cx">  *  modify it under the terms of the GNU Lesser General Public
</span><span class="lines">@@ -22,6 +22,8 @@
</span><span class="cx"> #ifndef MarkedBlock_h
</span><span class="cx"> #define MarkedBlock_h
</span><span class="cx"> 
</span><ins>+#include &quot;AllocatorAttributes.h&quot;
+#include &quot;DestructionMode.h&quot;
</ins><span class="cx"> #include &quot;HeapCell.h&quot;
</span><span class="cx"> #include &quot;HeapOperation.h&quot;
</span><span class="cx"> #include &quot;IterationStatus.h&quot;
</span><span class="lines">@@ -107,7 +109,7 @@
</span><span class="cx">             mutable ReturnType m_count;
</span><span class="cx">         };
</span><span class="cx"> 
</span><del>-        static MarkedBlock* create(Heap&amp;, MarkedAllocator*, size_t capacity, size_t cellSize, bool needsDestruction, HeapCell::Kind);
</del><ins>+        static MarkedBlock* create(Heap&amp;, MarkedAllocator*, size_t capacity, size_t cellSize, const AllocatorAttributes&amp;);
</ins><span class="cx">         static void destroy(Heap&amp;, MarkedBlock*);
</span><span class="cx"> 
</span><span class="cx">         static bool isAtomAligned(const void*);
</span><span class="lines">@@ -147,6 +149,8 @@
</span><span class="cx">         bool isEmpty();
</span><span class="cx"> 
</span><span class="cx">         size_t cellSize();
</span><ins>+        const AllocatorAttributes&amp; attributes() const;
+        DestructionMode destruction() const;
</ins><span class="cx">         bool needsDestruction() const;
</span><span class="cx">         HeapCell::Kind cellKind() const;
</span><span class="cx"> 
</span><span class="lines">@@ -184,7 +188,7 @@
</span><span class="cx"> 
</span><span class="cx">         typedef char Atom[atomSize];
</span><span class="cx"> 
</span><del>-        MarkedBlock(MarkedAllocator*, size_t capacity, size_t cellSize, bool needsDestruction, HeapCell::Kind);
</del><ins>+        MarkedBlock(MarkedAllocator*, size_t capacity, size_t cellSize, const AllocatorAttributes&amp;);
</ins><span class="cx">         Atom* atoms();
</span><span class="cx">         size_t atomNumber(const void*);
</span><span class="cx">         void callDestructor(HeapCell*);
</span><span class="lines">@@ -199,8 +203,7 @@
</span><span class="cx">         std::unique_ptr&lt;WTF::Bitmap&lt;atomsPerBlock&gt;&gt; m_newlyAllocated;
</span><span class="cx"> 
</span><span class="cx">         size_t m_capacity;
</span><del>-        bool m_needsDestruction;
-        HeapCell::Kind m_cellKind;
</del><ins>+        AllocatorAttributes m_attributes;
</ins><span class="cx">         MarkedAllocator* m_allocator;
</span><span class="cx">         BlockState m_state;
</span><span class="cx">         WeakSet m_weakSet;
</span><span class="lines">@@ -301,14 +304,24 @@
</span><span class="cx">         return m_atomsPerCell * atomSize;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    inline const AllocatorAttributes&amp; MarkedBlock::attributes() const
+    {
+        return m_attributes;
+    }
+
</ins><span class="cx">     inline bool MarkedBlock::needsDestruction() const
</span><span class="cx">     {
</span><del>-        return m_needsDestruction;
</del><ins>+        return m_attributes.destruction == NeedsDestruction;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    inline DestructionMode MarkedBlock::destruction() const
+    {
+        return m_attributes.destruction;
+    }
+
</ins><span class="cx">     inline HeapCell::Kind MarkedBlock::cellKind() const
</span><span class="cx">     {
</span><del>-        return m_cellKind;
</del><ins>+        return m_attributes.cellKind;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     inline size_t MarkedBlock::size()
</span><span class="lines">@@ -420,7 +433,7 @@
</span><span class="cx"> 
</span><span class="cx">     template &lt;typename Functor&gt; inline IterationStatus MarkedBlock::forEachCell(const Functor&amp; functor)
</span><span class="cx">     {
</span><del>-        HeapCell::Kind kind = m_cellKind;
</del><ins>+        HeapCell::Kind kind = m_attributes.cellKind;
</ins><span class="cx">         for (size_t i = firstAtom(); i &lt; m_endAtom; i += m_atomsPerCell) {
</span><span class="cx">             HeapCell* cell = reinterpret_cast_ptr&lt;HeapCell*&gt;(&amp;atoms()[i]);
</span><span class="cx">             if (functor(cell, kind) == IterationStatus::Done)
</span><span class="lines">@@ -431,7 +444,7 @@
</span><span class="cx"> 
</span><span class="cx">     template &lt;typename Functor&gt; inline IterationStatus MarkedBlock::forEachLiveCell(const Functor&amp; functor)
</span><span class="cx">     {
</span><del>-        HeapCell::Kind kind = m_cellKind;
</del><ins>+        HeapCell::Kind kind = m_attributes.cellKind;
</ins><span class="cx">         for (size_t i = firstAtom(); i &lt; m_endAtom; i += m_atomsPerCell) {
</span><span class="cx">             HeapCell* cell = reinterpret_cast_ptr&lt;HeapCell*&gt;(&amp;atoms()[i]);
</span><span class="cx">             if (!isLive(cell))
</span><span class="lines">@@ -445,7 +458,7 @@
</span><span class="cx"> 
</span><span class="cx">     template &lt;typename Functor&gt; inline IterationStatus MarkedBlock::forEachDeadCell(const Functor&amp; functor)
</span><span class="cx">     {
</span><del>-        HeapCell::Kind kind = m_cellKind;
</del><ins>+        HeapCell::Kind kind = m_attributes.cellKind;
</ins><span class="cx">         for (size_t i = firstAtom(); i &lt; m_endAtom; i += m_atomsPerCell) {
</span><span class="cx">             HeapCell* cell = reinterpret_cast_ptr&lt;HeapCell*&gt;(&amp;atoms()[i]);
</span><span class="cx">             if (isLive(cell))
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreheapMarkedSpacecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/heap/MarkedSpace.cpp (203620 => 203621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/heap/MarkedSpace.cpp        2016-07-22 22:14:19 UTC (rev 203620)
+++ trunk/Source/JavaScriptCore/heap/MarkedSpace.cpp        2016-07-22 22:14:44 UTC (rev 203621)
</span><span class="lines">@@ -32,18 +32,11 @@
</span><span class="cx">     , m_capacity(0)
</span><span class="cx">     , m_isIterating(false)
</span><span class="cx"> {
</span><del>-    for (size_t cellSize = preciseStep; cellSize &lt;= preciseCutoff; cellSize += preciseStep) {
-        allocatorFor(cellSize).init(heap, this, cellSize, false);
-        destructorAllocatorFor(cellSize).init(heap, this, cellSize, true);
-    }
-
-    for (size_t cellSize = impreciseStart; cellSize &lt;= impreciseCutoff; cellSize += impreciseStep) {
-        allocatorFor(cellSize).init(heap, this, cellSize, false);
-        destructorAllocatorFor(cellSize).init(heap, this, cellSize, true);
-    }
-
-    m_normalSpace.largeAllocator.init(heap, this, 0, false);
-    m_destructorSpace.largeAllocator.init(heap, this, 0, true);
</del><ins>+    forEachAllocator(
+        [&amp;] (MarkedAllocator&amp; allocator, size_t cellSize, AllocatorAttributes attributes) -&gt; IterationStatus {
+            allocator.init(heap, this, cellSize, attributes);
+            return IterationStatus::Continue;
+        });
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> MarkedSpace::~MarkedSpace()
</span><span class="lines">@@ -59,8 +52,9 @@
</span><span class="cx"> {
</span><span class="cx">     stopAllocating();
</span><span class="cx">     forEachAllocator(
</span><del>-        [&amp;] (MarkedAllocator&amp; allocator) {
</del><ins>+        [&amp;] (MarkedAllocator&amp; allocator, size_t, AllocatorAttributes) -&gt; IterationStatus {
</ins><span class="cx">             allocator.lastChanceToFinalize();
</span><ins>+            return IterationStatus::Continue;
</ins><span class="cx">         });
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -87,19 +81,12 @@
</span><span class="cx"> 
</span><span class="cx"> void MarkedSpace::resetAllocators()
</span><span class="cx"> {
</span><del>-    for (size_t cellSize = preciseStep; cellSize &lt;= preciseCutoff; cellSize += preciseStep) {
-        allocatorFor(cellSize).reset();
-        destructorAllocatorFor(cellSize).reset();
-    }
</del><ins>+    forEachAllocator(
+        [&amp;] (MarkedAllocator&amp; allocator, size_t, AllocatorAttributes) -&gt; IterationStatus {
+            allocator.reset();
+            return IterationStatus::Continue;
+        });
</ins><span class="cx"> 
</span><del>-    for (size_t cellSize = impreciseStart; cellSize &lt;= impreciseCutoff; cellSize += impreciseStep) {
-        allocatorFor(cellSize).reset();
-        destructorAllocatorFor(cellSize).reset();
-    }
-
-    m_normalSpace.largeAllocator.reset();
-    m_destructorSpace.largeAllocator.reset();
-
</del><span class="cx">     m_blocksWithNewObjects.clear();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -132,18 +119,21 @@
</span><span class="cx"> template &lt;typename Functor&gt;
</span><span class="cx"> void MarkedSpace::forEachAllocator(const Functor&amp; functor)
</span><span class="cx"> {
</span><del>-    for (size_t cellSize = preciseStep; cellSize &lt;= preciseCutoff; cellSize += preciseStep) {
-        functor(allocatorFor(cellSize));
-        functor(destructorAllocatorFor(cellSize));
-    }
-
-    for (size_t cellSize = impreciseStart; cellSize &lt;= impreciseCutoff; cellSize += impreciseStep) {
-        functor(allocatorFor(cellSize));
-        functor(destructorAllocatorFor(cellSize));
-    }
-
-    functor(m_normalSpace.largeAllocator);
-    functor(m_destructorSpace.largeAllocator);
</del><ins>+    forEachSubspace(
+        [&amp;] (Subspace&amp; subspace, AllocatorAttributes attributes) -&gt; IterationStatus {
+            for (size_t cellSize = preciseStep; cellSize &lt;= preciseCutoff; cellSize += preciseStep) {
+                if (functor(allocatorFor(subspace, cellSize), cellSize, attributes) == IterationStatus::Done)
+                    return IterationStatus::Done;
+            }
+            for (size_t cellSize = impreciseStart; cellSize &lt;= impreciseCutoff; cellSize += impreciseStep) {
+                if (functor(allocatorFor(subspace, cellSize), cellSize, attributes) == IterationStatus::Done)
+                    return IterationStatus::Done;
+            }
+            if (functor(subspace.largeAllocator, 0, attributes) == IterationStatus::Done)
+                return IterationStatus::Done;
+            
+            return IterationStatus::Continue;
+        });
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void MarkedSpace::stopAllocating()
</span><span class="lines">@@ -150,8 +140,9 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!isIterating());
</span><span class="cx">     forEachAllocator(
</span><del>-        [&amp;] (MarkedAllocator&amp; allocator) {
</del><ins>+        [&amp;] (MarkedAllocator&amp; allocator, size_t, AllocatorAttributes) -&gt; IterationStatus {
</ins><span class="cx">             allocator.stopAllocating();
</span><ins>+            return IterationStatus::Continue;
</ins><span class="cx">         });
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -159,30 +150,24 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(isIterating());
</span><span class="cx">     forEachAllocator(
</span><del>-        [&amp;] (MarkedAllocator&amp; allocator) {
</del><ins>+        [&amp;] (MarkedAllocator&amp; allocator, size_t, AllocatorAttributes) -&gt; IterationStatus {
</ins><span class="cx">             allocator.resumeAllocating();
</span><ins>+            return IterationStatus::Continue;
</ins><span class="cx">         });
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool MarkedSpace::isPagedOut(double deadline)
</span><span class="cx"> {
</span><del>-    for (size_t cellSize = preciseStep; cellSize &lt;= preciseCutoff; cellSize += preciseStep) {
-        if (allocatorFor(cellSize).isPagedOut(deadline) 
-            || destructorAllocatorFor(cellSize).isPagedOut(deadline))
-            return true;
-    }
-
-    for (size_t cellSize = impreciseStart; cellSize &lt;= impreciseCutoff; cellSize += impreciseStep) {
-        if (allocatorFor(cellSize).isPagedOut(deadline) 
-            || destructorAllocatorFor(cellSize).isPagedOut(deadline))
-            return true;
-    }
-
-    if (m_normalSpace.largeAllocator.isPagedOut(deadline)
-        || m_destructorSpace.largeAllocator.isPagedOut(deadline))
-        return true;
-
-    return false;
</del><ins>+    bool result = false;
+    forEachAllocator(
+        [&amp;] (MarkedAllocator&amp; allocator, size_t, AllocatorAttributes) -&gt; IterationStatus {
+            if (allocator.isPagedOut(deadline)) {
+                result = true;
+                return IterationStatus::Done;
+            }
+            return IterationStatus::Continue;
+        });
+    return result;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void MarkedSpace::freeBlock(MarkedBlock* block)
</span><span class="lines">@@ -211,34 +196,24 @@
</span><span class="cx">         });
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static void clearNewlyAllocatedInBlock(MarkedBlock* block)
-{
-    if (!block)
-        return;
-    block-&gt;clearNewlyAllocated();
-}
-
</del><span class="cx"> void MarkedSpace::clearNewlyAllocated()
</span><span class="cx"> {
</span><del>-    for (size_t i = 0; i &lt; preciseCount; ++i) {
-        clearNewlyAllocatedInBlock(m_normalSpace.preciseAllocators[i].takeLastActiveBlock());
-        clearNewlyAllocatedInBlock(m_destructorSpace.preciseAllocators[i].takeLastActiveBlock());
-    }
</del><ins>+    forEachAllocator(
+        [&amp;] (MarkedAllocator&amp; allocator, size_t size, AllocatorAttributes) -&gt; IterationStatus {
+            if (!size) {
+                // This means it's a largeAllocator.
+                allocator.forEachBlock(
+                    [&amp;] (MarkedBlock* block) {
+                        block-&gt;clearNewlyAllocated();
+                    });
+                return IterationStatus::Continue;
+            }
+            
+            if (MarkedBlock* block = allocator.takeLastActiveBlock())
+                block-&gt;clearNewlyAllocated();
+            return IterationStatus::Continue;
+        });
</ins><span class="cx"> 
</span><del>-    for (size_t i = 0; i &lt; impreciseCount; ++i) {
-        clearNewlyAllocatedInBlock(m_normalSpace.impreciseAllocators[i].takeLastActiveBlock());
-        clearNewlyAllocatedInBlock(m_destructorSpace.impreciseAllocators[i].takeLastActiveBlock());
-    }
-
-    // We have to iterate all of the blocks in the large allocators because they are
-    // canonicalized as they are used up (see MarkedAllocator::tryAllocateHelper)
-    // which creates the m_newlyAllocated bitmap.
-    auto clearNewlyAllocated = [&amp;] (MarkedBlock* block) {
-        block-&gt;clearNewlyAllocated();
-    };
-    m_normalSpace.largeAllocator.forEachBlock(clearNewlyAllocated);
-    m_destructorSpace.largeAllocator.forEachBlock(clearNewlyAllocated);
-
</del><span class="cx"> #if !ASSERT_DISABLED
</span><span class="cx">     forEachBlock(
</span><span class="cx">         [&amp;] (MarkedBlock* block) {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreheapMarkedSpaceh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/heap/MarkedSpace.h (203620 => 203621)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/heap/MarkedSpace.h        2016-07-22 22:14:19 UTC (rev 203620)
+++ trunk/Source/JavaScriptCore/heap/MarkedSpace.h        2016-07-22 22:14:44 UTC (rev 203621)
</span><span class="lines">@@ -22,6 +22,7 @@
</span><span class="cx"> #ifndef MarkedSpace_h
</span><span class="cx"> #define MarkedSpace_h
</span><span class="cx"> 
</span><ins>+#include &quot;IterationStatus.h&quot;
</ins><span class="cx"> #include &quot;MarkedAllocator.h&quot;
</span><span class="cx"> #include &quot;MarkedBlock.h&quot;
</span><span class="cx"> #include &quot;MarkedBlockSet.h&quot;
</span><span class="lines">@@ -63,11 +64,14 @@
</span><span class="cx"> 
</span><span class="cx">     MarkedAllocator&amp; allocatorFor(size_t);
</span><span class="cx">     MarkedAllocator&amp; destructorAllocatorFor(size_t);
</span><ins>+    MarkedAllocator&amp; auxiliaryAllocatorFor(size_t);
</ins><span class="cx">     void* allocateWithDestructor(size_t);
</span><span class="cx">     void* allocateWithoutDestructor(size_t);
</span><ins>+    void* allocateAuxiliary(size_t);
</ins><span class="cx"> 
</span><span class="cx">     Subspace&amp; subspaceForObjectsWithDestructor() { return m_destructorSpace; }
</span><span class="cx">     Subspace&amp; subspaceForObjectsWithoutDestructor() { return m_normalSpace; }
</span><ins>+    Subspace&amp; subspaceForAuxiliaryData() { return m_auxiliarySpace; }
</ins><span class="cx"> 
</span><span class="cx">     void resetAllocators();
</span><span class="cx"> 
</span><span class="lines">@@ -114,9 +118,12 @@
</span><span class="cx">     friend class JIT;
</span><span class="cx"> 
</span><span class="cx">     template&lt;typename Functor&gt; void forEachAllocator(const Functor&amp;);
</span><ins>+    template&lt;typename Functor&gt; void forEachSubspace(const Functor&amp;);
+    MarkedAllocator&amp; allocatorFor(Subspace&amp;, size_t);
</ins><span class="cx"> 
</span><span class="cx">     Subspace m_destructorSpace;
</span><span class="cx">     Subspace m_normalSpace;
</span><ins>+    Subspace m_auxiliarySpace;
</ins><span class="cx"> 
</span><span class="cx">     Heap* m_heap;
</span><span class="cx">     size_t m_capacity;
</span><span class="lines">@@ -147,24 +154,19 @@
</span><span class="cx"> 
</span><span class="cx"> inline MarkedAllocator&amp; MarkedSpace::allocatorFor(size_t bytes)
</span><span class="cx"> {
</span><del>-    ASSERT(bytes);
-    if (bytes &lt;= preciseCutoff)
-        return m_normalSpace.preciseAllocators[(bytes - 1) / preciseStep];
-    if (bytes &lt;= impreciseCutoff)
-        return m_normalSpace.impreciseAllocators[(bytes - 1) / impreciseStep];
-    return m_normalSpace.largeAllocator;
</del><ins>+    return allocatorFor(m_normalSpace, bytes);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> inline MarkedAllocator&amp; MarkedSpace::destructorAllocatorFor(size_t bytes)
</span><span class="cx"> {
</span><del>-    ASSERT(bytes);
-    if (bytes &lt;= preciseCutoff)
-        return m_destructorSpace.preciseAllocators[(bytes - 1) / preciseStep];
-    if (bytes &lt;= impreciseCutoff)
-        return m_destructorSpace.impreciseAllocators[(bytes - 1) / impreciseStep];
-    return m_destructorSpace.largeAllocator;
</del><ins>+    return allocatorFor(m_destructorSpace, bytes);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+inline MarkedAllocator&amp; MarkedSpace::auxiliaryAllocatorFor(size_t bytes)
+{
+    return allocatorFor(m_auxiliarySpace, bytes);
+}
+
</ins><span class="cx"> inline void* MarkedSpace::allocateWithoutDestructor(size_t bytes)
</span><span class="cx"> {
</span><span class="cx">     return allocatorFor(bytes).allocate(bytes);
</span><span class="lines">@@ -175,19 +177,22 @@
</span><span class="cx">     return destructorAllocatorFor(bytes).allocate(bytes);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+inline void* MarkedSpace::allocateAuxiliary(size_t bytes)
+{
+    return auxiliaryAllocatorFor(bytes).allocate(bytes);
+}
+
</ins><span class="cx"> template &lt;typename Functor&gt; inline void MarkedSpace::forEachBlock(const Functor&amp; functor)
</span><span class="cx"> {
</span><del>-    for (size_t i = 0; i &lt; preciseCount; ++i)
-        m_normalSpace.preciseAllocators[i].forEachBlock(functor);
-    for (size_t i = 0; i &lt; impreciseCount; ++i)
-        m_normalSpace.impreciseAllocators[i].forEachBlock(functor);
-    m_normalSpace.largeAllocator.forEachBlock(functor);
-
-    for (size_t i = 0; i &lt; preciseCount; ++i)
-        m_destructorSpace.preciseAllocators[i].forEachBlock(functor);
-    for (size_t i = 0; i &lt; impreciseCount; ++i)
-        m_destructorSpace.impreciseAllocators[i].forEachBlock(functor);
-    m_destructorSpace.largeAllocator.forEachBlock(functor);
</del><ins>+    forEachSubspace(
+        [&amp;] (Subspace&amp; subspace, AllocatorAttributes) -&gt; IterationStatus {
+            for (size_t i = 0; i &lt; preciseCount; ++i)
+                subspace.preciseAllocators[i].forEachBlock(functor);
+            for (size_t i = 0; i &lt; impreciseCount; ++i)
+                subspace.impreciseAllocators[i].forEachBlock(functor);
+            subspace.largeAllocator.forEachBlock(functor);
+            return IterationStatus::Continue;
+        });
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> inline void MarkedSpace::didAddBlock(MarkedBlock* block)
</span><span class="lines">@@ -226,6 +231,36 @@
</span><span class="cx">     return m_capacity;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+template&lt;typename Functor&gt;
+inline void MarkedSpace::forEachSubspace(const Functor&amp; func)
+{
+    AllocatorAttributes attributes;
+    
+    attributes.destruction = NeedsDestruction;
+    attributes.cellKind = HeapCell::JSCell;
+    if (func(m_destructorSpace, attributes) == IterationStatus::Done)
+        return;
+    
+    attributes.destruction = DoesNotNeedDestruction;
+    attributes.cellKind = HeapCell::JSCell;
+    if (func(m_normalSpace, attributes) == IterationStatus::Done)
+        return;
+
+    attributes.destruction = DoesNotNeedDestruction;
+    attributes.cellKind = HeapCell::Auxiliary;
+    func(m_auxiliarySpace, attributes);
+}
+
+inline MarkedAllocator&amp; MarkedSpace::allocatorFor(Subspace&amp; space, size_t bytes)
+{
+    ASSERT(bytes);
+    if (bytes &lt;= preciseCutoff)
+        return space.preciseAllocators[(bytes - 1) / preciseStep];
+    if (bytes &lt;= impreciseCutoff)
+        return space.impreciseAllocators[(bytes - 1) / impreciseStep];
+    return space.largeAllocator;
+}
+
</ins><span class="cx"> } // namespace JSC
</span><span class="cx"> 
</span><span class="cx"> #endif // MarkedSpace_h
</span></span></pre>
</div>
</div>

</body>
</html>