<!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>[195141] trunk/Source</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/195141">195141</a></dd>
<dt>Author</dt> <dd>akling@apple.com</dd>
<dt>Date</dt> <dd>2016-01-15 12:01:42 -0800 (Fri, 15 Jan 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Source/WebCore:
Use BumpArena for style sheet object tree.
&lt;https://webkit.org/b/152696&gt;

Reviewed by Antti Koivisto.

Give each StyleSheetContents its own BumpArena, and plumb it down through CSSParser
to allocate StyleRule, StyleProperties and CSSSelectorList's selector arrays there.

This basically means that most objects that make up a given style sheet will end up
in one (or a few) contiguous region(s) of memory, instead of being scattered all
over the malloc heap.

In the common case (no CSSOM manipulation), the lifetimes of these objects are very
predictable: everything tends to die when the StyleSheetContents dies.
This dramatically improves space-efficiency in those cases, and allows us to return
contiguous chunks of memory to the system once a style sheet is no longer needed.

One-off CSS parses that don't work within a StyleSheetContents context will have
their StyleRules &amp; co allocated through FastMalloc just like before.

Bonus: give SelectorQueryCache a dedicated BumpArena as well, since it has very
predictable lifetime.

* css/CSSGrammar.y.in:
* css/CSSKeyframesRule.h:
(WebCore::StyleRuleKeyframes::create):
* css/CSSParser.cpp:
(WebCore::CSSParser::createStyleProperties):
(WebCore::CSSParser::createMediaRule):
(WebCore::CSSParser::createSupportsRule):
(WebCore::CSSParser::createKeyframesRule):
(WebCore::CSSParser::setArena):
(WebCore::CSSParser::arena):
(WebCore::CSSParser::createStyleRule):
(WebCore::CSSParser::createFontFaceRule):
(WebCore::CSSParser::createPageRule):
(WebCore::CSSParser::createRegionRule):
(WebCore::CSSParser::createViewportRule):
* css/CSSParser.h:
* css/CSSParserValues.cpp:
(WebCore::CSSParserSelector::parsePseudoElementCueFunctionSelector):
(WebCore::CSSParserSelector::adoptSelectorVector):
* css/CSSParserValues.h:
* css/CSSSelectorList.cpp:
(WebCore::CSSSelectorList::CSSSelectorList):
(WebCore::CSSSelectorList::adoptSelectorVector):
(WebCore::CSSSelectorList::deleteSelectors):
* css/CSSSelectorList.h:
* css/StyleProperties.cpp:
(WebCore::ImmutableStyleProperties::create):
(WebCore::StyleProperties::immutableCopyIfNeeded):
* css/StyleProperties.h:
* css/StyleRule.cpp:
(WebCore::StyleRule::create):
(WebCore::StyleRule::splitIntoMultipleRulesWithMaximumSelectorComponentCount):
(WebCore::StyleRuleRegion::StyleRuleRegion):
* css/StyleRule.h:
(WebCore::StyleRule::create):
(WebCore::StyleRule::parserAdoptSelectorVector):
(WebCore::StyleRuleFontFace::create):
(WebCore::StyleRulePage::create):
(WebCore::StyleRulePage::parserAdoptSelectorVector):
(WebCore::StyleRuleMedia::create):
(WebCore::StyleRuleSupports::create):
(WebCore::StyleRuleRegion::create):
(WebCore::StyleRuleViewport::create):
* css/StyleSheetContents.cpp:
(WebCore::StyleSheetContents::StyleSheetContents):
(WebCore::StyleSheetContents::parseAuthorStyleSheet):
(WebCore::StyleSheetContents::parseStringAtPosition):
* css/StyleSheetContents.h:
* dom/SelectorQuery.cpp:
(WebCore::SelectorQueryCache::SelectorQueryCache):
(WebCore::SelectorQueryCache::add):
* dom/SelectorQuery.h:
* svg/SVGFontFaceElement.cpp:
(WebCore::SVGFontFaceElement::SVGFontFaceElement):

Source/WTF:
Fragmentation-free allocator for timeless and/or coupled allocations.
&lt;https://webkit.org/b/152696&gt;

Reviewed by Antti Koivisto.

Introduce BumpArena, a space-efficient memory allocator for situations where
you feel pretty confident betting on allocation lifetimes.

Basic design:

    - Reserves 128MB range of memory at startup.
    - Allocates 4kB-aligned blocks of 4kB from VM at a time.
    - Bump-pointer allocates out of a block until it reaches end.
    - Each allocation increments the ref-count of its block.
    - Each deallocation decrements the ref-count of its block.
    - Transparently falls back to fastMalloc()/fastFree() when needed.

Interface:

    - BumpArena::create()

        Create your very own BumpArena!

    - BumpArena::allocate(BumpArena* arena, size_t size)

        Allocates 'size' bytes of memory from 'arena'.
        If 'arena' is null, falls back to fastMalloc().

    - BumpArena::deallocate(void* ptr)

        If 'ptr' is BumpArena allocation, decrements block ref-count.
        If 'ptr' is FastMalloc allocation, calls fastFree() on it.

    - WTF_MAKE_BUMPARENA_ALLOCATED;

        Macro that gives a class or struct custom operators new and delete
        for allocation out of BumpArena. Just like WTF_MAKE_FAST_ALLOCATED;

Note that while the name of this patch says &quot;fragmentation-free allocator&quot;
it will only be fragmentation-free when used for appropriate things.
This is not meant to be a general-purpose allocator. Only use it for sets of
allocations that are known to die roughly at the same time.

BumpArena will never resume allocating from a block that has been filled,
so it's even more important than usual that everything gets deallocated.

BumpArena redirects allocations to FastMalloc in three cases:

    - When invoked with a null BumpArena*
    - When allocation request is larger than BumpArena's block size (4kB)
    - When BumpArena has exhausted all of its pre-reserved VM. (128MB)

The VM allocator will eagerly return blocks of VM to the kernel by calling
madvise(). Average time spent in madvise is around 0.007ms on my box.

* WTF.vcxproj/WTF.vcxproj:
* WTF.vcxproj/WTF.vcxproj.filters:
* WTF.xcodeproj/project.pbxproj:
* wtf/BumpArena.cpp: Added.
(WTF::BumpArena::Block::capacity):
(WTF::BumpArena::Block::arena):
(WTF::BumpArena::Block::payloadStart):
(WTF::arenas):
(WTF::BumpArena::Block::Block):
(WTF::BumpArena::Block::~Block):
(WTF::BumpArena::Block::ref):
(WTF::BlockAllocator::BlockAllocator):
(WTF::BlockAllocator::isAllocation):
(WTF::blockAllocator):
(WTF::BlockAllocator::allocateBlock):
(WTF::BlockAllocator::deallocateBlock):
(WTF::BumpArena::Block::deref):
(WTF::BumpArena::Block::create):
(WTF::BumpArena::Block::dump):
(WTF::BumpArena::dump):
(WTF::BumpArena::create):
(WTF::BumpArena::BumpArena):
(WTF::BumpArena::~BumpArena):
(WTF::BumpArena::allocateSlow):
(WTF::BumpArena::allocate):
(WTF::BumpArena::deallocate):
(WTF::BumpArena::Block::blockFor):
(WTF::BumpArena::arenaFor):
* wtf/BumpArena.h: Added.
* wtf/CMakeLists.txt:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFWTFvcxprojWTFvcxproj">trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj</a></li>
<li><a href="#trunkSourceWTFWTFvcxprojWTFvcxprojfilters">trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj.filters</a></li>
<li><a href="#trunkSourceWTFWTFxcodeprojprojectpbxproj">trunk/Source/WTF/WTF.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWTFwtfCMakeListstxt">trunk/Source/WTF/wtf/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecssCSSGrammaryin">trunk/Source/WebCore/css/CSSGrammar.y.in</a></li>
<li><a href="#trunkSourceWebCorecssCSSKeyframesRuleh">trunk/Source/WebCore/css/CSSKeyframesRule.h</a></li>
<li><a href="#trunkSourceWebCorecssCSSParsercpp">trunk/Source/WebCore/css/CSSParser.cpp</a></li>
<li><a href="#trunkSourceWebCorecssCSSParserh">trunk/Source/WebCore/css/CSSParser.h</a></li>
<li><a href="#trunkSourceWebCorecssCSSParserValuescpp">trunk/Source/WebCore/css/CSSParserValues.cpp</a></li>
<li><a href="#trunkSourceWebCorecssCSSParserValuesh">trunk/Source/WebCore/css/CSSParserValues.h</a></li>
<li><a href="#trunkSourceWebCorecssCSSSelectorListcpp">trunk/Source/WebCore/css/CSSSelectorList.cpp</a></li>
<li><a href="#trunkSourceWebCorecssCSSSelectorListh">trunk/Source/WebCore/css/CSSSelectorList.h</a></li>
<li><a href="#trunkSourceWebCorecssStylePropertiescpp">trunk/Source/WebCore/css/StyleProperties.cpp</a></li>
<li><a href="#trunkSourceWebCorecssStylePropertiesh">trunk/Source/WebCore/css/StyleProperties.h</a></li>
<li><a href="#trunkSourceWebCorecssStyleRulecpp">trunk/Source/WebCore/css/StyleRule.cpp</a></li>
<li><a href="#trunkSourceWebCorecssStyleRuleh">trunk/Source/WebCore/css/StyleRule.h</a></li>
<li><a href="#trunkSourceWebCorecssStyleSheetContentscpp">trunk/Source/WebCore/css/StyleSheetContents.cpp</a></li>
<li><a href="#trunkSourceWebCorecssStyleSheetContentsh">trunk/Source/WebCore/css/StyleSheetContents.h</a></li>
<li><a href="#trunkSourceWebCoredomSelectorQuerycpp">trunk/Source/WebCore/dom/SelectorQuery.cpp</a></li>
<li><a href="#trunkSourceWebCoredomSelectorQueryh">trunk/Source/WebCore/dom/SelectorQuery.h</a></li>
<li><a href="#trunkSourceWebCoresvgSVGFontFaceElementcpp">trunk/Source/WebCore/svg/SVGFontFaceElement.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWTFwtfBumpArenacpp">trunk/Source/WTF/wtf/BumpArena.cpp</a></li>
<li><a href="#trunkSourceWTFwtfBumpArenah">trunk/Source/WTF/wtf/BumpArena.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (195140 => 195141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog        2016-01-15 19:55:19 UTC (rev 195140)
+++ trunk/Source/WTF/ChangeLog        2016-01-15 20:01:42 UTC (rev 195141)
</span><span class="lines">@@ -1,3 +1,91 @@
</span><ins>+2016-01-15  Andreas Kling  &lt;akling@apple.com&gt;
+
+        Fragmentation-free allocator for timeless and/or coupled allocations.
+        &lt;https://webkit.org/b/152696&gt;
+
+        Reviewed by Antti Koivisto.
+
+        Introduce BumpArena, a space-efficient memory allocator for situations where
+        you feel pretty confident betting on allocation lifetimes.
+
+        Basic design:
+
+            - Reserves 128MB range of memory at startup.
+            - Allocates 4kB-aligned blocks of 4kB from VM at a time.
+            - Bump-pointer allocates out of a block until it reaches end.
+            - Each allocation increments the ref-count of its block.
+            - Each deallocation decrements the ref-count of its block.
+            - Transparently falls back to fastMalloc()/fastFree() when needed.
+
+        Interface:
+
+            - BumpArena::create()
+
+                Create your very own BumpArena!
+
+            - BumpArena::allocate(BumpArena* arena, size_t size)
+
+                Allocates 'size' bytes of memory from 'arena'.
+                If 'arena' is null, falls back to fastMalloc().
+
+            - BumpArena::deallocate(void* ptr)
+
+                If 'ptr' is BumpArena allocation, decrements block ref-count.
+                If 'ptr' is FastMalloc allocation, calls fastFree() on it.
+
+            - WTF_MAKE_BUMPARENA_ALLOCATED;
+
+                Macro that gives a class or struct custom operators new and delete
+                for allocation out of BumpArena. Just like WTF_MAKE_FAST_ALLOCATED;
+
+        Note that while the name of this patch says &quot;fragmentation-free allocator&quot;
+        it will only be fragmentation-free when used for appropriate things.
+        This is not meant to be a general-purpose allocator. Only use it for sets of
+        allocations that are known to die roughly at the same time.
+
+        BumpArena will never resume allocating from a block that has been filled,
+        so it's even more important than usual that everything gets deallocated.
+
+        BumpArena redirects allocations to FastMalloc in three cases:
+
+            - When invoked with a null BumpArena*
+            - When allocation request is larger than BumpArena's block size (4kB)
+            - When BumpArena has exhausted all of its pre-reserved VM. (128MB)
+
+        The VM allocator will eagerly return blocks of VM to the kernel by calling
+        madvise(). Average time spent in madvise is around 0.007ms on my box.
+
+        * WTF.vcxproj/WTF.vcxproj:
+        * WTF.vcxproj/WTF.vcxproj.filters:
+        * WTF.xcodeproj/project.pbxproj:
+        * wtf/BumpArena.cpp: Added.
+        (WTF::BumpArena::Block::capacity):
+        (WTF::BumpArena::Block::arena):
+        (WTF::BumpArena::Block::payloadStart):
+        (WTF::arenas):
+        (WTF::BumpArena::Block::Block):
+        (WTF::BumpArena::Block::~Block):
+        (WTF::BumpArena::Block::ref):
+        (WTF::BlockAllocator::BlockAllocator):
+        (WTF::BlockAllocator::isAllocation):
+        (WTF::blockAllocator):
+        (WTF::BlockAllocator::allocateBlock):
+        (WTF::BlockAllocator::deallocateBlock):
+        (WTF::BumpArena::Block::deref):
+        (WTF::BumpArena::Block::create):
+        (WTF::BumpArena::Block::dump):
+        (WTF::BumpArena::dump):
+        (WTF::BumpArena::create):
+        (WTF::BumpArena::BumpArena):
+        (WTF::BumpArena::~BumpArena):
+        (WTF::BumpArena::allocateSlow):
+        (WTF::BumpArena::allocate):
+        (WTF::BumpArena::deallocate):
+        (WTF::BumpArena::Block::blockFor):
+        (WTF::BumpArena::arenaFor):
+        * wtf/BumpArena.h: Added.
+        * wtf/CMakeLists.txt:
+
</ins><span class="cx"> 2016-01-15  Konstantin Tokarev  &lt;annulen@yandex.ru&gt;
</span><span class="cx"> 
</span><span class="cx">         [EFL] WorkQueue methods should be defined inside WTF namespace.
</span></span></pre></div>
<a id="trunkSourceWTFWTFvcxprojWTFvcxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj (195140 => 195141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj        2016-01-15 19:55:19 UTC (rev 195140)
+++ trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj        2016-01-15 20:01:42 UTC (rev 195141)
</span><span class="lines">@@ -53,6 +53,7 @@
</span><span class="cx">   &lt;ItemGroup&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\wtf\Assertions.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\wtf\BitVector.cpp&quot; /&gt;
</span><ins>+    &lt;ClCompile Include=&quot;..\wtf\BumpArena.cpp&quot; /&gt;
</ins><span class="cx">     &lt;ClCompile Include=&quot;..\wtf\CompilationThread.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\wtf\CryptographicUtilities.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\wtf\CryptographicallyRandomNumber.cpp&quot; /&gt;
</span></span></pre></div>
<a id="trunkSourceWTFWTFvcxprojWTFvcxprojfilters"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj.filters (195140 => 195141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj.filters        2016-01-15 19:55:19 UTC (rev 195140)
+++ trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj.filters        2016-01-15 20:01:42 UTC (rev 195141)
</span><span class="lines">@@ -120,6 +120,9 @@
</span><span class="cx">     &lt;ClCompile Include=&quot;..\wtf\BitVector.cpp&quot;&gt;
</span><span class="cx">       &lt;Filter&gt;wtf&lt;/Filter&gt;
</span><span class="cx">     &lt;/ClCompile&gt;
</span><ins>+    &lt;ClCompile Include=&quot;..\wtf\BumpArena.cpp&quot;&gt;
+      &lt;Filter&gt;wtf&lt;/Filter&gt;
+    &lt;/ClCompile&gt;
</ins><span class="cx">     &lt;ClCompile Include=&quot;..\wtf\CryptographicUtilities.cpp&quot;&gt;
</span><span class="cx">       &lt;Filter&gt;wtf&lt;/Filter&gt;
</span><span class="cx">     &lt;/ClCompile&gt;
</span></span></pre></div>
<a id="trunkSourceWTFWTFxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/WTF.xcodeproj/project.pbxproj (195140 => 195141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/WTF.xcodeproj/project.pbxproj        2016-01-15 19:55:19 UTC (rev 195140)
+++ trunk/Source/WTF/WTF.xcodeproj/project.pbxproj        2016-01-15 20:01:42 UTC (rev 195141)
</span><span class="lines">@@ -287,6 +287,8 @@
</span><span class="cx">                 A8A47486151A825B004123FF /* WTFThreadData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A4737A151A825B004123FF /* WTFThreadData.cpp */; };
</span><span class="cx">                 A8A47487151A825B004123FF /* WTFThreadData.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4737B151A825B004123FF /* WTFThreadData.h */; };
</span><span class="cx">                 A8A4748C151A8264004123FF /* config.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4748B151A8264004123FF /* config.h */; };
</span><ins>+                AD9C50C11C3C1D5D005FBF1E /* BumpArena.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD9C50BF1C3C1D5D005FBF1E /* BumpArena.cpp */; };
+                AD9C50C21C3C1D5D005FBF1E /* BumpArena.h in Headers */ = {isa = PBXBuildFile; fileRef = AD9C50C01C3C1D5D005FBF1E /* BumpArena.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 B38FD7BD168953E80065C969 /* FeatureDefines.h in Headers */ = {isa = PBXBuildFile; fileRef = B38FD7BC168953E80065C969 /* FeatureDefines.h */; };
</span><span class="cx">                 C4F8A93719C65EB400B2B15D /* Stopwatch.h in Headers */ = {isa = PBXBuildFile; fileRef = C4F8A93619C65EB400B2B15D /* Stopwatch.h */; };
</span><span class="cx">                 CD5497AC15857D0300B5BC30 /* MediaTime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD5497AA15857D0300B5BC30 /* MediaTime.cpp */; };
</span><span class="lines">@@ -600,6 +602,8 @@
</span><span class="cx">                 A8A4737A151A825B004123FF /* WTFThreadData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WTFThreadData.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 A8A4737B151A825B004123FF /* WTFThreadData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WTFThreadData.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 A8A4748B151A8264004123FF /* config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                AD9C50BF1C3C1D5D005FBF1E /* BumpArena.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BumpArena.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                AD9C50C01C3C1D5D005FBF1E /* BumpArena.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BumpArena.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 B38FD7BC168953E80065C969 /* FeatureDefines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FeatureDefines.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 C4F8A93619C65EB400B2B15D /* Stopwatch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Stopwatch.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 CD5497AA15857D0300B5BC30 /* MediaTime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaTime.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -757,6 +761,8 @@
</span><span class="cx">                                 A8A47265151A825A004123FF /* BloomFilter.h */,
</span><span class="cx">                                 0F93274A1C17F4B700CF6564 /* Box.h */,
</span><span class="cx">                                 0F4570441BE834410062A629 /* BubbleSort.h */,
</span><ins>+                                AD9C50BF1C3C1D5D005FBF1E /* BumpArena.cpp */,
+                                AD9C50C01C3C1D5D005FBF1E /* BumpArena.h */,
</ins><span class="cx">                                 A8A47267151A825A004123FF /* BumpPointerAllocator.h */,
</span><span class="cx">                                 EB95E1EF161A72410089A2F5 /* ByteOrder.h */,
</span><span class="cx">                                 A8A4726A151A825A004123FF /* CheckedArithmetic.h */,
</span><span class="lines">@@ -1261,6 +1267,7 @@
</span><span class="cx">                                 A8A4742C151A825B004123FF /* StringExtras.h in Headers */,
</span><span class="cx">                                 A8A4743F151A825B004123FF /* StringHash.h in Headers */,
</span><span class="cx">                                 A748745417A0BDAE00FA04CB /* StringHashDumpContext.h in Headers */,
</span><ins>+                                AD9C50C21C3C1D5D005FBF1E /* BumpArena.h in Headers */,
</ins><span class="cx">                                 A8A47441151A825B004123FF /* StringImpl.h in Headers */,
</span><span class="cx">                                 A8A47442151A825B004123FF /* StringOperators.h in Headers */,
</span><span class="cx">                                 0FDDBFA81666DFA300C55FEF /* StringPrintStream.h in Headers */,
</span><span class="lines">@@ -1404,6 +1411,7 @@
</span><span class="cx">                                 A5BA15FA182435A600A82E69 /* AtomicStringImplCF.cpp in Sources */,
</span><span class="cx">                                 9BC70F05176C379D00101DEC /* AtomicStringTable.cpp in Sources */,
</span><span class="cx">                                 1469419D16EAB10A0024E146 /* AutodrainedPoolMac.mm in Sources */,
</span><ins>+                                AD9C50C11C3C1D5D005FBF1E /* BumpArena.cpp in Sources */,
</ins><span class="cx">                                 8134013815B092FD001FF0B8 /* Base64.cpp in Sources */,
</span><span class="cx">                                 A8A473A8151A825B004123FF /* bignum-dtoa.cc in Sources */,
</span><span class="cx">                                 A8A473AA151A825B004123FF /* bignum.cc in Sources */,
</span></span></pre></div>
<a id="trunkSourceWTFwtfBumpArenacpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WTF/wtf/BumpArena.cpp (0 => 195141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/BumpArena.cpp                                (rev 0)
+++ trunk/Source/WTF/wtf/BumpArena.cpp        2016-01-15 20:01:42 UTC (rev 195141)
</span><span class="lines">@@ -0,0 +1,368 @@
</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;BumpArena.h&quot;
+
+#include &lt;wtf/HashSet.h&gt;
+#include &lt;wtf/NeverDestroyed.h&gt;
+#include &lt;wtf/Vector.h&gt;
+
+#if OS(UNIX)
+#define USE_BUMPARENA 1
+#include &lt;sys/mman.h&gt;
+#else
+#define USE_BUMPARENA 0
+#endif
+
+#if OS(DARWIN)
+#include &lt;mach/vm_statistics.h&gt;
+// FIXME: Figure out which VM tag to use.
+#define BUMPARENA_VM_TAG VM_MAKE_TAG(VM_MEMORY_APPLICATION_SPECIFIC_1)
+#else
+#define BUMPARENA_VM_TAG -1
+#endif
+
+#if DEBUG_BUMPARENA
+#include &lt;notify.h&gt;
+#endif
+
+namespace WTF {
+
+#if USE(BUMPARENA)
+
+static const size_t blockSize = 4096;
+static const size_t blockMask = ~(blockSize - 1);
+
+class BumpArena::Block {
+public:
+    static constexpr size_t capacity() { return blockSize - sizeof(Block); }
+
+    static RefPtr&lt;Block&gt; create(BumpArena&amp;);
+    ~Block();
+
+    void ref();
+    void deref();
+
+    BumpArena&amp; arena() { return m_arena.get(); }
+
+    static Block&amp; blockFor(const void*);
+
+    char* payloadStart() { return reinterpret_cast&lt;char*&gt;(&amp;m_data); }
+
+#if DEBUG_BUMPARENA
+    void dump();
+#endif
+
+private:
+    friend class BumpArena;
+    explicit Block(BumpArena&amp;);
+
+    Ref&lt;BumpArena&gt; m_arena;
+
+    unsigned m_refCount { 1 };
+
+#if DEBUG_BUMPARENA
+    size_t m_bytesAvailable { 0 };
+#endif
+
+#if COMPILER(MSVC)
+#pragma warning(push)
+#pragma warning(disable: 4200) // Disable &quot;zero-sized array in struct/union&quot; warning
+#endif
+    char* m_data[0];
+#if COMPILER(MSVC)
+#pragma warning(pop)
+#endif
+};
+
+#if DEBUG_BUMPARENA
+static HashSet&lt;BumpArena*&gt;&amp; arenas()
+{
+    static NeverDestroyed&lt;HashSet&lt;BumpArena*&gt;&gt; set;
+    return set;
+}
+#endif
+
+BumpArena::Block::Block(BumpArena&amp; arena)
+    : m_arena(arena)
+{
+#if DEBUG_BUMPARENA
+    m_arena-&gt;m_liveBlocks.add(this);
+#endif
+}
+
+BumpArena::Block::~Block()
+{
+#if DEBUG_BUMPARENA
+    m_arena-&gt;m_liveBlocks.remove(this);
+#endif
+}
+
+void BumpArena::Block::ref()
+{
+    ++m_refCount;
+}
+
+struct BlockAllocator {
+    static const size_t vmSize = 128 * MB;
+
+    BlockAllocator();
+
+    void* allocateBlock();
+    void deallocateBlock(void*);
+
+    bool isAllocation(const void* p) const;
+
+    char* vmBase;
+    char* vmEnd;
+    char* nextBlock;
+    Vector&lt;void*&gt; freeList;
+};
+
+BlockAllocator::BlockAllocator()
+{
+    vmBase = reinterpret_cast&lt;char*&gt;(mmap(0, vmSize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, BUMPARENA_VM_TAG, 0));
+    RELEASE_ASSERT(vmBase != MAP_FAILED);
+    vmEnd = vmBase + vmSize;
+    nextBlock = reinterpret_cast&lt;char*&gt;(roundUpToMultipleOf&lt;blockSize&gt;(reinterpret_cast&lt;uintptr_t&gt;(vmBase)));
+}
+
+bool BlockAllocator::isAllocation(const void* p) const
+{
+    return p &gt;= vmBase &amp;&amp; p &lt;= vmEnd;
+}
+
+static BlockAllocator&amp; blockAllocator()
+{
+    static NeverDestroyed&lt;BlockAllocator&gt; allocator;
+    return allocator;
+}
+
+void* BlockAllocator::allocateBlock()
+{
+    if (!freeList.isEmpty()) {
+        void* block = freeList.takeLast();
+#if OS(DARWIN)
+        while (madvise(block, blockSize, MADV_FREE_REUSE) == -1 &amp;&amp; errno == EAGAIN) { }
+#else
+        while (madvise(block, blockSize, MADV_NORMAL) == -1 &amp;&amp; errno == EAGAIN) { }
+#endif
+        return block;
+    }
+    char* newNextBlock = nextBlock + blockSize;
+    if (newNextBlock &gt;= vmEnd)
+        return nullptr;
+    void* block = nextBlock;
+    nextBlock += blockSize;
+    return block;
+}
+
+void BlockAllocator::deallocateBlock(void* block)
+{
+#if OS(DARWIN)
+    while (madvise(block, blockSize, MADV_FREE_REUSABLE) == -1 &amp;&amp; errno == EAGAIN) { }
+#else
+    while (madvise(block, blockSize, MADV_DONTNEED) == -1 &amp;&amp; errno == EAGAIN) { }
+#endif
+    freeList.append(block);
+}
+
+void BumpArena::Block::deref()
+{
+    --m_refCount;
+
+    if (!m_refCount) {
+        this-&gt;~Block();
+        blockAllocator().deallocateBlock(this);
+    } else if (m_refCount == 1 &amp;&amp; m_arena-&gt;m_currentBlock == this) {
+        m_arena-&gt;m_currentPayloadEnd = nullptr;
+        m_arena-&gt;m_currentRemaining = 0;
+        // Break the ref-cycle between BumpArena and this Block.
+        m_arena-&gt;m_currentBlock = nullptr;
+    }
+}
+
+RefPtr&lt;BumpArena::Block&gt; BumpArena::Block::create(BumpArena&amp; arena)
+{
+    void* allocation = blockAllocator().allocateBlock();
+    if (!allocation)
+        return nullptr;
+    return adoptRef(*new (NotNull, allocation) Block(arena));
+}
+
+#if DEBUG_BUMPARENA
+void BumpArena::Block::dump()
+{
+    WTFLogAlways(&quot;  %10s %p - %3u, %8lu bytes available\n&quot;, m_arena-&gt;m_currentBlock == this ? &quot;[current]&quot; : &quot;&quot;, this, m_refCount, m_bytesAvailable);
+}
+
+void BumpArena::dump()
+{
+    WTFLogAlways(&quot;BumpArena{%p}&quot;, this);
+    WTFLogAlways(&quot;  refCount: %u\n&quot;, refCount());
+    WTFLogAlways(&quot;  Blocks (%d)\n&quot;, m_liveBlocks.size());
+    for (Block* block : m_liveBlocks) {
+        if (block == m_currentBlock)
+            continue;
+        block-&gt;dump();
+    }
+    if (m_currentBlock)
+        m_currentBlock-&gt;dump();
+}
+#endif
+
+Ref&lt;BumpArena&gt; BumpArena::create()
+{
+    return adoptRef(*new BumpArena);
+}
+
+BumpArena::BumpArena()
+{
+#if DEBUG_BUMPARENA
+    arenas().add(this);
+    static std::once_flag once;
+    std::call_once(once, [] {
+        int d;
+        notify_register_dispatch(&quot;com.apple.WebKit.BumpArena.Dump&quot;, &amp;d, dispatch_get_main_queue(), ^(int) {
+            for (BumpArena* arena : arenas())
+                arena-&gt;dump();
+        });
+    });
+#endif
+}
+
+BumpArena::~BumpArena()
+{
+#if DEBUG_BUMPARENA
+    arenas().remove(this);
+#endif
+}
+
+void* BumpArena::allocateSlow(size_t size)
+{
+    if (size &gt; Block::capacity())
+        return fastMalloc(size);
+
+    m_currentBlock = Block::create(*this);
+    if (!m_currentBlock) {
+        m_currentPayloadEnd = nullptr;
+        m_currentRemaining = 0;
+        return fastMalloc(size);
+    }
+
+    m_currentPayloadEnd = m_currentBlock-&gt;payloadStart() + Block::capacity();
+    m_currentRemaining = Block::capacity() - size;
+#if DEBUG_BUMPARENA
+    m_currentBlock-&gt;m_bytesAvailable = m_currentRemaining;
+#endif
+    m_currentBlock-&gt;ref();
+    return m_currentPayloadEnd - m_currentRemaining - size;
+}
+
+void* BumpArena::allocate(size_t size)
+{
+    size = roundUpToMultipleOf&lt;8&gt;(size);
+    size_t currentRemaining = m_currentRemaining;
+    if (size &gt; currentRemaining)
+        return allocateSlow(size);
+    currentRemaining -= size;
+    m_currentRemaining = currentRemaining;
+#if DEBUG_BUMPARENA
+    m_currentBlock-&gt;m_bytesAvailable = m_currentRemaining;
+#endif
+    m_currentBlock-&gt;ref();
+    return m_currentPayloadEnd - currentRemaining - size;
+}
+
+void BumpArena::deallocate(void* p)
+{
+    if (!p)
+        return;
+    if (blockAllocator().isAllocation(p))
+        Block::blockFor(p).deref();
+    else
+        fastFree(p);
+}
+
+BumpArena::Block&amp; BumpArena::Block::blockFor(const void* p)
+{
+    return *reinterpret_cast&lt;Block*&gt;(reinterpret_cast&lt;uintptr_t&gt;(p) &amp; blockMask);
+}
+
+BumpArena* BumpArena::arenaFor(const void* p)
+{
+    ASSERT(p);
+    if (!blockAllocator().isAllocation(p))
+        return nullptr;
+    return &amp;Block::blockFor(p).arena();
+}
+
+void* BumpArena::allocate(BumpArena* arena, size_t size)
+{
+    if (arena)
+        return arena-&gt;allocate(size);
+    return fastMalloc(size);
+}
+
+#else // !USE(BUMPARENA) below
+
+class BumpArena::Block {
+public:
+    void ref() { }
+    void deref() { }
+};
+
+Ref&lt;BumpArena&gt; BumpArena::create()
+{
+    return adoptRef(*new BumpArena);
+}
+
+BumpArena::BumpArena()
+{
+}
+
+BumpArena::~BumpArena()
+{
+}
+
+BumpArena* BumpArena::arenaFor(const void*)
+{
+    return nullptr;
+}
+
+void* BumpArena::allocate(BumpArena*, size_t size)
+{
+    return fastMalloc(size);
+}
+
+void BumpArena::deallocate(void* p)
+{
+    fastFree(p);
+}
+
+#endif
+
+} // namespace WTF
</ins></span></pre></div>
<a id="trunkSourceWTFwtfBumpArenah"></a>
<div class="addfile"><h4>Added: trunk/Source/WTF/wtf/BumpArena.h (0 => 195141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/BumpArena.h                                (rev 0)
+++ trunk/Source/WTF/wtf/BumpArena.h        2016-01-15 20:01:42 UTC (rev 195141)
</span><span class="lines">@@ -0,0 +1,104 @@
</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.
+ */
+
+#ifndef BumpArena_h
+#define BumpArena_h
+
+#include &lt;wtf/HashSet.h&gt;
+#include &lt;wtf/RefCounted.h&gt;
+#include &lt;wtf/RefPtr.h&gt;
+
+#define DEBUG_BUMPARENA 0
+
+namespace WTF {
+
+class BumpArena : public RefCounted&lt;BumpArena&gt; {
+public:
+    WTF_EXPORT_PRIVATE static Ref&lt;BumpArena&gt; create();
+    WTF_EXPORT_PRIVATE ~BumpArena();
+
+    WTF_EXPORT_PRIVATE static void* allocate(BumpArena*, size_t);
+    WTF_EXPORT_PRIVATE static void deallocate(void*);
+
+    WTF_EXPORT_PRIVATE static BumpArena* arenaFor(const void*);
+
+private:
+    BumpArena();
+    void* allocate(size_t);
+    void* allocateSlow(size_t);
+
+    class Block;
+    friend class Block;
+    RefPtr&lt;Block&gt; m_currentBlock;
+
+    char* m_currentPayloadEnd { nullptr };
+    size_t m_currentRemaining { 0 };
+
+#if DEBUG_BUMPARENA
+    void dump();
+    HashSet&lt;Block*&gt; m_liveBlocks;
+#endif
+};
+
+#define WTF_MAKE_BUMPARENA_ALLOCATED \
+public: \
+    void* operator new(size_t, void* p) { return p; } \
+    void* operator new[](size_t, void* p) { return p; } \
+    \
+    void* operator new(size_t size) \
+    { \
+        return ::WTF::BumpArena::allocate(nullptr, size); \
+    } \
+    void* operator new(size_t size, BumpArena* arena) \
+    { \
+        return ::WTF::BumpArena::allocate(arena, size); \
+    } \
+    void operator delete(void* p) \
+    { \
+        ::WTF::BumpArena::deallocate(p); \
+    } \
+    \
+    void* operator new[](size_t size) \
+    { \
+        return ::WTF::BumpArena::allocate(nullptr, size); \
+    } \
+    \
+    void operator delete[](void* p) \
+    { \
+        ::WTF::BumpArena::deallocate(p); \
+    } \
+    void* operator new(size_t, NotNullTag, void* location) \
+    { \
+        ASSERT(location); \
+        return location; \
+    } \
+private: \
+typedef int __thisIsHereToForceASemicolonAfterThisMacro
+
+} // namespace WTF
+
+using WTF::BumpArena;
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWTFwtfCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/CMakeLists.txt (195140 => 195141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/CMakeLists.txt        2016-01-15 19:55:19 UTC (rev 195140)
+++ trunk/Source/WTF/wtf/CMakeLists.txt        2016-01-15 20:01:42 UTC (rev 195141)
</span><span class="lines">@@ -7,6 +7,7 @@
</span><span class="cx">     BitVector.h
</span><span class="cx">     Bitmap.h
</span><span class="cx">     BubbleSort.h
</span><ins>+    BumpArena.h
</ins><span class="cx">     BumpPointerAllocator.h
</span><span class="cx">     ByteOrder.h
</span><span class="cx">     CompilationThread.h
</span><span class="lines">@@ -153,6 +154,7 @@
</span><span class="cx">     Assertions.cpp
</span><span class="cx">     Atomics.cpp
</span><span class="cx">     BitVector.cpp
</span><ins>+    BumpArena.cpp
</ins><span class="cx">     CompilationThread.cpp
</span><span class="cx">     CryptographicUtilities.cpp
</span><span class="cx">     CryptographicallyRandomNumber.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (195140 => 195141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-01-15 19:55:19 UTC (rev 195140)
+++ trunk/Source/WebCore/ChangeLog        2016-01-15 20:01:42 UTC (rev 195141)
</span><span class="lines">@@ -1,3 +1,83 @@
</span><ins>+2016-01-15  Andreas Kling  &lt;akling@apple.com&gt;
+
+        Use BumpArena for style sheet object tree.
+        &lt;https://webkit.org/b/152696&gt;
+
+        Reviewed by Antti Koivisto.
+
+        Give each StyleSheetContents its own BumpArena, and plumb it down through CSSParser
+        to allocate StyleRule, StyleProperties and CSSSelectorList's selector arrays there.
+
+        This basically means that most objects that make up a given style sheet will end up
+        in one (or a few) contiguous region(s) of memory, instead of being scattered all
+        over the malloc heap.
+
+        In the common case (no CSSOM manipulation), the lifetimes of these objects are very
+        predictable: everything tends to die when the StyleSheetContents dies.
+        This dramatically improves space-efficiency in those cases, and allows us to return
+        contiguous chunks of memory to the system once a style sheet is no longer needed.
+
+        One-off CSS parses that don't work within a StyleSheetContents context will have
+        their StyleRules &amp; co allocated through FastMalloc just like before.
+
+        Bonus: give SelectorQueryCache a dedicated BumpArena as well, since it has very
+        predictable lifetime.
+
+        * css/CSSGrammar.y.in:
+        * css/CSSKeyframesRule.h:
+        (WebCore::StyleRuleKeyframes::create):
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::createStyleProperties):
+        (WebCore::CSSParser::createMediaRule):
+        (WebCore::CSSParser::createSupportsRule):
+        (WebCore::CSSParser::createKeyframesRule):
+        (WebCore::CSSParser::setArena):
+        (WebCore::CSSParser::arena):
+        (WebCore::CSSParser::createStyleRule):
+        (WebCore::CSSParser::createFontFaceRule):
+        (WebCore::CSSParser::createPageRule):
+        (WebCore::CSSParser::createRegionRule):
+        (WebCore::CSSParser::createViewportRule):
+        * css/CSSParser.h:
+        * css/CSSParserValues.cpp:
+        (WebCore::CSSParserSelector::parsePseudoElementCueFunctionSelector):
+        (WebCore::CSSParserSelector::adoptSelectorVector):
+        * css/CSSParserValues.h:
+        * css/CSSSelectorList.cpp:
+        (WebCore::CSSSelectorList::CSSSelectorList):
+        (WebCore::CSSSelectorList::adoptSelectorVector):
+        (WebCore::CSSSelectorList::deleteSelectors):
+        * css/CSSSelectorList.h:
+        * css/StyleProperties.cpp:
+        (WebCore::ImmutableStyleProperties::create):
+        (WebCore::StyleProperties::immutableCopyIfNeeded):
+        * css/StyleProperties.h:
+        * css/StyleRule.cpp:
+        (WebCore::StyleRule::create):
+        (WebCore::StyleRule::splitIntoMultipleRulesWithMaximumSelectorComponentCount):
+        (WebCore::StyleRuleRegion::StyleRuleRegion):
+        * css/StyleRule.h:
+        (WebCore::StyleRule::create):
+        (WebCore::StyleRule::parserAdoptSelectorVector):
+        (WebCore::StyleRuleFontFace::create):
+        (WebCore::StyleRulePage::create):
+        (WebCore::StyleRulePage::parserAdoptSelectorVector):
+        (WebCore::StyleRuleMedia::create):
+        (WebCore::StyleRuleSupports::create):
+        (WebCore::StyleRuleRegion::create):
+        (WebCore::StyleRuleViewport::create):
+        * css/StyleSheetContents.cpp:
+        (WebCore::StyleSheetContents::StyleSheetContents):
+        (WebCore::StyleSheetContents::parseAuthorStyleSheet):
+        (WebCore::StyleSheetContents::parseStringAtPosition):
+        * css/StyleSheetContents.h:
+        * dom/SelectorQuery.cpp:
+        (WebCore::SelectorQueryCache::SelectorQueryCache):
+        (WebCore::SelectorQueryCache::add):
+        * dom/SelectorQuery.h:
+        * svg/SVGFontFaceElement.cpp:
+        (WebCore::SVGFontFaceElement::SVGFontFaceElement):
+
</ins><span class="cx"> 2016-01-15  Dave Hyatt  &lt;hyatt@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Avoid downloading the wrong image for &lt;picture&gt; elements.
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSGrammaryin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSGrammar.y.in (195140 => 195141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSGrammar.y.in        2016-01-15 19:55:19 UTC (rev 195140)
+++ trunk/Source/WebCore/css/CSSGrammar.y.in        2016-01-15 20:01:42 UTC (rev 195141)
</span><span class="lines">@@ -403,7 +403,7 @@
</span><span class="cx">     WEBKIT_SELECTOR_SYM '{' maybe_space selector_list '}' {
</span><span class="cx">         if ($4) {
</span><span class="cx">             if (parser-&gt;m_selectorListForParseSelector)
</span><del>-                parser-&gt;m_selectorListForParseSelector-&gt;adoptSelectorVector(*$4);
</del><ins>+                parser-&gt;m_selectorListForParseSelector-&gt;adoptSelectorVector(parser-&gt;arena(), *$4);
</ins><span class="cx">             parser-&gt;recycleSelectorVector(std::unique_ptr&lt;Vector&lt;std::unique_ptr&lt;CSSParserSelector&gt;&gt;&gt;($4));
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="lines">@@ -1353,7 +1353,7 @@
</span><span class="cx"> #if ENABLE_VIDEO_TRACK
</span><span class="cx">     // used by ::cue(:past/:future)
</span><span class="cx">     | ':' ':' CUEFUNCTION maybe_space simple_selector_list maybe_space ')' {
</span><del>-        $$ = CSSParserSelector::parsePseudoElementCueFunctionSelector($3, $5);
</del><ins>+        $$ = CSSParserSelector::parsePseudoElementCueFunctionSelector(parser-&gt;arena(), $3, $5);
</ins><span class="cx">     }
</span><span class="cx"> #endif
</span><span class="cx">     // use by :-webkit-any.
</span><span class="lines">@@ -1366,7 +1366,7 @@
</span><span class="cx">         if ($4) {
</span><span class="cx">             auto selector = std::make_unique&lt;CSSParserSelector&gt;();
</span><span class="cx">             selector-&gt;setMatch(CSSSelector::PseudoClass);
</span><del>-            selector-&gt;adoptSelectorVector(*std::unique_ptr&lt;Vector&lt;std::unique_ptr&lt;CSSParserSelector&gt;&gt;&gt;($4));
</del><ins>+            selector-&gt;adoptSelectorVector(parser-&gt;arena(), *std::unique_ptr&lt;Vector&lt;std::unique_ptr&lt;CSSParserSelector&gt;&gt;&gt;($4));
</ins><span class="cx">             selector-&gt;setPseudoClassValue($2);
</span><span class="cx">             if (selector-&gt;pseudoClassType() == CSSSelector::PseudoClassAny)
</span><span class="cx">                 $$ = selector.release();
</span><span class="lines">@@ -1377,7 +1377,7 @@
</span><span class="cx">         if ($4) {
</span><span class="cx">             auto selector = std::make_unique&lt;CSSParserSelector&gt;();
</span><span class="cx">             selector-&gt;setMatch(CSSSelector::PseudoClass);
</span><del>-            selector-&gt;adoptSelectorVector(*std::unique_ptr&lt;Vector&lt;std::unique_ptr&lt;CSSParserSelector&gt;&gt;&gt;($4));
</del><ins>+            selector-&gt;adoptSelectorVector(parser-&gt;arena(), *std::unique_ptr&lt;Vector&lt;std::unique_ptr&lt;CSSParserSelector&gt;&gt;&gt;($4));
</ins><span class="cx">             selector-&gt;setPseudoClassValue($2);
</span><span class="cx">             if (selector-&gt;pseudoClassType() == CSSSelector::PseudoClassMatches)
</span><span class="cx">                 $$ = selector.release();
</span><span class="lines">@@ -1427,7 +1427,7 @@
</span><span class="cx">             selector-&gt;setArgument($4);
</span><span class="cx">             selector-&gt;setPseudoClassValue($2);
</span><span class="cx">             if (ending)
</span><del>-                selector-&gt;adoptSelectorVector(*ending);
</del><ins>+                selector-&gt;adoptSelectorVector(parser-&gt;arena(), *ending);
</ins><span class="cx">             CSSSelector::PseudoClassType pseudoClassType = selector-&gt;pseudoClassType();
</span><span class="cx">             if (pseudoClassType == CSSSelector::PseudoClassNthChild || pseudoClassType == CSSSelector::PseudoClassNthLastChild)
</span><span class="cx">                 $$ = selector.release();
</span><span class="lines">@@ -1442,7 +1442,7 @@
</span><span class="cx">             selector-&gt;setArgument(AtomicString::number($4 * $5));
</span><span class="cx">             selector-&gt;setPseudoClassValue($2);
</span><span class="cx">             if (ending)
</span><del>-                selector-&gt;adoptSelectorVector(*ending);
</del><ins>+                selector-&gt;adoptSelectorVector(parser-&gt;arena(), *ending);
</ins><span class="cx">             CSSSelector::PseudoClassType pseudoClassType = selector-&gt;pseudoClassType();
</span><span class="cx">             if (pseudoClassType == CSSSelector::PseudoClassNthChild || pseudoClassType == CSSSelector::PseudoClassNthLastChild)
</span><span class="cx">                 $$ = selector.release();
</span><span class="lines">@@ -1457,7 +1457,7 @@
</span><span class="cx">             selector-&gt;setArgument($4);
</span><span class="cx">             selector-&gt;setPseudoClassValue($2);
</span><span class="cx">             if (ending)
</span><del>-               selector-&gt;adoptSelectorVector(*ending);
</del><ins>+               selector-&gt;adoptSelectorVector(parser-&gt;arena(), *ending);
</ins><span class="cx">             CSSSelector::PseudoClassType pseudoClassType = selector-&gt;pseudoClassType();
</span><span class="cx">             if (pseudoClassType == CSSSelector::PseudoClassNthChild || pseudoClassType == CSSSelector::PseudoClassNthLastChild)
</span><span class="cx">                 $$ = selector.release();
</span><span class="lines">@@ -1511,7 +1511,7 @@
</span><span class="cx">                 auto selector = std::make_unique&lt;CSSParserSelector&gt;();
</span><span class="cx">                 selector-&gt;setMatch(CSSSelector::PseudoClass);
</span><span class="cx">                 selector-&gt;setPseudoClassValue($2);
</span><del>-                selector-&gt;adoptSelectorVector(*list);
</del><ins>+                selector-&gt;adoptSelectorVector(parser-&gt;arena(), *list);
</ins><span class="cx">                 if (selector-&gt;pseudoClassType() == CSSSelector::PseudoClassNot)
</span><span class="cx">                     $$ = selector.release();
</span><span class="cx">             }
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSKeyframesRuleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSKeyframesRule.h (195140 => 195141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSKeyframesRule.h        2016-01-15 19:55:19 UTC (rev 195140)
+++ trunk/Source/WebCore/css/CSSKeyframesRule.h        2016-01-15 20:01:42 UTC (rev 195141)
</span><span class="lines">@@ -40,7 +40,7 @@
</span><span class="cx"> 
</span><span class="cx"> class StyleRuleKeyframes : public StyleRuleBase {
</span><span class="cx"> public:
</span><del>-    static Ref&lt;StyleRuleKeyframes&gt; create() { return adoptRef(*new StyleRuleKeyframes()); }
</del><ins>+    static Ref&lt;StyleRuleKeyframes&gt; create(BumpArena* arena) { return adoptRef(*new (arena) StyleRuleKeyframes); }
</ins><span class="cx">     
</span><span class="cx">     ~StyleRuleKeyframes();
</span><span class="cx">     
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSParser.cpp (195140 => 195141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSParser.cpp        2016-01-15 19:55:19 UTC (rev 195140)
+++ trunk/Source/WebCore/css/CSSParser.cpp        2016-01-15 20:01:42 UTC (rev 195141)
</span><span class="lines">@@ -1644,7 +1644,7 @@
</span><span class="cx">     if (unusedEntries)
</span><span class="cx">         results.remove(0, unusedEntries);
</span><span class="cx"> 
</span><del>-    return ImmutableStyleProperties::create(results.data(), results.size(), m_context.mode);
</del><ins>+    return ImmutableStyleProperties::create(arena(), results.data(), results.size(), m_context.mode);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void CSSParser::addPropertyWithPrefixingVariant(CSSPropertyID propId, PassRefPtr&lt;CSSValue&gt; value, bool important, bool implicit)
</span><span class="lines">@@ -12701,9 +12701,9 @@
</span><span class="cx">     if (!media) {
</span><span class="cx">         // To comply with w3c test suite expectation, create an empty media query
</span><span class="cx">         // even when it is syntactically incorrect.
</span><del>-        rule = StyleRuleMedia::create(MediaQuerySet::create(), emptyRules);
</del><ins>+        rule = StyleRuleMedia::create(arena(), MediaQuerySet::create(), emptyRules);
</ins><span class="cx">     } else
</span><del>-        rule = StyleRuleMedia::create(media, rules ? *rules : emptyRules);
</del><ins>+        rule = StyleRuleMedia::create(arena(), media, rules ? *rules : emptyRules);
</ins><span class="cx">     processAndAddNewRuleToSourceTreeIfNeeded();
</span><span class="cx">     return rule;
</span><span class="cx"> }
</span><span class="lines">@@ -12729,10 +12729,10 @@
</span><span class="cx">         conditionText = String(m_dataStart16.get() + conditionOffset, conditionLength).stripWhiteSpace();
</span><span class="cx"> 
</span><span class="cx">     if (rules)
</span><del>-        rule = StyleRuleSupports::create(conditionText, conditionIsSupported, *rules);
</del><ins>+        rule = StyleRuleSupports::create(arena(), conditionText, conditionIsSupported, *rules);
</ins><span class="cx">     else {
</span><span class="cx">         RuleList emptyRules;
</span><del>-        rule = StyleRuleSupports::create(conditionText, conditionIsSupported, emptyRules);
</del><ins>+        rule = StyleRuleSupports::create(arena(), conditionText, conditionIsSupported, emptyRules);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     processAndAddNewRuleToSourceTreeIfNeeded();
</span><span class="lines">@@ -12841,7 +12841,7 @@
</span><span class="cx"> {
</span><span class="cx">     std::unique_ptr&lt;Vector&lt;RefPtr&lt;StyleKeyframe&gt;&gt;&gt; keyframes = WTFMove(popKeyframes);
</span><span class="cx">     m_allowImportRules = m_allowNamespaceDeclarations = false;
</span><del>-    RefPtr&lt;StyleRuleKeyframes&gt; rule = StyleRuleKeyframes::create();
</del><ins>+    RefPtr&lt;StyleRuleKeyframes&gt; rule = StyleRuleKeyframes::create(arena());
</ins><span class="cx">     for (size_t i = 0; i &lt; keyframes-&gt;size(); ++i)
</span><span class="cx">         rule-&gt;parserAppendKeyframe(keyframes-&gt;at(i));
</span><span class="cx">     rule-&gt;setName(name);
</span><span class="lines">@@ -12849,14 +12849,24 @@
</span><span class="cx">     return rule;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void CSSParser::setArena(BumpArena&amp; arena)
+{
+    m_arena = &amp;arena;
+}
+
+BumpArena* CSSParser::arena()
+{
+    return m_arena.get();
+}
+
</ins><span class="cx"> RefPtr&lt;StyleRuleBase&gt; CSSParser::createStyleRule(Vector&lt;std::unique_ptr&lt;CSSParserSelector&gt;&gt;* selectors)
</span><span class="cx"> {
</span><span class="cx">     RefPtr&lt;StyleRule&gt; rule;
</span><span class="cx">     if (selectors) {
</span><span class="cx">         m_allowImportRules = false;
</span><span class="cx">         m_allowNamespaceDeclarations = false;
</span><del>-        rule = StyleRule::create(m_lastSelectorLineNumber, createStyleProperties());
-        rule-&gt;parserAdoptSelectorVector(*selectors);
</del><ins>+        rule = StyleRule::create(arena(), m_lastSelectorLineNumber, createStyleProperties());
+        rule-&gt;parserAdoptSelectorVector(arena(), *selectors);
</ins><span class="cx">         processAndAddNewRuleToSourceTreeIfNeeded();
</span><span class="cx">     } else
</span><span class="cx">         popRuleData();
</span><span class="lines">@@ -12879,7 +12889,7 @@
</span><span class="cx">             return nullptr;
</span><span class="cx">         }
</span><span class="cx">     }
</span><del>-    RefPtr&lt;StyleRuleFontFace&gt; rule = StyleRuleFontFace::create(createStyleProperties());
</del><ins>+    RefPtr&lt;StyleRuleFontFace&gt; rule = StyleRuleFontFace::create(arena(), createStyleProperties());
</ins><span class="cx">     clearProperties();
</span><span class="cx">     processAndAddNewRuleToSourceTreeIfNeeded();
</span><span class="cx">     return rule;
</span><span class="lines">@@ -12963,10 +12973,10 @@
</span><span class="cx">     m_allowImportRules = m_allowNamespaceDeclarations = false;
</span><span class="cx">     RefPtr&lt;StyleRulePage&gt; rule;
</span><span class="cx">     if (pageSelector) {
</span><del>-        rule = StyleRulePage::create(createStyleProperties());
</del><ins>+        rule = StyleRulePage::create(arena(), createStyleProperties());
</ins><span class="cx">         Vector&lt;std::unique_ptr&lt;CSSParserSelector&gt;&gt; selectorVector;
</span><span class="cx">         selectorVector.append(WTFMove(pageSelector));
</span><del>-        rule-&gt;parserAdoptSelectorVector(selectorVector);
</del><ins>+        rule-&gt;parserAdoptSelectorVector(arena(), selectorVector);
</ins><span class="cx">         processAndAddNewRuleToSourceTreeIfNeeded();
</span><span class="cx">     } else
</span><span class="cx">         popRuleData();
</span><span class="lines">@@ -12998,7 +13008,7 @@
</span><span class="cx"> 
</span><span class="cx">     m_allowImportRules = m_allowNamespaceDeclarations = false;
</span><span class="cx"> 
</span><del>-    RefPtr&lt;StyleRuleRegion&gt; regionRule = StyleRuleRegion::create(regionSelector, *rules);
</del><ins>+    RefPtr&lt;StyleRuleRegion&gt; regionRule = StyleRuleRegion::create(arena(), regionSelector, *rules);
</ins><span class="cx"> 
</span><span class="cx">     if (isExtractingSourceData())
</span><span class="cx">         addNewRuleToSourceTree(CSSRuleSourceData::createUnknown());
</span><span class="lines">@@ -13272,7 +13282,7 @@
</span><span class="cx"> {
</span><span class="cx">     m_allowImportRules = m_allowNamespaceDeclarations = false;
</span><span class="cx"> 
</span><del>-    RefPtr&lt;StyleRuleViewport&gt; rule = StyleRuleViewport::create(createStyleProperties());
</del><ins>+    RefPtr&lt;StyleRuleViewport&gt; rule = StyleRuleViewport::create(arena(), createStyleProperties());
</ins><span class="cx">     clearProperties();
</span><span class="cx"> 
</span><span class="cx">     processAndAddNewRuleToSourceTreeIfNeeded();
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSParserh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSParser.h (195140 => 195141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSParser.h        2016-01-15 19:55:19 UTC (rev 195140)
+++ trunk/Source/WebCore/css/CSSParser.h        2016-01-15 20:01:42 UTC (rev 195141)
</span><span class="lines">@@ -36,6 +36,7 @@
</span><span class="cx"> #include &quot;SourceSizeList.h&quot;
</span><span class="cx"> #include &quot;WebKitCSSFilterValue.h&quot;
</span><span class="cx"> #include &lt;memory&gt;
</span><ins>+#include &lt;wtf/BumpArena.h&gt;
</ins><span class="cx"> #include &lt;wtf/HashMap.h&gt;
</span><span class="cx"> #include &lt;wtf/HashSet.h&gt;
</span><span class="cx"> #include &lt;wtf/Vector.h&gt;
</span><span class="lines">@@ -114,6 +115,8 @@
</span><span class="cx">     WEBCORE_EXPORT CSSParser(const CSSParserContext&amp;);
</span><span class="cx">     WEBCORE_EXPORT ~CSSParser();
</span><span class="cx"> 
</span><ins>+    void setArena(BumpArena&amp;);
+
</ins><span class="cx">     void parseSheet(StyleSheetContents*, const String&amp;, const TextPosition&amp;, RuleSourceDataList*, bool logErrors);
</span><span class="cx">     RefPtr&lt;StyleRuleBase&gt; parseRule(StyleSheetContents*, const String&amp;);
</span><span class="cx">     RefPtr&lt;StyleKeyframe&gt; parseKeyframeRule(StyleSheetContents*, const String&amp;);
</span><span class="lines">@@ -397,6 +400,8 @@
</span><span class="cx"> 
</span><span class="cx">     CSSParserContext m_context;
</span><span class="cx"> 
</span><ins>+    BumpArena* arena();
+    RefPtr&lt;BumpArena&gt; m_arena;
</ins><span class="cx">     bool m_important;
</span><span class="cx">     CSSPropertyID m_id;
</span><span class="cx">     AtomicString m_customPropertyName;
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSParserValuescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSParserValues.cpp (195140 => 195141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSParserValues.cpp        2016-01-15 19:55:19 UTC (rev 195140)
+++ trunk/Source/WebCore/css/CSSParserValues.cpp        2016-01-15 20:01:42 UTC (rev 195141)
</span><span class="lines">@@ -214,7 +214,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(VIDEO_TRACK)
</span><del>-CSSParserSelector* CSSParserSelector::parsePseudoElementCueFunctionSelector(const CSSParserString&amp; functionIdentifier, Vector&lt;std::unique_ptr&lt;CSSParserSelector&gt;&gt;* parsedSelectorVector)
</del><ins>+CSSParserSelector* CSSParserSelector::parsePseudoElementCueFunctionSelector(BumpArena* arena, const CSSParserString&amp; functionIdentifier, Vector&lt;std::unique_ptr&lt;CSSParserSelector&gt;&gt;* parsedSelectorVector)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT_UNUSED(functionIdentifier, String(functionIdentifier) == &quot;cue(&quot;);
</span><span class="cx"> 
</span><span class="lines">@@ -226,7 +226,7 @@
</span><span class="cx">     auto selector = std::make_unique&lt;CSSParserSelector&gt;();
</span><span class="cx">     selector-&gt;m_selector-&gt;setMatch(CSSSelector::PseudoElement);
</span><span class="cx">     selector-&gt;m_selector-&gt;setPseudoElementType(CSSSelector::PseudoElementCue);
</span><del>-    selector-&gt;adoptSelectorVector(*selectorVector);
</del><ins>+    selector-&gt;adoptSelectorVector(arena, *selectorVector);
</ins><span class="cx">     return selector.release();
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="lines">@@ -279,10 +279,10 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CSSParserSelector::adoptSelectorVector(Vector&lt;std::unique_ptr&lt;CSSParserSelector&gt;&gt;&amp; selectorVector)
</del><ins>+void CSSParserSelector::adoptSelectorVector(BumpArena* arena, Vector&lt;std::unique_ptr&lt;CSSParserSelector&gt;&gt;&amp; selectorVector)
</ins><span class="cx"> {
</span><span class="cx">     auto selectorList = std::make_unique&lt;CSSSelectorList&gt;();
</span><del>-    selectorList-&gt;adoptSelectorVector(selectorVector);
</del><ins>+    selectorList-&gt;adoptSelectorVector(arena, selectorVector);
</ins><span class="cx">     m_selector-&gt;setSelectorList(WTFMove(selectorList));
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSParserValuesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSParserValues.h (195140 => 195141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSParserValues.h        2016-01-15 19:55:19 UTC (rev 195140)
+++ trunk/Source/WebCore/css/CSSParserValues.h        2016-01-15 20:01:42 UTC (rev 195141)
</span><span class="lines">@@ -24,6 +24,7 @@
</span><span class="cx"> #include &quot;CSSSelector.h&quot;
</span><span class="cx"> #include &quot;CSSValueKeywords.h&quot;
</span><span class="cx"> #include &quot;CSSValueList.h&quot;
</span><ins>+#include &lt;wtf/BumpArena.h&gt;
</ins><span class="cx"> #include &lt;wtf/text/AtomicString.h&gt;
</span><span class="cx"> #include &lt;wtf/text/AtomicStringHash.h&gt;
</span><span class="cx"> #include &lt;wtf/text/WTFString.h&gt;
</span><span class="lines">@@ -211,7 +212,7 @@
</span><span class="cx"> public:
</span><span class="cx">     static CSSParserSelector* parsePagePseudoSelector(const CSSParserString&amp; pseudoTypeString);
</span><span class="cx">     static CSSParserSelector* parsePseudoElementSelector(CSSParserString&amp; pseudoTypeString);
</span><del>-    static CSSParserSelector* parsePseudoElementCueFunctionSelector(const CSSParserString&amp; functionIdentifier, Vector&lt;std::unique_ptr&lt;CSSParserSelector&gt;&gt;* selectorVector);
</del><ins>+    static CSSParserSelector* parsePseudoElementCueFunctionSelector(BumpArena*, const CSSParserString&amp; functionIdentifier, Vector&lt;std::unique_ptr&lt;CSSParserSelector&gt;&gt;* selectorVector);
</ins><span class="cx">     static CSSParserSelector* parsePseudoClassAndCompatibilityElementSelector(CSSParserString&amp; pseudoTypeString);
</span><span class="cx"> 
</span><span class="cx">     CSSParserSelector();
</span><span class="lines">@@ -228,7 +229,7 @@
</span><span class="cx">     void setRelation(CSSSelector::Relation value) { m_selector-&gt;setRelation(value); }
</span><span class="cx">     void setForPage() { m_selector-&gt;setForPage(); }
</span><span class="cx"> 
</span><del>-    void adoptSelectorVector(Vector&lt;std::unique_ptr&lt;CSSParserSelector&gt;&gt;&amp; selectorVector);
</del><ins>+    void adoptSelectorVector(BumpArena*, Vector&lt;std::unique_ptr&lt;CSSParserSelector&gt;&gt;&amp; selectorVector);
</ins><span class="cx">     void setLangArgumentList(const Vector&lt;CSSParserString&gt;&amp; stringVector);
</span><span class="cx"> 
</span><span class="cx">     void setPseudoClassValue(const CSSParserString&amp; pseudoClassString);
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSSelectorListcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSSelectorList.cpp (195140 => 195141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSSelectorList.cpp        2016-01-15 19:55:19 UTC (rev 195140)
+++ trunk/Source/WebCore/css/CSSSelectorList.cpp        2016-01-15 20:01:42 UTC (rev 195141)
</span><span class="lines">@@ -37,7 +37,7 @@
</span><span class="cx">     unsigned otherComponentCount = other.componentCount();
</span><span class="cx">     ASSERT_WITH_SECURITY_IMPLICATION(otherComponentCount);
</span><span class="cx"> 
</span><del>-    m_selectorArray = reinterpret_cast&lt;CSSSelector*&gt;(fastMalloc(sizeof(CSSSelector) * otherComponentCount));
</del><ins>+    m_selectorArray = reinterpret_cast&lt;CSSSelector*&gt;(BumpArena::allocate(BumpArena::arenaFor(other.m_selectorArray), sizeof(CSSSelector) * otherComponentCount));
</ins><span class="cx">     for (unsigned i = 0; i &lt; otherComponentCount; ++i)
</span><span class="cx">         new (NotNull, &amp;m_selectorArray[i]) CSSSelector(other.m_selectorArray[i]);
</span><span class="cx"> }
</span><span class="lines">@@ -49,7 +49,7 @@
</span><span class="cx">     other.m_selectorArray = nullptr;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CSSSelectorList::adoptSelectorVector(Vector&lt;std::unique_ptr&lt;CSSParserSelector&gt;&gt;&amp; selectorVector)
</del><ins>+void CSSSelectorList::adoptSelectorVector(BumpArena* arena, Vector&lt;std::unique_ptr&lt;CSSParserSelector&gt;&gt;&amp; selectorVector)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT_WITH_SECURITY_IMPLICATION(!selectorVector.isEmpty());
</span><span class="cx"> 
</span><span class="lines">@@ -60,7 +60,7 @@
</span><span class="cx">             ++flattenedSize;
</span><span class="cx">     }
</span><span class="cx">     ASSERT(flattenedSize);
</span><del>-    m_selectorArray = reinterpret_cast&lt;CSSSelector*&gt;(fastMalloc(sizeof(CSSSelector) * flattenedSize));
</del><ins>+    m_selectorArray = reinterpret_cast&lt;CSSSelector*&gt;(BumpArena::allocate(arena, sizeof(CSSSelector) * flattenedSize));
</ins><span class="cx">     size_t arrayIndex = 0;
</span><span class="cx">     for (size_t i = 0; i &lt; selectorVector.size(); ++i) {
</span><span class="cx">         CSSParserSelector* current = selectorVector[i].get();
</span><span class="lines">@@ -119,7 +119,7 @@
</span><span class="cx">         isLastSelector = s-&gt;isLastInSelectorList();
</span><span class="cx">         s-&gt;~CSSSelector();
</span><span class="cx">     }
</span><del>-    fastFree(selectorArray);
</del><ins>+    BumpArena::deallocate(selectorArray);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> String CSSSelectorList::selectorsText() const
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSSelectorListh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSSelectorList.h (195140 => 195141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSSelectorList.h        2016-01-15 19:55:19 UTC (rev 195140)
+++ trunk/Source/WebCore/css/CSSSelectorList.h        2016-01-15 20:01:42 UTC (rev 195141)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;CSSSelector.h&quot;
</span><span class="cx"> #include &lt;memory&gt;
</span><ins>+#include &lt;wtf/BumpArena.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="lines">@@ -42,7 +43,7 @@
</span><span class="cx"> 
</span><span class="cx">     ~CSSSelectorList() { deleteSelectors(); }
</span><span class="cx"> 
</span><del>-    void adoptSelectorVector(Vector&lt;std::unique_ptr&lt;CSSParserSelector&gt;&gt;&amp; selectorVector);
</del><ins>+    void adoptSelectorVector(BumpArena*, Vector&lt;std::unique_ptr&lt;CSSParserSelector&gt;&gt;&amp;);
</ins><span class="cx">     void adoptSelectorArray(CSSSelector* selectors) { ASSERT(!m_selectorArray); m_selectorArray = selectors; }
</span><span class="cx"> 
</span><span class="cx">     bool isValid() const { return !!m_selectorArray; }
</span></span></pre></div>
<a id="trunkSourceWebCorecssStylePropertiescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleProperties.cpp (195140 => 195141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleProperties.cpp        2016-01-15 19:55:19 UTC (rev 195140)
+++ trunk/Source/WebCore/css/StyleProperties.cpp        2016-01-15 20:01:42 UTC (rev 195141)
</span><span class="lines">@@ -55,9 +55,9 @@
</span><span class="cx">     return value.length() == 7 &amp;&amp; (value == &quot;initial&quot; || value == &quot;inherit&quot;);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-Ref&lt;ImmutableStyleProperties&gt; ImmutableStyleProperties::create(const CSSProperty* properties, unsigned count, CSSParserMode cssParserMode)
</del><ins>+Ref&lt;ImmutableStyleProperties&gt; ImmutableStyleProperties::create(BumpArena* arena, const CSSProperty* properties, unsigned count, CSSParserMode cssParserMode)
</ins><span class="cx"> {
</span><del>-    void* slot = WTF::fastMalloc(sizeForImmutableStylePropertiesWithPropertyCount(count));
</del><ins>+    void* slot = BumpArena::allocate(arena, sizeForImmutableStylePropertiesWithPropertyCount(count));
</ins><span class="cx">     return adoptRef(*new (NotNull, slot) ImmutableStyleProperties(properties, count, cssParserMode));
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -66,7 +66,7 @@
</span><span class="cx">     if (is&lt;ImmutableStyleProperties&gt;(*this))
</span><span class="cx">         return downcast&lt;ImmutableStyleProperties&gt;(const_cast&lt;StyleProperties&amp;&gt;(*this));
</span><span class="cx">     const MutableStyleProperties&amp; mutableThis = downcast&lt;MutableStyleProperties&gt;(*this);
</span><del>-    return ImmutableStyleProperties::create(mutableThis.m_propertyVector.data(), mutableThis.m_propertyVector.size(), cssParserMode());
</del><ins>+    return ImmutableStyleProperties::create(BumpArena::arenaFor(this), mutableThis.m_propertyVector.data(), mutableThis.m_propertyVector.size(), cssParserMode());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> MutableStyleProperties::MutableStyleProperties(CSSParserMode cssParserMode)
</span></span></pre></div>
<a id="trunkSourceWebCorecssStylePropertiesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleProperties.h (195140 => 195141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleProperties.h        2016-01-15 19:55:19 UTC (rev 195140)
+++ trunk/Source/WebCore/css/StyleProperties.h        2016-01-15 20:01:42 UTC (rev 195141)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> #include &quot;CSSPropertyNames.h&quot;
</span><span class="cx"> #include &quot;CSSValueKeywords.h&quot;
</span><span class="cx"> #include &lt;memory&gt;
</span><ins>+#include &lt;wtf/BumpArena.h&gt;
</ins><span class="cx"> #include &lt;wtf/ListHashSet.h&gt;
</span><span class="cx"> #include &lt;wtf/TypeCasts.h&gt;
</span><span class="cx"> #include &lt;wtf/Vector.h&gt;
</span><span class="lines">@@ -46,7 +47,8 @@
</span><span class="cx"> class StylePropertyShorthand;
</span><span class="cx"> class StyleSheetContents;
</span><span class="cx"> 
</span><del>-class StyleProperties : public RefCounted&lt;StyleProperties&gt; {
</del><ins>+class StyleProperties : public WTF::RefCountedBase {
+    WTF_MAKE_BUMPARENA_ALLOCATED;
</ins><span class="cx">     friend class PropertyReference;
</span><span class="cx"> public:
</span><span class="cx">     // Override RefCounted's deref() to ensure operator delete is called on
</span><span class="lines">@@ -161,7 +163,7 @@
</span><span class="cx"> class ImmutableStyleProperties : public StyleProperties {
</span><span class="cx"> public:
</span><span class="cx">     WEBCORE_EXPORT ~ImmutableStyleProperties();
</span><del>-    static Ref&lt;ImmutableStyleProperties&gt; create(const CSSProperty* properties, unsigned count, CSSParserMode);
</del><ins>+    static Ref&lt;ImmutableStyleProperties&gt; create(BumpArena*, const CSSProperty* properties, unsigned count, CSSParserMode);
</ins><span class="cx"> 
</span><span class="cx">     unsigned propertyCount() const { return m_arraySize; }
</span><span class="cx">     bool isEmpty() const { return !propertyCount(); }
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleRulecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleRule.cpp (195140 => 195141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleRule.cpp        2016-01-15 19:55:19 UTC (rev 195140)
+++ trunk/Source/WebCore/css/StyleRule.cpp        2016-01-15 20:01:42 UTC (rev 195141)
</span><span class="lines">@@ -219,14 +219,14 @@
</span><span class="cx">     return downcast&lt;MutableStyleProperties&gt;(m_properties.get());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-Ref&lt;StyleRule&gt; StyleRule::create(int sourceLine, const Vector&lt;const CSSSelector*&gt;&amp; selectors, Ref&lt;StyleProperties&gt;&amp;&amp; properties)
</del><ins>+Ref&lt;StyleRule&gt; StyleRule::create(BumpArena* arena, int sourceLine, const Vector&lt;const CSSSelector*&gt;&amp; selectors, Ref&lt;StyleProperties&gt;&amp;&amp; properties)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT_WITH_SECURITY_IMPLICATION(!selectors.isEmpty());
</span><del>-    CSSSelector* selectorListArray = reinterpret_cast&lt;CSSSelector*&gt;(fastMalloc(sizeof(CSSSelector) * selectors.size()));
</del><ins>+    CSSSelector* selectorListArray = reinterpret_cast&lt;CSSSelector*&gt;(BumpArena::allocate(arena, sizeof(CSSSelector) * selectors.size()));
</ins><span class="cx">     for (unsigned i = 0; i &lt; selectors.size(); ++i)
</span><span class="cx">         new (NotNull, &amp;selectorListArray[i]) CSSSelector(*selectors.at(i));
</span><span class="cx">     selectorListArray[selectors.size() - 1].setLastInSelectorList();
</span><del>-    auto rule = StyleRule::create(sourceLine, WTFMove(properties));
</del><ins>+    auto rule = StyleRule::create(arena, sourceLine, WTFMove(properties));
</ins><span class="cx">     rule.get().parserAdoptSelectorArray(selectorListArray);
</span><span class="cx">     return rule;
</span><span class="cx"> }
</span><span class="lines">@@ -244,7 +244,7 @@
</span><span class="cx">             componentsInThisSelector.append(component);
</span><span class="cx"> 
</span><span class="cx">         if (componentsInThisSelector.size() + componentsSinceLastSplit.size() &gt; maxCount &amp;&amp; !componentsSinceLastSplit.isEmpty()) {
</span><del>-            rules.append(create(sourceLine(), componentsSinceLastSplit, const_cast&lt;StyleProperties&amp;&gt;(m_properties.get())));
</del><ins>+            rules.append(create(BumpArena::arenaFor(this), sourceLine(), componentsSinceLastSplit, const_cast&lt;StyleProperties&amp;&gt;(m_properties.get())));
</ins><span class="cx">             componentsSinceLastSplit.clear();
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -252,7 +252,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (!componentsSinceLastSplit.isEmpty())
</span><del>-        rules.append(create(sourceLine(), componentsSinceLastSplit, const_cast&lt;StyleProperties&amp;&gt;(m_properties.get())));
</del><ins>+        rules.append(create(BumpArena::arenaFor(this), sourceLine(), componentsSinceLastSplit, const_cast&lt;StyleProperties&amp;&gt;(m_properties.get())));
</ins><span class="cx"> 
</span><span class="cx">     return rules;
</span><span class="cx"> }
</span><span class="lines">@@ -360,7 +360,7 @@
</span><span class="cx"> StyleRuleRegion::StyleRuleRegion(Vector&lt;std::unique_ptr&lt;CSSParserSelector&gt;&gt;* selectors, Vector&lt;RefPtr&lt;StyleRuleBase&gt;&gt;&amp; adoptRules)
</span><span class="cx">     : StyleRuleGroup(Region, adoptRules)
</span><span class="cx"> {
</span><del>-    m_selectorList.adoptSelectorVector(*selectors);
</del><ins>+    m_selectorList.adoptSelectorVector(BumpArena::arenaFor(this), *selectors);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> StyleRuleRegion::StyleRuleRegion(const StyleRuleRegion&amp; o)
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleRuleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleRule.h (195140 => 195141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleRule.h        2016-01-15 19:55:19 UTC (rev 195140)
+++ trunk/Source/WebCore/css/StyleRule.h        2016-01-15 20:01:42 UTC (rev 195141)
</span><span class="lines">@@ -25,6 +25,7 @@
</span><span class="cx"> #include &quot;CSSSelectorList.h&quot;
</span><span class="cx"> #include &quot;MediaList.h&quot;
</span><span class="cx"> #include &quot;StyleProperties.h&quot;
</span><ins>+#include &lt;wtf/BumpArena.h&gt;
</ins><span class="cx"> #include &lt;wtf/RefPtr.h&gt;
</span><span class="cx"> #include &lt;wtf/TypeCasts.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -37,7 +38,7 @@
</span><span class="cx"> class StyleProperties;
</span><span class="cx"> 
</span><span class="cx"> class StyleRuleBase : public WTF::RefCountedBase {
</span><del>-    WTF_MAKE_FAST_ALLOCATED;
</del><ins>+    WTF_MAKE_BUMPARENA_ALLOCATED;
</ins><span class="cx"> public:
</span><span class="cx">     enum Type {
</span><span class="cx">         Unknown, // Not used.
</span><span class="lines">@@ -101,11 +102,10 @@
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> class StyleRule : public StyleRuleBase {
</span><del>-    WTF_MAKE_FAST_ALLOCATED;
</del><span class="cx"> public:
</span><del>-    static Ref&lt;StyleRule&gt; create(int sourceLine, Ref&lt;StyleProperties&gt;&amp;&amp; properties)
</del><ins>+    static Ref&lt;StyleRule&gt; create(BumpArena* arena, int sourceLine, Ref&lt;StyleProperties&gt;&amp;&amp; properties)
</ins><span class="cx">     {
</span><del>-        return adoptRef(*new StyleRule(sourceLine, WTFMove(properties)));
</del><ins>+        return adoptRef(*new (arena) StyleRule(sourceLine, WTFMove(properties)));
</ins><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     ~StyleRule();
</span><span class="lines">@@ -114,7 +114,7 @@
</span><span class="cx">     const StyleProperties&amp; properties() const { return m_properties; }
</span><span class="cx">     MutableStyleProperties&amp; mutableProperties();
</span><span class="cx">     
</span><del>-    void parserAdoptSelectorVector(Vector&lt;std::unique_ptr&lt;CSSParserSelector&gt;&gt;&amp; selectors) { m_selectorList.adoptSelectorVector(selectors); }
</del><ins>+    void parserAdoptSelectorVector(BumpArena* arena, Vector&lt;std::unique_ptr&lt;CSSParserSelector&gt;&gt;&amp; selectors) { m_selectorList.adoptSelectorVector(arena, selectors); }
</ins><span class="cx">     void wrapperAdoptSelectorList(CSSSelectorList&amp; selectors) { m_selectorList = WTFMove(selectors); }
</span><span class="cx">     void parserAdoptSelectorArray(CSSSelector* selectors) { m_selectorList.adoptSelectorArray(selectors); }
</span><span class="cx"> 
</span><span class="lines">@@ -128,7 +128,7 @@
</span><span class="cx">     StyleRule(int sourceLine, Ref&lt;StyleProperties&gt;&amp;&amp;);
</span><span class="cx">     StyleRule(const StyleRule&amp;);
</span><span class="cx"> 
</span><del>-    static Ref&lt;StyleRule&gt; create(int sourceLine, const Vector&lt;const CSSSelector*&gt;&amp;, Ref&lt;StyleProperties&gt;&amp;&amp;);
</del><ins>+    static Ref&lt;StyleRule&gt; create(BumpArena*, int sourceLine, const Vector&lt;const CSSSelector*&gt;&amp;, Ref&lt;StyleProperties&gt;&amp;&amp;);
</ins><span class="cx"> 
</span><span class="cx">     Ref&lt;StyleProperties&gt; m_properties;
</span><span class="cx">     CSSSelectorList m_selectorList;
</span><span class="lines">@@ -136,7 +136,7 @@
</span><span class="cx"> 
</span><span class="cx"> class StyleRuleFontFace : public StyleRuleBase {
</span><span class="cx"> public:
</span><del>-    static Ref&lt;StyleRuleFontFace&gt; create(Ref&lt;StyleProperties&gt;&amp;&amp; properties) { return adoptRef(*new StyleRuleFontFace(WTFMove(properties))); }
</del><ins>+    static Ref&lt;StyleRuleFontFace&gt; create(BumpArena* arena, Ref&lt;StyleProperties&gt;&amp;&amp; properties) { return adoptRef(*new (arena) StyleRuleFontFace(WTFMove(properties))); }
</ins><span class="cx">     
</span><span class="cx">     ~StyleRuleFontFace();
</span><span class="cx"> 
</span><span class="lines">@@ -155,7 +155,7 @@
</span><span class="cx"> 
</span><span class="cx"> class StyleRulePage : public StyleRuleBase {
</span><span class="cx"> public:
</span><del>-    static Ref&lt;StyleRulePage&gt; create(Ref&lt;StyleProperties&gt;&amp;&amp; properties) { return adoptRef(*new StyleRulePage(WTFMove(properties))); }
</del><ins>+    static Ref&lt;StyleRulePage&gt; create(BumpArena* arena, Ref&lt;StyleProperties&gt;&amp;&amp; properties) { return adoptRef(*new (arena) StyleRulePage(WTFMove(properties))); }
</ins><span class="cx"> 
</span><span class="cx">     ~StyleRulePage();
</span><span class="cx"> 
</span><span class="lines">@@ -163,7 +163,7 @@
</span><span class="cx">     const StyleProperties&amp; properties() const { return m_properties; }
</span><span class="cx">     MutableStyleProperties&amp; mutableProperties();
</span><span class="cx"> 
</span><del>-    void parserAdoptSelectorVector(Vector&lt;std::unique_ptr&lt;CSSParserSelector&gt;&gt;&amp; selectors) { m_selectorList.adoptSelectorVector(selectors); }
</del><ins>+    void parserAdoptSelectorVector(BumpArena* arena, Vector&lt;std::unique_ptr&lt;CSSParserSelector&gt;&gt;&amp; selectors) { m_selectorList.adoptSelectorVector(arena, selectors); }
</ins><span class="cx">     void wrapperAdoptSelectorList(CSSSelectorList&amp; selectors) { m_selectorList = WTFMove(selectors); }
</span><span class="cx"> 
</span><span class="cx">     Ref&lt;StyleRulePage&gt; copy() const { return adoptRef(*new StyleRulePage(*this)); }
</span><span class="lines">@@ -193,9 +193,9 @@
</span><span class="cx"> 
</span><span class="cx"> class StyleRuleMedia : public StyleRuleGroup {
</span><span class="cx"> public:
</span><del>-    static Ref&lt;StyleRuleMedia&gt; create(PassRefPtr&lt;MediaQuerySet&gt; media, Vector&lt;RefPtr&lt;StyleRuleBase&gt;&gt;&amp; adoptRules)
</del><ins>+    static Ref&lt;StyleRuleMedia&gt; create(BumpArena* arena, PassRefPtr&lt;MediaQuerySet&gt; media, Vector&lt;RefPtr&lt;StyleRuleBase&gt;&gt;&amp; adoptRules)
</ins><span class="cx">     {
</span><del>-        return adoptRef(*new StyleRuleMedia(media, adoptRules));
</del><ins>+        return adoptRef(*new (arena) StyleRuleMedia(media, adoptRules));
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     MediaQuerySet* mediaQueries() const { return m_mediaQueries.get(); }
</span><span class="lines">@@ -211,9 +211,9 @@
</span><span class="cx"> 
</span><span class="cx"> class StyleRuleSupports : public StyleRuleGroup {
</span><span class="cx"> public:
</span><del>-    static Ref&lt;StyleRuleSupports&gt; create(const String&amp; conditionText, bool conditionIsSupported, Vector&lt;RefPtr&lt;StyleRuleBase&gt;&gt;&amp; adoptRules)
</del><ins>+    static Ref&lt;StyleRuleSupports&gt; create(BumpArena* arena, const String&amp; conditionText, bool conditionIsSupported, Vector&lt;RefPtr&lt;StyleRuleBase&gt;&gt;&amp; adoptRules)
</ins><span class="cx">     {
</span><del>-        return adoptRef(*new StyleRuleSupports(conditionText, conditionIsSupported, adoptRules));
</del><ins>+        return adoptRef(*new (arena) StyleRuleSupports(conditionText, conditionIsSupported, adoptRules));
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     String conditionText() const { return m_conditionText; }
</span><span class="lines">@@ -230,9 +230,9 @@
</span><span class="cx"> 
</span><span class="cx"> class StyleRuleRegion : public StyleRuleGroup {
</span><span class="cx"> public:
</span><del>-    static Ref&lt;StyleRuleRegion&gt; create(Vector&lt;std::unique_ptr&lt;CSSParserSelector&gt;&gt;* selectors, Vector&lt;RefPtr&lt;StyleRuleBase&gt;&gt;&amp; adoptRules)
</del><ins>+    static Ref&lt;StyleRuleRegion&gt; create(BumpArena* arena, Vector&lt;std::unique_ptr&lt;CSSParserSelector&gt;&gt;* selectors, Vector&lt;RefPtr&lt;StyleRuleBase&gt;&gt;&amp; adoptRules)
</ins><span class="cx">     {
</span><del>-        return adoptRef(*new StyleRuleRegion(selectors, adoptRules));
</del><ins>+        return adoptRef(*new (arena) StyleRuleRegion(selectors, adoptRules));
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     const CSSSelectorList&amp; selectorList() const { return m_selectorList; }
</span><span class="lines">@@ -249,7 +249,7 @@
</span><span class="cx"> #if ENABLE(CSS_DEVICE_ADAPTATION)
</span><span class="cx"> class StyleRuleViewport : public StyleRuleBase {
</span><span class="cx"> public:
</span><del>-    static Ref&lt;StyleRuleViewport&gt; create(Ref&lt;StyleProperties&gt;&amp;&amp; properties) { return adoptRef(*new StyleRuleViewport(WTFMove(properties))); }
</del><ins>+    static Ref&lt;StyleRuleViewport&gt; create(BumpArena* arena, Ref&lt;StyleProperties&gt;&amp;&amp; properties) { return adoptRef(*new (arena) StyleRuleViewport(WTFMove(properties))); }
</ins><span class="cx"> 
</span><span class="cx">     ~StyleRuleViewport();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleSheetContentscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleSheetContents.cpp (195140 => 195141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleSheetContents.cpp        2016-01-15 19:55:19 UTC (rev 195140)
+++ trunk/Source/WebCore/css/StyleSheetContents.cpp        2016-01-15 20:01:42 UTC (rev 195141)
</span><span class="lines">@@ -71,6 +71,7 @@
</span><span class="cx">     , m_isMutable(false)
</span><span class="cx">     , m_isInMemoryCache(false)
</span><span class="cx">     , m_parserContext(context)
</span><ins>+    , m_arena(BumpArena::create())
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -91,6 +92,7 @@
</span><span class="cx">     , m_isMutable(false)
</span><span class="cx">     , m_isInMemoryCache(false)
</span><span class="cx">     , m_parserContext(o.m_parserContext)
</span><ins>+    , m_arena(BumpArena::create())
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(o.isCacheable());
</span><span class="cx"> 
</span><span class="lines">@@ -313,6 +315,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     CSSParser p(parserContext());
</span><ins>+    p.setArena(m_arena.get());
</ins><span class="cx">     p.parseSheet(this, sheetText, TextPosition(), nullptr, true);
</span><span class="cx"> 
</span><span class="cx">     if (m_parserContext.needsSiteSpecificQuirks &amp;&amp; isStrictParserMode(m_parserContext.mode)) {
</span><span class="lines">@@ -334,6 +337,7 @@
</span><span class="cx"> bool StyleSheetContents::parseStringAtPosition(const String&amp; sheetText, const TextPosition&amp; textPosition, bool createdByParser)
</span><span class="cx"> {
</span><span class="cx">     CSSParser p(parserContext());
</span><ins>+    p.setArena(m_arena.get());
</ins><span class="cx">     p.parseSheet(this, sheetText, textPosition, nullptr, createdByParser);
</span><span class="cx">     return true;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleSheetContentsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleSheetContents.h (195140 => 195141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleSheetContents.h        2016-01-15 19:55:19 UTC (rev 195140)
+++ trunk/Source/WebCore/css/StyleSheetContents.h        2016-01-15 20:01:42 UTC (rev 195141)
</span><span class="lines">@@ -24,6 +24,7 @@
</span><span class="cx"> #include &quot;CSSParserMode.h&quot;
</span><span class="cx"> #include &quot;CachePolicy.h&quot;
</span><span class="cx"> #include &quot;URL.h&quot;
</span><ins>+#include &lt;wtf/BumpArena.h&gt;
</ins><span class="cx"> #include &lt;wtf/HashMap.h&gt;
</span><span class="cx"> #include &lt;wtf/ListHashSet.h&gt;
</span><span class="cx"> #include &lt;wtf/RefCounted.h&gt;
</span><span class="lines">@@ -173,6 +174,8 @@
</span><span class="cx">     CSSParserContext m_parserContext;
</span><span class="cx"> 
</span><span class="cx">     Vector&lt;CSSStyleSheet*&gt; m_clients;
</span><ins>+
+    Ref&lt;BumpArena&gt; m_arena;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace
</span></span></pre></div>
<a id="trunkSourceWebCoredomSelectorQuerycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/SelectorQuery.cpp (195140 => 195141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/SelectorQuery.cpp        2016-01-15 19:55:19 UTC (rev 195140)
+++ trunk/Source/WebCore/dom/SelectorQuery.cpp        2016-01-15 20:01:42 UTC (rev 195141)
</span><span class="lines">@@ -609,6 +609,11 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+SelectorQueryCache::SelectorQueryCache()
+    : m_arena(BumpArena::create())
+{
+}
+
</ins><span class="cx"> SelectorQuery* SelectorQueryCache::add(const String&amp; selectors, Document&amp; document, ExceptionCode&amp; ec)
</span><span class="cx"> {
</span><span class="cx">     auto it = m_entries.find(selectors);
</span><span class="lines">@@ -616,6 +621,7 @@
</span><span class="cx">         return it-&gt;value.get();
</span><span class="cx"> 
</span><span class="cx">     CSSParser parser(document);
</span><ins>+    parser.setArena(m_arena.get());
</ins><span class="cx">     CSSSelectorList selectorList;
</span><span class="cx">     parser.parseSelector(selectors, selectorList);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoredomSelectorQueryh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/SelectorQuery.h (195140 => 195141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/SelectorQuery.h        2016-01-15 19:55:19 UTC (rev 195140)
+++ trunk/Source/WebCore/dom/SelectorQuery.h        2016-01-15 20:01:42 UTC (rev 195141)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> #include &quot;CSSSelectorList.h&quot;
</span><span class="cx"> #include &quot;NodeList.h&quot;
</span><span class="cx"> #include &quot;SelectorCompiler.h&quot;
</span><ins>+#include &lt;wtf/BumpArena.h&gt;
</ins><span class="cx"> #include &lt;wtf/HashMap.h&gt;
</span><span class="cx"> #include &lt;wtf/Vector.h&gt;
</span><span class="cx"> #include &lt;wtf/text/AtomicStringHash.h&gt;
</span><span class="lines">@@ -132,10 +133,12 @@
</span><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> 
</span><span class="cx"> public:
</span><ins>+    SelectorQueryCache();
</ins><span class="cx">     SelectorQuery* add(const String&amp;, Document&amp;, ExceptionCode&amp;);
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     HashMap&lt;String, std::unique_ptr&lt;SelectorQuery&gt;&gt; m_entries;
</span><ins>+    Ref&lt;BumpArena&gt; m_arena;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> inline bool SelectorQuery::matches(Element&amp; element) const
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGFontFaceElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGFontFaceElement.cpp (195140 => 195141)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGFontFaceElement.cpp        2016-01-15 19:55:19 UTC (rev 195140)
+++ trunk/Source/WebCore/svg/SVGFontFaceElement.cpp        2016-01-15 20:01:42 UTC (rev 195141)
</span><span class="lines">@@ -49,7 +49,7 @@
</span><span class="cx"> 
</span><span class="cx"> inline SVGFontFaceElement::SVGFontFaceElement(const QualifiedName&amp; tagName, Document&amp; document)
</span><span class="cx">     : SVGElement(tagName, document)
</span><del>-    , m_fontFaceRule(StyleRuleFontFace::create(MutableStyleProperties::create(CSSStrictMode)))
</del><ins>+    , m_fontFaceRule(StyleRuleFontFace::create(nullptr, MutableStyleProperties::create(CSSStrictMode)))
</ins><span class="cx">     , m_fontElement(nullptr)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(hasTagName(font_faceTag));
</span></span></pre>
</div>
</div>

</body>
</html>