<!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>[164185] trunk</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/164185">164185</a></dd>
<dt>Author</dt> <dd>fpizlo@apple.com</dd>
<dt>Date</dt> <dd>2014-02-15 18:54:26 -0800 (Sat, 15 Feb 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Vector with inline capacity should work with non-PODs
https://bugs.webkit.org/show_bug.cgi?id=128864

Source/JavaScriptCore: 

Reviewed by Michael Saboff.
        
Deques no longer have inline capacity because it was broken, and we didn't need it
here anyway.

* dfg/DFGWorklist.h:

Source/WebCore: 

Reviewed by Michael Saboff.

No new tests because no change behavior.
        
Deques no longer have inline capacity because it was broken, and we didn't need it
here anyway.

* page/WheelEventDeltaTracker.h:

Source/WTF: 

Reviewed by Michael Saboff.
        
Previously, we would copy the inline storage of a vector as if it was a bag of bits.
This presumed that the element type was relocatable. In general this is only true for
PODs.
        
This patch changes this by introducing a swap operation over inline storage. This swap
operation requires being told about the size that is in use.
        
Deques would have required some cleverness to make this work, because the swap
operation needs to know which subset of elements are in-use and assumes that a size is
sufficient for this. That's not true for deques. Instead of trying to do very clever
things, I just removed the inline capacity option from Deque. I believe that this is
fine since there are only two users of Deque with inline capacity, and both of them
appear to be allocated rarely enough that inline capacity probably doesn't help much.

* wtf/Deque.h:
(WTF::DequeIterator::DequeIterator):
(WTF::DequeConstIterator::DequeConstIterator):
(WTF::Deque&lt;T&gt;::checkValidity):
(WTF::Deque&lt;T&gt;::checkIndexValidity):
(WTF::Deque&lt;T&gt;::invalidateIterators):
(WTF::Deque&lt;T&gt;::Deque):
(WTF::=):
(WTF::Deque&lt;T&gt;::destroyAll):
(WTF::Deque&lt;T&gt;::~Deque):
(WTF::Deque&lt;T&gt;::swap):
(WTF::Deque&lt;T&gt;::clear):
(WTF::Deque&lt;T&gt;::expandCapacityIfNeeded):
(WTF::Deque&lt;T&gt;::expandCapacity):
(WTF::Deque&lt;T&gt;::append):
(WTF::Deque&lt;T&gt;::prepend):
(WTF::Deque&lt;T&gt;::removeFirst):
(WTF::Deque&lt;T&gt;::removeLast):
(WTF::Deque&lt;T&gt;::remove):
(WTF::DequeIteratorBase&lt;T&gt;::checkValidity):
(WTF::DequeIteratorBase&lt;T&gt;::addToIteratorsList):
(WTF::DequeIteratorBase&lt;T&gt;::removeFromIteratorsList):
(WTF::DequeIteratorBase&lt;T&gt;::DequeIteratorBase):
(WTF::DequeIteratorBase&lt;T&gt;::~DequeIteratorBase):
(WTF::DequeIteratorBase&lt;T&gt;::isEqual):
(WTF::DequeIteratorBase&lt;T&gt;::increment):
(WTF::DequeIteratorBase&lt;T&gt;::decrement):
(WTF::DequeIteratorBase&lt;T&gt;::after):
(WTF::DequeIteratorBase&lt;T&gt;::before):
* wtf/Vector.h:
(WTF::VectorBuffer::swap):
(WTF::VectorBuffer::swapInlineBuffer):
(WTF::VectorBuffer::swapInlineBuffers):
(WTF::Vector::swap):

Tools: 

Reviewed by Michael Saboff.
        
This test experiences really bizarre behavior on trunk without the rest of
this fix. On my machine, it usually times out because it gets itself into an
infinite loop of some kind. With the fix, it passes.

* TestWebKitAPI/Tests/WTF/Vector.cpp:
(TestWebKitAPI::TEST):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGWorklisth">trunk/Source/JavaScriptCore/dfg/DFGWorklist.h</a></li>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFwtfDequeh">trunk/Source/WTF/wtf/Deque.h</a></li>
<li><a href="#trunkSourceWTFwtfVectorh">trunk/Source/WTF/wtf/Vector.h</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorepageWheelEventDeltaTrackerh">trunk/Source/WebCore/page/WheelEventDeltaTracker.h</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWTFVectorcpp">trunk/Tools/TestWebKitAPI/Tests/WTF/Vector.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (164184 => 164185)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2014-02-16 02:01:04 UTC (rev 164184)
+++ trunk/Source/JavaScriptCore/ChangeLog        2014-02-16 02:54:26 UTC (rev 164185)
</span><span class="lines">@@ -1,5 +1,17 @@
</span><span class="cx"> 2014-02-15  Filip Pizlo  &lt;fpizlo@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Vector with inline capacity should work with non-PODs
+        https://bugs.webkit.org/show_bug.cgi?id=128864
+
+        Reviewed by Michael Saboff.
+        
+        Deques no longer have inline capacity because it was broken, and we didn't need it
+        here anyway.
+
+        * dfg/DFGWorklist.h:
+
+2014-02-15  Filip Pizlo  &lt;fpizlo@apple.com&gt;
+
</ins><span class="cx">         Unreviewed, roll out r164166.
</span><span class="cx"> 
</span><span class="cx">         This broke three unique tests:
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGWorklisth"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGWorklist.h (164184 => 164185)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGWorklist.h        2014-02-16 02:01:04 UTC (rev 164184)
+++ trunk/Source/JavaScriptCore/dfg/DFGWorklist.h        2014-02-16 02:54:26 UTC (rev 164185)
</span><span class="lines">@@ -89,7 +89,7 @@
</span><span class="cx">     void dump(const MutexLocker&amp;, PrintStream&amp;) const;
</span><span class="cx"> 
</span><span class="cx">     // Used to inform the thread about what work there is left to do.
</span><del>-    Deque&lt;RefPtr&lt;Plan&gt;, 16&gt; m_queue;
</del><ins>+    Deque&lt;RefPtr&lt;Plan&gt;&gt; m_queue;
</ins><span class="cx">     
</span><span class="cx">     // Used to answer questions about the current state of a code block. This
</span><span class="cx">     // is particularly great for the cti_optimize OSR slow path, which wants
</span></span></pre></div>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (164184 => 164185)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog        2014-02-16 02:01:04 UTC (rev 164184)
+++ trunk/Source/WTF/ChangeLog        2014-02-16 02:54:26 UTC (rev 164185)
</span><span class="lines">@@ -1,3 +1,59 @@
</span><ins>+2014-02-15  Filip Pizlo  &lt;fpizlo@apple.com&gt;
+
+        Vector with inline capacity should work with non-PODs
+        https://bugs.webkit.org/show_bug.cgi?id=128864
+
+        Reviewed by Michael Saboff.
+        
+        Previously, we would copy the inline storage of a vector as if it was a bag of bits.
+        This presumed that the element type was relocatable. In general this is only true for
+        PODs.
+        
+        This patch changes this by introducing a swap operation over inline storage. This swap
+        operation requires being told about the size that is in use.
+        
+        Deques would have required some cleverness to make this work, because the swap
+        operation needs to know which subset of elements are in-use and assumes that a size is
+        sufficient for this. That's not true for deques. Instead of trying to do very clever
+        things, I just removed the inline capacity option from Deque. I believe that this is
+        fine since there are only two users of Deque with inline capacity, and both of them
+        appear to be allocated rarely enough that inline capacity probably doesn't help much.
+
+        * wtf/Deque.h:
+        (WTF::DequeIterator::DequeIterator):
+        (WTF::DequeConstIterator::DequeConstIterator):
+        (WTF::Deque&lt;T&gt;::checkValidity):
+        (WTF::Deque&lt;T&gt;::checkIndexValidity):
+        (WTF::Deque&lt;T&gt;::invalidateIterators):
+        (WTF::Deque&lt;T&gt;::Deque):
+        (WTF::=):
+        (WTF::Deque&lt;T&gt;::destroyAll):
+        (WTF::Deque&lt;T&gt;::~Deque):
+        (WTF::Deque&lt;T&gt;::swap):
+        (WTF::Deque&lt;T&gt;::clear):
+        (WTF::Deque&lt;T&gt;::expandCapacityIfNeeded):
+        (WTF::Deque&lt;T&gt;::expandCapacity):
+        (WTF::Deque&lt;T&gt;::append):
+        (WTF::Deque&lt;T&gt;::prepend):
+        (WTF::Deque&lt;T&gt;::removeFirst):
+        (WTF::Deque&lt;T&gt;::removeLast):
+        (WTF::Deque&lt;T&gt;::remove):
+        (WTF::DequeIteratorBase&lt;T&gt;::checkValidity):
+        (WTF::DequeIteratorBase&lt;T&gt;::addToIteratorsList):
+        (WTF::DequeIteratorBase&lt;T&gt;::removeFromIteratorsList):
+        (WTF::DequeIteratorBase&lt;T&gt;::DequeIteratorBase):
+        (WTF::DequeIteratorBase&lt;T&gt;::~DequeIteratorBase):
+        (WTF::DequeIteratorBase&lt;T&gt;::isEqual):
+        (WTF::DequeIteratorBase&lt;T&gt;::increment):
+        (WTF::DequeIteratorBase&lt;T&gt;::decrement):
+        (WTF::DequeIteratorBase&lt;T&gt;::after):
+        (WTF::DequeIteratorBase&lt;T&gt;::before):
+        * wtf/Vector.h:
+        (WTF::VectorBuffer::swap):
+        (WTF::VectorBuffer::swapInlineBuffer):
+        (WTF::VectorBuffer::swapInlineBuffers):
+        (WTF::Vector::swap):
+
</ins><span class="cx"> 2014-02-15  Mikhail Pozdnyakov  &lt;mikhail.pozdnyakov@intel.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Remove 'static' specifier from free inline functions in StringImpl.h
</span></span></pre></div>
<a id="trunkSourceWTFwtfDequeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/Deque.h (164184 => 164185)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/Deque.h        2014-02-16 02:01:04 UTC (rev 164184)
+++ trunk/Source/WTF/wtf/Deque.h        2014-02-16 02:54:26 UTC (rev 164185)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2007, 2008, 2014 Apple Inc. All rights reserved.
</ins><span class="cx">  * Copyright (C) 2009 Google Inc. All rights reserved.
</span><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="lines">@@ -38,25 +38,25 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WTF {
</span><span class="cx"> 
</span><del>-    template&lt;typename T, size_t inlineCapacity&gt; class DequeIteratorBase;
-    template&lt;typename T, size_t inlineCapacity&gt; class DequeIterator;
-    template&lt;typename T, size_t inlineCapacity&gt; class DequeConstIterator;
</del><ins>+    template&lt;typename T&gt; class DequeIteratorBase;
+    template&lt;typename T&gt; class DequeIterator;
+    template&lt;typename T&gt; class DequeConstIterator;
</ins><span class="cx"> 
</span><del>-    template&lt;typename T, size_t inlineCapacity = 0&gt;
</del><ins>+    template&lt;typename T&gt;
</ins><span class="cx">     class Deque {
</span><span class="cx">         WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx">     public:
</span><del>-        typedef DequeIterator&lt;T, inlineCapacity&gt; iterator;
-        typedef DequeConstIterator&lt;T, inlineCapacity&gt; const_iterator;
</del><ins>+        typedef DequeIterator&lt;T&gt; iterator;
+        typedef DequeConstIterator&lt;T&gt; const_iterator;
</ins><span class="cx">         typedef std::reverse_iterator&lt;iterator&gt; reverse_iterator;
</span><span class="cx">         typedef std::reverse_iterator&lt;const_iterator&gt; const_reverse_iterator;
</span><span class="cx"> 
</span><span class="cx">         Deque();
</span><del>-        Deque(const Deque&lt;T, inlineCapacity&gt;&amp;);
-        Deque&amp; operator=(const Deque&lt;T, inlineCapacity&gt;&amp;);
</del><ins>+        Deque(const Deque&lt;T&gt;&amp;);
+        Deque&amp; operator=(const Deque&lt;T&gt;&amp;);
</ins><span class="cx">         ~Deque();
</span><span class="cx"> 
</span><del>-        void swap(Deque&lt;T, inlineCapacity&gt;&amp;);
</del><ins>+        void swap(Deque&lt;T&gt;&amp;);
</ins><span class="cx"> 
</span><span class="cx">         size_t size() const { return m_start &lt;= m_end ? m_end - m_start : m_end + m_buffer.capacity() - m_start; }
</span><span class="cx">         bool isEmpty() const { return m_start == m_end; }
</span><span class="lines">@@ -91,11 +91,11 @@
</span><span class="cx">         iterator findIf(Predicate&amp;&amp;);
</span><span class="cx"> 
</span><span class="cx">     private:
</span><del>-        friend class DequeIteratorBase&lt;T, inlineCapacity&gt;;
</del><ins>+        friend class DequeIteratorBase&lt;T&gt;;
</ins><span class="cx"> 
</span><del>-        typedef VectorBuffer&lt;T, inlineCapacity&gt; Buffer;
</del><ins>+        typedef VectorBuffer&lt;T, 0&gt; Buffer;
</ins><span class="cx">         typedef VectorTypeOperations&lt;T&gt; TypeOperations;
</span><del>-        typedef DequeIteratorBase&lt;T, inlineCapacity&gt; IteratorBase;
</del><ins>+        typedef DequeIteratorBase&lt;T&gt; IteratorBase;
</ins><span class="cx"> 
</span><span class="cx">         void remove(size_t position);
</span><span class="cx">         void invalidateIterators();
</span><span class="lines">@@ -113,11 +113,11 @@
</span><span class="cx"> #endif
</span><span class="cx">     };
</span><span class="cx"> 
</span><del>-    template&lt;typename T, size_t inlineCapacity = 0&gt;
</del><ins>+    template&lt;typename T&gt;
</ins><span class="cx">     class DequeIteratorBase {
</span><span class="cx">     protected:
</span><span class="cx">         DequeIteratorBase();
</span><del>-        DequeIteratorBase(const Deque&lt;T, inlineCapacity&gt;*, size_t);
</del><ins>+        DequeIteratorBase(const Deque&lt;T&gt;*, size_t);
</ins><span class="cx">         DequeIteratorBase(const DequeIteratorBase&amp;);
</span><span class="cx">         DequeIteratorBase&amp; operator=(const DequeIteratorBase&amp;);
</span><span class="cx">         ~DequeIteratorBase();
</span><span class="lines">@@ -138,10 +138,10 @@
</span><span class="cx">         void checkValidity() const;
</span><span class="cx">         void checkValidity(const DequeIteratorBase&amp;) const;
</span><span class="cx"> 
</span><del>-        Deque&lt;T, inlineCapacity&gt;* m_deque;
</del><ins>+        Deque&lt;T&gt;* m_deque;
</ins><span class="cx">         size_t m_index;
</span><span class="cx"> 
</span><del>-        friend class Deque&lt;T, inlineCapacity&gt;;
</del><ins>+        friend class Deque&lt;T&gt;;
</ins><span class="cx"> 
</span><span class="cx"> #ifndef NDEBUG
</span><span class="cx">         mutable DequeIteratorBase* m_next;
</span><span class="lines">@@ -149,11 +149,11 @@
</span><span class="cx"> #endif
</span><span class="cx">     };
</span><span class="cx"> 
</span><del>-    template&lt;typename T, size_t inlineCapacity = 0&gt;
-    class DequeIterator : public DequeIteratorBase&lt;T, inlineCapacity&gt; {
</del><ins>+    template&lt;typename T&gt;
+    class DequeIterator : public DequeIteratorBase&lt;T&gt; {
</ins><span class="cx">     private:
</span><del>-        typedef DequeIteratorBase&lt;T, inlineCapacity&gt; Base;
-        typedef DequeIterator&lt;T, inlineCapacity&gt; Iterator;
</del><ins>+        typedef DequeIteratorBase&lt;T&gt; Base;
+        typedef DequeIterator&lt;T&gt; Iterator;
</ins><span class="cx"> 
</span><span class="cx">     public:
</span><span class="cx">         typedef ptrdiff_t difference_type;
</span><span class="lines">@@ -162,7 +162,7 @@
</span><span class="cx">         typedef T&amp; reference;
</span><span class="cx">         typedef std::bidirectional_iterator_tag iterator_category;
</span><span class="cx"> 
</span><del>-        DequeIterator(Deque&lt;T, inlineCapacity&gt;* deque, size_t index) : Base(deque, index) { }
</del><ins>+        DequeIterator(Deque&lt;T&gt;* deque, size_t index) : Base(deque, index) { }
</ins><span class="cx"> 
</span><span class="cx">         DequeIterator(const Iterator&amp; other) : Base(other) { }
</span><span class="cx">         DequeIterator&amp; operator=(const Iterator&amp; other) { Base::assign(other); return *this; }
</span><span class="lines">@@ -179,12 +179,12 @@
</span><span class="cx">         // postfix -- intentionally omitted
</span><span class="cx">     };
</span><span class="cx"> 
</span><del>-    template&lt;typename T, size_t inlineCapacity = 0&gt;
-    class DequeConstIterator : public DequeIteratorBase&lt;T, inlineCapacity&gt; {
</del><ins>+    template&lt;typename T&gt;
+    class DequeConstIterator : public DequeIteratorBase&lt;T&gt; {
</ins><span class="cx">     private:
</span><del>-        typedef DequeIteratorBase&lt;T, inlineCapacity&gt; Base;
-        typedef DequeConstIterator&lt;T, inlineCapacity&gt; Iterator;
-        typedef DequeIterator&lt;T, inlineCapacity&gt; NonConstIterator;
</del><ins>+        typedef DequeIteratorBase&lt;T&gt; Base;
+        typedef DequeConstIterator&lt;T&gt; Iterator;
+        typedef DequeIterator&lt;T&gt; NonConstIterator;
</ins><span class="cx"> 
</span><span class="cx">     public:
</span><span class="cx">         typedef ptrdiff_t difference_type;
</span><span class="lines">@@ -193,7 +193,7 @@
</span><span class="cx">         typedef const T&amp; reference;
</span><span class="cx">         typedef std::bidirectional_iterator_tag iterator_category;
</span><span class="cx"> 
</span><del>-        DequeConstIterator(const Deque&lt;T, inlineCapacity&gt;* deque, size_t index) : Base(deque, index) { }
</del><ins>+        DequeConstIterator(const Deque&lt;T&gt;* deque, size_t index) : Base(deque, index) { }
</ins><span class="cx"> 
</span><span class="cx">         DequeConstIterator(const Iterator&amp; other) : Base(other) { }
</span><span class="cx">         DequeConstIterator(const NonConstIterator&amp; other) : Base(other) { }
</span><span class="lines">@@ -213,12 +213,12 @@
</span><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx"> #ifdef NDEBUG
</span><del>-    template&lt;typename T, size_t inlineCapacity&gt; inline void Deque&lt;T, inlineCapacity&gt;::checkValidity() const { }
-    template&lt;typename T, size_t inlineCapacity&gt; inline void Deque&lt;T, inlineCapacity&gt;::checkIndexValidity(size_t) const { }
-    template&lt;typename T, size_t inlineCapacity&gt; inline void Deque&lt;T, inlineCapacity&gt;::invalidateIterators() { }
</del><ins>+    template&lt;typename T&gt; inline void Deque&lt;T&gt;::checkValidity() const { }
+    template&lt;typename T&gt; inline void Deque&lt;T&gt;::checkIndexValidity(size_t) const { }
+    template&lt;typename T&gt; inline void Deque&lt;T&gt;::invalidateIterators() { }
</ins><span class="cx"> #else
</span><del>-    template&lt;typename T, size_t inlineCapacity&gt;
-    void Deque&lt;T, inlineCapacity&gt;::checkValidity() const
</del><ins>+    template&lt;typename T&gt;
+    void Deque&lt;T&gt;::checkValidity() const
</ins><span class="cx">     {
</span><span class="cx">         // In this implementation a capacity of 1 would confuse append() and
</span><span class="cx">         // other places that assume the index after capacity - 1 is 0.
</span><span class="lines">@@ -233,8 +233,8 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    template&lt;typename T, size_t inlineCapacity&gt;
-    void Deque&lt;T, inlineCapacity&gt;::checkIndexValidity(size_t index) const
</del><ins>+    template&lt;typename T&gt;
+    void Deque&lt;T&gt;::checkIndexValidity(size_t index) const
</ins><span class="cx">     {
</span><span class="cx">         ASSERT_UNUSED(index, index &lt;= m_buffer.capacity());
</span><span class="cx">         if (m_start &lt;= m_end) {
</span><span class="lines">@@ -245,8 +245,8 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    template&lt;typename T, size_t inlineCapacity&gt;
-    void Deque&lt;T, inlineCapacity&gt;::invalidateIterators()
</del><ins>+    template&lt;typename T&gt;
+    void Deque&lt;T&gt;::invalidateIterators()
</ins><span class="cx">     {
</span><span class="cx">         IteratorBase* next;
</span><span class="cx">         for (IteratorBase* p = m_iterators; p; p = next) {
</span><span class="lines">@@ -259,8 +259,8 @@
</span><span class="cx">     }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    template&lt;typename T, size_t inlineCapacity&gt;
-    inline Deque&lt;T, inlineCapacity&gt;::Deque()
</del><ins>+    template&lt;typename T&gt;
+    inline Deque&lt;T&gt;::Deque()
</ins><span class="cx">         : m_start(0)
</span><span class="cx">         , m_end(0)
</span><span class="cx"> #ifndef NDEBUG
</span><span class="lines">@@ -270,8 +270,8 @@
</span><span class="cx">         checkValidity();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    template&lt;typename T, size_t inlineCapacity&gt;
-    inline Deque&lt;T, inlineCapacity&gt;::Deque(const Deque&lt;T, inlineCapacity&gt;&amp; other)
</del><ins>+    template&lt;typename T&gt;
+    inline Deque&lt;T&gt;::Deque(const Deque&lt;T&gt;&amp; other)
</ins><span class="cx">         : m_start(other.m_start)
</span><span class="cx">         , m_end(other.m_end)
</span><span class="cx">         , m_buffer(other.m_buffer.capacity())
</span><span class="lines">@@ -288,8 +288,8 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    template&lt;typename T, size_t inlineCapacity&gt;
-    inline Deque&lt;T, inlineCapacity&gt;&amp; Deque&lt;T, inlineCapacity&gt;::operator=(const Deque&lt;T, inlineCapacity&gt;&amp; other)
</del><ins>+    template&lt;typename T&gt;
+    inline Deque&lt;T&gt;&amp; Deque&lt;T&gt;::operator=(const Deque&lt;T&gt;&amp; other)
</ins><span class="cx">     {
</span><span class="cx">         // FIXME: This is inefficient if we're using an inline buffer and T is
</span><span class="cx">         // expensive to copy since it will copy the buffer twice instead of once.
</span><span class="lines">@@ -298,8 +298,8 @@
</span><span class="cx">         return *this;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    template&lt;typename T, size_t inlineCapacity&gt;
-    inline void Deque&lt;T, inlineCapacity&gt;::destroyAll()
</del><ins>+    template&lt;typename T&gt;
+    inline void Deque&lt;T&gt;::destroyAll()
</ins><span class="cx">     {
</span><span class="cx">         if (m_start &lt;= m_end)
</span><span class="cx">             TypeOperations::destruct(m_buffer.buffer() + m_start, m_buffer.buffer() + m_end);
</span><span class="lines">@@ -309,29 +309,29 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    template&lt;typename T, size_t inlineCapacity&gt;
-    inline Deque&lt;T, inlineCapacity&gt;::~Deque()
</del><ins>+    template&lt;typename T&gt;
+    inline Deque&lt;T&gt;::~Deque()
</ins><span class="cx">     {
</span><span class="cx">         checkValidity();
</span><span class="cx">         invalidateIterators();
</span><span class="cx">         destroyAll();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    template&lt;typename T, size_t inlineCapacity&gt;
-    inline void Deque&lt;T, inlineCapacity&gt;::swap(Deque&lt;T, inlineCapacity&gt;&amp; other)
</del><ins>+    template&lt;typename T&gt;
+    inline void Deque&lt;T&gt;::swap(Deque&lt;T&gt;&amp; other)
</ins><span class="cx">     {
</span><span class="cx">         checkValidity();
</span><span class="cx">         other.checkValidity();
</span><span class="cx">         invalidateIterators();
</span><span class="cx">         std::swap(m_start, other.m_start);
</span><span class="cx">         std::swap(m_end, other.m_end);
</span><del>-        m_buffer.swap(other.m_buffer);
</del><ins>+        m_buffer.swap(other.m_buffer, 0, 0);
</ins><span class="cx">         checkValidity();
</span><span class="cx">         other.checkValidity();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    template&lt;typename T, size_t inlineCapacity&gt;
-    inline void Deque&lt;T, inlineCapacity&gt;::clear()
</del><ins>+    template&lt;typename T&gt;
+    inline void Deque&lt;T&gt;::clear()
</ins><span class="cx">     {
</span><span class="cx">         checkValidity();
</span><span class="cx">         invalidateIterators();
</span><span class="lines">@@ -342,9 +342,9 @@
</span><span class="cx">         checkValidity();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    template&lt;typename T, size_t inlineCapacity&gt;
</del><ins>+    template&lt;typename T&gt;
</ins><span class="cx">     template&lt;typename Predicate&gt;
</span><del>-    inline auto Deque&lt;T, inlineCapacity&gt;::findIf(Predicate&amp;&amp; predicate) -&gt; iterator
</del><ins>+    inline auto Deque&lt;T&gt;::findIf(Predicate&amp;&amp; predicate) -&gt; iterator
</ins><span class="cx">     {
</span><span class="cx">         iterator end_iterator = end();
</span><span class="cx">         for (iterator it = begin(); it != end_iterator; ++it) {
</span><span class="lines">@@ -354,8 +354,8 @@
</span><span class="cx">         return end_iterator;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    template&lt;typename T, size_t inlineCapacity&gt;
-    inline void Deque&lt;T, inlineCapacity&gt;::expandCapacityIfNeeded()
</del><ins>+    template&lt;typename T&gt;
+    inline void Deque&lt;T&gt;::expandCapacityIfNeeded()
</ins><span class="cx">     {
</span><span class="cx">         if (m_start) {
</span><span class="cx">             if (m_end + 1 != m_start)
</span><span class="lines">@@ -369,8 +369,8 @@
</span><span class="cx">         expandCapacity();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    template&lt;typename T, size_t inlineCapacity&gt;
-    void Deque&lt;T, inlineCapacity&gt;::expandCapacity()
</del><ins>+    template&lt;typename T&gt;
+    void Deque&lt;T&gt;::expandCapacity()
</ins><span class="cx">     {
</span><span class="cx">         checkValidity();
</span><span class="cx">         size_t oldCapacity = m_buffer.capacity();
</span><span class="lines">@@ -388,24 +388,24 @@
</span><span class="cx">         checkValidity();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    template&lt;typename T, size_t inlineCapacity&gt;
-    inline auto Deque&lt;T, inlineCapacity&gt;::takeFirst() -&gt; T
</del><ins>+    template&lt;typename T&gt;
+    inline auto Deque&lt;T&gt;::takeFirst() -&gt; T
</ins><span class="cx">     {
</span><span class="cx">         T oldFirst = std::move(first());
</span><span class="cx">         removeFirst();
</span><span class="cx">         return oldFirst;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    template&lt;typename T, size_t inlineCapacity&gt;
-    inline auto Deque&lt;T, inlineCapacity&gt;::takeLast() -&gt; T
</del><ins>+    template&lt;typename T&gt;
+    inline auto Deque&lt;T&gt;::takeLast() -&gt; T
</ins><span class="cx">     {
</span><span class="cx">         T oldLast = std::move(last());
</span><span class="cx">         removeLast();
</span><span class="cx">         return oldLast;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    template&lt;typename T, size_t inlineCapacity&gt; template&lt;typename U&gt;
-    inline void Deque&lt;T, inlineCapacity&gt;::append(U&amp;&amp; value)
</del><ins>+    template&lt;typename T&gt; template&lt;typename U&gt;
+    inline void Deque&lt;T&gt;::append(U&amp;&amp; value)
</ins><span class="cx">     {
</span><span class="cx">         checkValidity();
</span><span class="cx">         expandCapacityIfNeeded();
</span><span class="lines">@@ -417,8 +417,8 @@
</span><span class="cx">         checkValidity();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    template&lt;typename T, size_t inlineCapacity&gt; template&lt;typename U&gt;
-    inline void Deque&lt;T, inlineCapacity&gt;::prepend(U&amp;&amp; value)
</del><ins>+    template&lt;typename T&gt; template&lt;typename U&gt;
+    inline void Deque&lt;T&gt;::prepend(U&amp;&amp; value)
</ins><span class="cx">     {
</span><span class="cx">         checkValidity();
</span><span class="cx">         expandCapacityIfNeeded();
</span><span class="lines">@@ -430,8 +430,8 @@
</span><span class="cx">         checkValidity();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    template&lt;typename T, size_t inlineCapacity&gt;
-    inline void Deque&lt;T, inlineCapacity&gt;::removeFirst()
</del><ins>+    template&lt;typename T&gt;
+    inline void Deque&lt;T&gt;::removeFirst()
</ins><span class="cx">     {
</span><span class="cx">         checkValidity();
</span><span class="cx">         invalidateIterators();
</span><span class="lines">@@ -444,8 +444,8 @@
</span><span class="cx">         checkValidity();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    template&lt;typename T, size_t inlineCapacity&gt;
-    inline void Deque&lt;T, inlineCapacity&gt;::removeLast()
</del><ins>+    template&lt;typename T&gt;
+    inline void Deque&lt;T&gt;::removeLast()
</ins><span class="cx">     {
</span><span class="cx">         checkValidity();
</span><span class="cx">         invalidateIterators();
</span><span class="lines">@@ -458,22 +458,22 @@
</span><span class="cx">         checkValidity();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    template&lt;typename T, size_t inlineCapacity&gt;
-    inline void Deque&lt;T, inlineCapacity&gt;::remove(iterator&amp; it)
</del><ins>+    template&lt;typename T&gt;
+    inline void Deque&lt;T&gt;::remove(iterator&amp; it)
</ins><span class="cx">     {
</span><span class="cx">         it.checkValidity();
</span><span class="cx">         remove(it.m_index);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    template&lt;typename T, size_t inlineCapacity&gt;
-    inline void Deque&lt;T, inlineCapacity&gt;::remove(const_iterator&amp; it)
</del><ins>+    template&lt;typename T&gt;
+    inline void Deque&lt;T&gt;::remove(const_iterator&amp; it)
</ins><span class="cx">     {
</span><span class="cx">         it.checkValidity();
</span><span class="cx">         remove(it.m_index);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    template&lt;typename T, size_t inlineCapacity&gt;
-    inline void Deque&lt;T, inlineCapacity&gt;::remove(size_t position)
</del><ins>+    template&lt;typename T&gt;
+    inline void Deque&lt;T&gt;::remove(size_t position)
</ins><span class="cx">     {
</span><span class="cx">         if (position == m_end)
</span><span class="cx">             return;
</span><span class="lines">@@ -496,28 +496,28 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx"> #ifdef NDEBUG
</span><del>-    template&lt;typename T, size_t inlineCapacity&gt; inline void DequeIteratorBase&lt;T, inlineCapacity&gt;::checkValidity() const { }
-    template&lt;typename T, size_t inlineCapacity&gt; inline void DequeIteratorBase&lt;T, inlineCapacity&gt;::checkValidity(const DequeIteratorBase&lt;T, inlineCapacity&gt;&amp;) const { }
-    template&lt;typename T, size_t inlineCapacity&gt; inline void DequeIteratorBase&lt;T, inlineCapacity&gt;::addToIteratorsList() { }
-    template&lt;typename T, size_t inlineCapacity&gt; inline void DequeIteratorBase&lt;T, inlineCapacity&gt;::removeFromIteratorsList() { }
</del><ins>+    template&lt;typename T&gt; inline void DequeIteratorBase&lt;T&gt;::checkValidity() const { }
+    template&lt;typename T&gt; inline void DequeIteratorBase&lt;T&gt;::checkValidity(const DequeIteratorBase&lt;T&gt;&amp;) const { }
+    template&lt;typename T&gt; inline void DequeIteratorBase&lt;T&gt;::addToIteratorsList() { }
+    template&lt;typename T&gt; inline void DequeIteratorBase&lt;T&gt;::removeFromIteratorsList() { }
</ins><span class="cx"> #else
</span><del>-    template&lt;typename T, size_t inlineCapacity&gt;
-    void DequeIteratorBase&lt;T, inlineCapacity&gt;::checkValidity() const
</del><ins>+    template&lt;typename T&gt;
+    void DequeIteratorBase&lt;T&gt;::checkValidity() const
</ins><span class="cx">     {
</span><span class="cx">         ASSERT(m_deque);
</span><span class="cx">         m_deque-&gt;checkIndexValidity(m_index);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    template&lt;typename T, size_t inlineCapacity&gt;
-    void DequeIteratorBase&lt;T, inlineCapacity&gt;::checkValidity(const DequeIteratorBase&amp; other) const
</del><ins>+    template&lt;typename T&gt;
+    void DequeIteratorBase&lt;T&gt;::checkValidity(const DequeIteratorBase&amp; other) const
</ins><span class="cx">     {
</span><span class="cx">         checkValidity();
</span><span class="cx">         other.checkValidity();
</span><span class="cx">         ASSERT(m_deque == other.m_deque);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    template&lt;typename T, size_t inlineCapacity&gt;
-    void DequeIteratorBase&lt;T, inlineCapacity&gt;::addToIteratorsList()
</del><ins>+    template&lt;typename T&gt;
+    void DequeIteratorBase&lt;T&gt;::addToIteratorsList()
</ins><span class="cx">     {
</span><span class="cx">         if (!m_deque)
</span><span class="cx">             m_next = 0;
</span><span class="lines">@@ -530,8 +530,8 @@
</span><span class="cx">         m_previous = 0;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    template&lt;typename T, size_t inlineCapacity&gt;
-    void DequeIteratorBase&lt;T, inlineCapacity&gt;::removeFromIteratorsList()
</del><ins>+    template&lt;typename T&gt;
+    void DequeIteratorBase&lt;T&gt;::removeFromIteratorsList()
</ins><span class="cx">     {
</span><span class="cx">         if (!m_deque) {
</span><span class="cx">             ASSERT(!m_next);
</span><span class="lines">@@ -555,23 +555,23 @@
</span><span class="cx">     }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    template&lt;typename T, size_t inlineCapacity&gt;
-    inline DequeIteratorBase&lt;T, inlineCapacity&gt;::DequeIteratorBase()
</del><ins>+    template&lt;typename T&gt;
+    inline DequeIteratorBase&lt;T&gt;::DequeIteratorBase()
</ins><span class="cx">         : m_deque(0)
</span><span class="cx">     {
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    template&lt;typename T, size_t inlineCapacity&gt;
-    inline DequeIteratorBase&lt;T, inlineCapacity&gt;::DequeIteratorBase(const Deque&lt;T, inlineCapacity&gt;* deque, size_t index)
-        : m_deque(const_cast&lt;Deque&lt;T, inlineCapacity&gt;*&gt;(deque))
</del><ins>+    template&lt;typename T&gt;
+    inline DequeIteratorBase&lt;T&gt;::DequeIteratorBase(const Deque&lt;T&gt;* deque, size_t index)
+        : m_deque(const_cast&lt;Deque&lt;T&gt;*&gt;(deque))
</ins><span class="cx">         , m_index(index)
</span><span class="cx">     {
</span><span class="cx">         addToIteratorsList();
</span><span class="cx">         checkValidity();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    template&lt;typename T, size_t inlineCapacity&gt;
-    inline DequeIteratorBase&lt;T, inlineCapacity&gt;::DequeIteratorBase(const DequeIteratorBase&amp; other)
</del><ins>+    template&lt;typename T&gt;
+    inline DequeIteratorBase&lt;T&gt;::DequeIteratorBase(const DequeIteratorBase&amp; other)
</ins><span class="cx">         : m_deque(other.m_deque)
</span><span class="cx">         , m_index(other.m_index)
</span><span class="cx">     {
</span><span class="lines">@@ -579,8 +579,8 @@
</span><span class="cx">         checkValidity();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    template&lt;typename T, size_t inlineCapacity&gt;
-    inline DequeIteratorBase&lt;T, inlineCapacity&gt;&amp; DequeIteratorBase&lt;T, inlineCapacity&gt;::operator=(const DequeIteratorBase&amp; other)
</del><ins>+    template&lt;typename T&gt;
+    inline DequeIteratorBase&lt;T&gt;&amp; DequeIteratorBase&lt;T&gt;::operator=(const DequeIteratorBase&amp; other)
</ins><span class="cx">     {
</span><span class="cx">         other.checkValidity();
</span><span class="cx">         removeFromIteratorsList();
</span><span class="lines">@@ -592,8 +592,8 @@
</span><span class="cx">         return *this;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    template&lt;typename T, size_t inlineCapacity&gt;
-    inline DequeIteratorBase&lt;T, inlineCapacity&gt;::~DequeIteratorBase()
</del><ins>+    template&lt;typename T&gt;
+    inline DequeIteratorBase&lt;T&gt;::~DequeIteratorBase()
</ins><span class="cx">     {
</span><span class="cx"> #ifndef NDEBUG
</span><span class="cx">         removeFromIteratorsList();
</span><span class="lines">@@ -601,15 +601,15 @@
</span><span class="cx"> #endif
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    template&lt;typename T, size_t inlineCapacity&gt;
-    inline bool DequeIteratorBase&lt;T, inlineCapacity&gt;::isEqual(const DequeIteratorBase&amp; other) const
</del><ins>+    template&lt;typename T&gt;
+    inline bool DequeIteratorBase&lt;T&gt;::isEqual(const DequeIteratorBase&amp; other) const
</ins><span class="cx">     {
</span><span class="cx">         checkValidity(other);
</span><span class="cx">         return m_index == other.m_index;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    template&lt;typename T, size_t inlineCapacity&gt;
-    inline void DequeIteratorBase&lt;T, inlineCapacity&gt;::increment()
</del><ins>+    template&lt;typename T&gt;
+    inline void DequeIteratorBase&lt;T&gt;::increment()
</ins><span class="cx">     {
</span><span class="cx">         checkValidity();
</span><span class="cx">         ASSERT(m_index != m_deque-&gt;m_end);
</span><span class="lines">@@ -621,8 +621,8 @@
</span><span class="cx">         checkValidity();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    template&lt;typename T, size_t inlineCapacity&gt;
-    inline void DequeIteratorBase&lt;T, inlineCapacity&gt;::decrement()
</del><ins>+    template&lt;typename T&gt;
+    inline void DequeIteratorBase&lt;T&gt;::decrement()
</ins><span class="cx">     {
</span><span class="cx">         checkValidity();
</span><span class="cx">         ASSERT(m_index != m_deque-&gt;m_start);
</span><span class="lines">@@ -634,16 +634,16 @@
</span><span class="cx">         checkValidity();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    template&lt;typename T, size_t inlineCapacity&gt;
-    inline T* DequeIteratorBase&lt;T, inlineCapacity&gt;::after() const
</del><ins>+    template&lt;typename T&gt;
+    inline T* DequeIteratorBase&lt;T&gt;::after() const
</ins><span class="cx">     {
</span><span class="cx">         checkValidity();
</span><span class="cx">         ASSERT(m_index != m_deque-&gt;m_end);
</span><span class="cx">         return &amp;m_deque-&gt;m_buffer.buffer()[m_index];
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    template&lt;typename T, size_t inlineCapacity&gt;
-    inline T* DequeIteratorBase&lt;T, inlineCapacity&gt;::before() const
</del><ins>+    template&lt;typename T&gt;
+    inline T* DequeIteratorBase&lt;T&gt;::before() const
</ins><span class="cx">     {
</span><span class="cx">         checkValidity();
</span><span class="cx">         ASSERT(m_index != m_deque-&gt;m_start);
</span></span></pre></div>
<a id="trunkSourceWTFwtfVectorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/Vector.h (164184 => 164185)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/Vector.h        2014-02-16 02:01:04 UTC (rev 164184)
+++ trunk/Source/WTF/wtf/Vector.h        2014-02-16 02:54:26 UTC (rev 164185)
</span><span class="lines">@@ -374,7 +374,7 @@
</span><span class="cx">         deallocateBuffer(buffer());
</span><span class="cx">     }
</span><span class="cx">     
</span><del>-    void swap(VectorBuffer&lt;T, 0&gt;&amp; other)
</del><ins>+    void swap(VectorBuffer&lt;T, 0&gt;&amp; other, size_t, size_t)
</ins><span class="cx">     {
</span><span class="cx">         std::swap(m_buffer, other.m_buffer);
</span><span class="cx">         std::swap(m_capacity, other.m_capacity);
</span><span class="lines">@@ -464,20 +464,20 @@
</span><span class="cx">         Base::reallocateBuffer(newCapacity);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    void swap(VectorBuffer&amp; other)
</del><ins>+    void swap(VectorBuffer&amp; other, size_t mySize, size_t otherSize)
</ins><span class="cx">     {
</span><span class="cx">         if (buffer() == inlineBuffer() &amp;&amp; other.buffer() == other.inlineBuffer()) {
</span><del>-            std::swap(m_inlineBuffer, other.m_inlineBuffer);
</del><ins>+            swapInlineBuffer(other, mySize, otherSize);
</ins><span class="cx">             std::swap(m_capacity, other.m_capacity);
</span><span class="cx">         } else if (buffer() == inlineBuffer()) {
</span><span class="cx">             m_buffer = other.m_buffer;
</span><span class="cx">             other.m_buffer = other.inlineBuffer();
</span><del>-            std::swap(m_inlineBuffer, other.m_inlineBuffer);
</del><ins>+            swapInlineBuffer(other, mySize, 0);
</ins><span class="cx">             std::swap(m_capacity, other.m_capacity);
</span><span class="cx">         } else if (other.buffer() == other.inlineBuffer()) {
</span><span class="cx">             other.m_buffer = m_buffer;
</span><span class="cx">             m_buffer = inlineBuffer();
</span><del>-            std::swap(m_inlineBuffer, other.m_inlineBuffer);
</del><ins>+            swapInlineBuffer(other, 0, otherSize);
</ins><span class="cx">             std::swap(m_capacity, other.m_capacity);
</span><span class="cx">         } else {
</span><span class="cx">             std::swap(m_buffer, other.m_buffer);
</span><span class="lines">@@ -510,6 +510,32 @@
</span><span class="cx"> private:
</span><span class="cx">     using Base::m_buffer;
</span><span class="cx">     using Base::m_capacity;
</span><ins>+    
+    void swapInlineBuffer(VectorBuffer&amp; other, size_t mySize, size_t otherSize)
+    {
+        // FIXME: We could make swap part of VectorTypeOperations
+        // https://bugs.webkit.org/show_bug.cgi?id=128863
+        
+        if (std::is_pod&lt;T&gt;::value)
+            std::swap(m_inlineBuffer, other.m_inlineBuffer);
+        else
+            swapInlineBuffers(inlineBuffer(), other.inlineBuffer(), mySize, otherSize);
+    }
+    
+    static void swapInlineBuffers(T* left, T* right, size_t leftSize, size_t rightSize)
+    {
+        if (left == right)
+            return;
+        
+        ASSERT(leftSize &lt;= inlineCapacity);
+        ASSERT(rightSize &lt;= inlineCapacity);
+        
+        size_t swapBound = std::min(leftSize, rightSize);
+        for (unsigned i = 0; i &lt; swapBound; ++i)
+            std::swap(left[i], right[i]);
+        VectorTypeOperations&lt;T&gt;::move(left + swapBound, left + leftSize, right + swapBound);
+        VectorTypeOperations&lt;T&gt;::move(right + swapBound, right + rightSize, left + swapBound);
+    }
</ins><span class="cx"> 
</span><span class="cx">     T* inlineBuffer() { return reinterpret_cast_ptr&lt;T*&gt;(m_inlineBuffer); }
</span><span class="cx">     const T* inlineBuffer() const { return reinterpret_cast_ptr&lt;const T*&gt;(m_inlineBuffer); }
</span><span class="lines">@@ -686,8 +712,8 @@
</span><span class="cx"> 
</span><span class="cx">     void swap(Vector&lt;T, inlineCapacity, OverflowHandler&gt;&amp; other)
</span><span class="cx">     {
</span><ins>+        Base::swap(other, m_size, other.m_size);
</ins><span class="cx">         std::swap(m_size, other.m_size);
</span><del>-        Base::swap(other);
</del><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     void reverse();
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (164184 => 164185)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-02-16 02:01:04 UTC (rev 164184)
+++ trunk/Source/WebCore/ChangeLog        2014-02-16 02:54:26 UTC (rev 164185)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2014-02-15  Filip Pizlo  &lt;fpizlo@apple.com&gt;
+
+        Vector with inline capacity should work with non-PODs
+        https://bugs.webkit.org/show_bug.cgi?id=128864
+
+        Reviewed by Michael Saboff.
+
+        No new tests because no change behavior.
+        
+        Deques no longer have inline capacity because it was broken, and we didn't need it
+        here anyway.
+
+        * page/WheelEventDeltaTracker.h:
+
</ins><span class="cx"> 2014-02-15  Andreas Kling  &lt;akling@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Add checked casts for Event.
</span></span></pre></div>
<a id="trunkSourceWebCorepageWheelEventDeltaTrackerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/WheelEventDeltaTracker.h (164184 => 164185)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/WheelEventDeltaTracker.h        2014-02-16 02:01:04 UTC (rev 164184)
+++ trunk/Source/WebCore/page/WheelEventDeltaTracker.h        2014-02-16 02:54:26 UTC (rev 164185)
</span><span class="lines">@@ -56,7 +56,7 @@
</span><span class="cx">     DominantScrollGestureDirection dominantScrollGestureDirection() const;
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    Deque&lt;FloatSize, recentEventCount&gt; m_recentWheelEventDeltas;
</del><ins>+    Deque&lt;FloatSize&gt; m_recentWheelEventDeltas;
</ins><span class="cx">     bool m_isTrackingDeltas;
</span><span class="cx"> 
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (164184 => 164185)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2014-02-16 02:01:04 UTC (rev 164184)
+++ trunk/Tools/ChangeLog        2014-02-16 02:54:26 UTC (rev 164185)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2014-02-15  Filip Pizlo  &lt;fpizlo@apple.com&gt;
+
+        Vector with inline capacity should work with non-PODs
+        https://bugs.webkit.org/show_bug.cgi?id=128864
+
+        Reviewed by Michael Saboff.
+        
+        This test experiences really bizarre behavior on trunk without the rest of
+        this fix. On my machine, it usually times out because it gets itself into an
+        infinite loop of some kind. With the fix, it passes.
+
+        * TestWebKitAPI/Tests/WTF/Vector.cpp:
+        (TestWebKitAPI::TEST):
+
</ins><span class="cx"> 2014-02-15  Ryuan Choi  &lt;ryuan.choi@samsung.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [EFL][WK1] Do not include cairo header in the public headers
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWTFVectorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/Vector.cpp (164184 => 164185)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WTF/Vector.cpp        2014-02-16 02:01:04 UTC (rev 164184)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/Vector.cpp        2014-02-16 02:54:26 UTC (rev 164185)
</span><span class="lines">@@ -216,4 +216,94 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+TEST(WTF_Vector, VectorOfVectorsOfVectorsInlineCapacitySwap)
+{
+    Vector&lt;Vector&lt;Vector&lt;int, 1&gt;, 1&gt;, 1&gt; a;
+    Vector&lt;Vector&lt;Vector&lt;int, 1&gt;, 1&gt;, 1&gt; b;
+    Vector&lt;Vector&lt;Vector&lt;int, 1&gt;, 1&gt;, 1&gt; c;
+    
+    EXPECT_EQ(a.size(), 0U);
+    EXPECT_EQ(b.size(), 0U);
+    EXPECT_EQ(c.size(), 0U);
+    
+    Vector&lt;int, 1&gt; x;
+    x.append(42);
+    
+    EXPECT_EQ(x.size(), 1U);
+    EXPECT_EQ(x[0], 42);
+    
+    Vector&lt;Vector&lt;int, 1&gt;, 1&gt; y;
+    y.append(x);
+    
+    EXPECT_EQ(x.size(), 1U);
+    EXPECT_EQ(x[0], 42);
+    EXPECT_EQ(y.size(), 1U);
+    EXPECT_EQ(y[0].size(), 1U);
+    EXPECT_EQ(y[0][0], 42);
+    
+    a.append(y);
+
+    EXPECT_EQ(x.size(), 1U);
+    EXPECT_EQ(x[0], 42);
+    EXPECT_EQ(y.size(), 1U);
+    EXPECT_EQ(y[0].size(), 1U);
+    EXPECT_EQ(y[0][0], 42);
+    EXPECT_EQ(a.size(), 1U);
+    EXPECT_EQ(a[0].size(), 1U);
+    EXPECT_EQ(a[0][0].size(), 1U);
+    EXPECT_EQ(a[0][0][0], 42);
+    
+    a.swap(b);
+
+    EXPECT_EQ(a.size(), 0U);
+    EXPECT_EQ(x.size(), 1U);
+    EXPECT_EQ(x[0], 42);
+    EXPECT_EQ(y.size(), 1U);
+    EXPECT_EQ(y[0].size(), 1U);
+    EXPECT_EQ(y[0][0], 42);
+    EXPECT_EQ(b.size(), 1U);
+    EXPECT_EQ(b[0].size(), 1U);
+    EXPECT_EQ(b[0][0].size(), 1U);
+    EXPECT_EQ(b[0][0][0], 42);
+    
+    b.swap(c);
+
+    EXPECT_EQ(a.size(), 0U);
+    EXPECT_EQ(b.size(), 0U);
+    EXPECT_EQ(x.size(), 1U);
+    EXPECT_EQ(x[0], 42);
+    EXPECT_EQ(y.size(), 1U);
+    EXPECT_EQ(y[0].size(), 1U);
+    EXPECT_EQ(y[0][0], 42);
+    EXPECT_EQ(c.size(), 1U);
+    EXPECT_EQ(c[0].size(), 1U);
+    EXPECT_EQ(c[0][0].size(), 1U);
+    EXPECT_EQ(c[0][0][0], 42);
+    
+    y[0][0] = 24;
+
+    EXPECT_EQ(x.size(), 1U);
+    EXPECT_EQ(x[0], 42);
+    EXPECT_EQ(y.size(), 1U);
+    EXPECT_EQ(y[0].size(), 1U);
+    EXPECT_EQ(y[0][0], 24);
+    
+    a.append(y);
+
+    EXPECT_EQ(x.size(), 1U);
+    EXPECT_EQ(x[0], 42);
+    EXPECT_EQ(y.size(), 1U);
+    EXPECT_EQ(y[0].size(), 1U);
+    EXPECT_EQ(y[0][0], 24);
+    EXPECT_EQ(a.size(), 1U);
+    EXPECT_EQ(a[0].size(), 1U);
+    EXPECT_EQ(a[0][0].size(), 1U);
+    EXPECT_EQ(a[0][0][0], 24);
+    EXPECT_EQ(c.size(), 1U);
+    EXPECT_EQ(c[0].size(), 1U);
+    EXPECT_EQ(c[0][0].size(), 1U);
+    EXPECT_EQ(c[0][0][0], 42);
+    EXPECT_EQ(b.size(), 0U);
+}
+
</ins><span class="cx"> } // namespace TestWebKitAPI
</span></span></pre>
</div>
</div>

</body>
</html>