<!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>[225368] 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/225368">225368</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2017-11-30 16:14:34 -0800 (Thu, 30 Nov 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>Unreviewed, rolling out <a href="http://trac.webkit.org/projects/webkit/changeset/225362">r225362</a>.
https://bugs.webkit.org/show_bug.cgi?id=180225

removeIf predicate function can touch remove target set
(Requested by yusukesuzuki on #webkit).

Reverted changeset:

"[JSC] Remove easy toRemove & map.remove() use"
https://bugs.webkit.org/show_bug.cgi?id=180208
https://trac.webkit.org/changeset/225362</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreb3B3MoveConstantscpp">trunk/Source/JavaScriptCore/b3/B3MoveConstants.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGArgumentsEliminationPhasecpp">trunk/Source/JavaScriptCore/dfg/DFGArgumentsEliminationPhase.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGObjectAllocationSinkingPhasecpp">trunk/Source/JavaScriptCore/dfg/DFGObjectAllocationSinkingPhase.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmWasmSignaturecpp">trunk/Source/JavaScriptCore/wasm/WasmSignature.cpp</a></li>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFwtfHashMaph">trunk/Source/WTF/wtf/HashMap.h</a></li>
<li><a href="#trunkSourceWTFwtfHashSeth">trunk/Source/WTF/wtf/HashSet.h</a></li>
<li><a href="#trunkSourceWTFwtfHashTableh">trunk/Source/WTF/wtf/HashTable.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (225367 => 225368)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog    2017-12-01 00:11:39 UTC (rev 225367)
+++ trunk/Source/JavaScriptCore/ChangeLog       2017-12-01 00:14:34 UTC (rev 225368)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2017-11-30  Commit Queue  <commit-queue@webkit.org>
+
+        Unreviewed, rolling out r225362.
+        https://bugs.webkit.org/show_bug.cgi?id=180225
+
+        removeIf predicate function can touch remove target set
+        (Requested by yusukesuzuki on #webkit).
+
+        Reverted changeset:
+
+        "[JSC] Remove easy toRemove & map.remove() use"
+        https://bugs.webkit.org/show_bug.cgi?id=180208
+        https://trac.webkit.org/changeset/225362
+
</ins><span class="cx"> 2017-11-30  Yusuke Suzuki  <utatane.tea@gmail.com>
</span><span class="cx"> 
</span><span class="cx">         [JSC] Use AllocatorIfExists for MaterializeNewObject
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreb3B3MoveConstantscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/b3/B3MoveConstants.cpp (225367 => 225368)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/b3/B3MoveConstants.cpp       2017-12-01 00:11:39 UTC (rev 225367)
+++ trunk/Source/JavaScriptCore/b3/B3MoveConstants.cpp  2017-12-01 00:14:34 UTC (rev 225368)
</span><span class="lines">@@ -342,8 +342,10 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     Procedure& m_proc;
</span><ins>+    Vector<Value*> m_toRemove;
</ins><span class="cx">     HashMap<ValueKey, unsigned> m_constTable;
</span><span class="cx">     int64_t* m_dataSection;
</span><ins>+    HashMap<ValueKey, Value*> m_constants;
</ins><span class="cx">     InsertionSet m_insertionSet;
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGArgumentsEliminationPhasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGArgumentsEliminationPhase.cpp (225367 => 225368)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGArgumentsEliminationPhase.cpp 2017-12-01 00:11:39 UTC (rev 225367)
+++ trunk/Source/JavaScriptCore/dfg/DFGArgumentsEliminationPhase.cpp    2017-12-01 00:14:34 UTC (rev 225368)
</span><span class="lines">@@ -192,10 +192,20 @@
</span><span class="cx">     {
</span><span class="cx">         bool changed;
</span><span class="cx">         do {
</span><del>-            changed = m_candidates.removeIf(
-                [&] (Node* candidate) {
-                    return !isStillValidCandidate(candidate);
-                });
</del><ins>+            changed = false;
+            Vector<Node*, 1> toRemove;
+
+            for (Node* candidate : m_candidates) {
+                if (!isStillValidCandidate(candidate))
+                    toRemove.append(candidate);
+            }
+
+            if (toRemove.size()) {
+                changed = true;
+                for (Node* node : toRemove)
+                    m_candidates.remove(node);
+            }
+
</ins><span class="cx">         } while (changed);
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGObjectAllocationSinkingPhasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGObjectAllocationSinkingPhase.cpp (225367 => 225368)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGObjectAllocationSinkingPhase.cpp      2017-12-01 00:11:39 UTC (rev 225367)
+++ trunk/Source/JavaScriptCore/dfg/DFGObjectAllocationSinkingPhase.cpp 2017-12-01 00:14:34 UTC (rev 225368)
</span><span class="lines">@@ -507,10 +507,14 @@
</span><span class="cx"> 
</span><span class="cx">     void pruneByLiveness(const NodeSet& live)
</span><span class="cx">     {
</span><del>-        m_pointers.removeIf(
-            [&] (const auto& entry) {
-                return !live.contains(entry.key);
-            });
</del><ins>+        Vector<Node*> toRemove;
+        for (const auto& entry : m_pointers) {
+            if (!live.contains(entry.key))
+                toRemove.append(entry.key);
+        }
+        for (Node* node : toRemove)
+            m_pointers.remove(node);
+
</ins><span class="cx">         prune();
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -678,10 +682,15 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         // Remove unreachable allocations
</span><del>-        m_allocations.removeIf(
-            [&] (const auto& entry) {
-                return !reachable.contains(entry.key);
-            });
</del><ins>+        {
+            Vector<Node*> toRemove;
+            for (const auto& entry : m_allocations) {
+                if (!reachable.contains(entry.key))
+                    toRemove.append(entry.key);
+            }
+            for (Node* identifier : toRemove)
+                m_allocations.remove(identifier);
+        }
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     bool m_reached = false;
</span><span class="lines">@@ -1240,10 +1249,14 @@
</span><span class="cx">     {
</span><span class="cx">         // We don't create materializations if the escapee is not a
</span><span class="cx">         // sink candidate
</span><del>-        escapees.removeIf(
-            [&] (const auto& entry) {
-                return !m_sinkCandidates.contains(entry.key);
-            });
</del><ins>+        Vector<Node*> toRemove;
+        for (const auto& entry : escapees) {
+            if (!m_sinkCandidates.contains(entry.key))
+                toRemove.append(entry.key);
+        }
+        for (Node* identifier : toRemove)
+            escapees.remove(identifier);
+
</ins><span class="cx">         if (escapees.isEmpty())
</span><span class="cx">             return;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmWasmSignaturecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/WasmSignature.cpp (225367 => 225368)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/WasmSignature.cpp       2017-12-01 00:11:39 UTC (rev 225367)
+++ trunk/Source/JavaScriptCore/wasm/WasmSignature.cpp  2017-12-01 00:14:34 UTC (rev 225368)
</span><span class="lines">@@ -144,18 +144,20 @@
</span><span class="cx">     SignatureInformation& info = singleton();
</span><span class="cx">     LockHolder lock(info.m_lock);
</span><span class="cx"> 
</span><del>-    info.m_indexMap.removeIf(
-        [&] (const auto& pair) {
-            const Ref<Signature>& signature = pair.value;
-            if (signature->refCount() == 1) {
-                // We're the only owner.
-                bool removed = info.m_signatureMap.remove(SignatureHash { signature.ptr() });
-                ASSERT_UNUSED(removed, removed);
-                return true;
-            }
-            return false;
-        });
-
</del><ins>+    Vector<std::pair<SignatureIndex, Signature*>> toRemove;
+    for (const auto& pair : info.m_indexMap) {
+        const Ref<Signature>& signature = pair.value;
+        if (signature->refCount() == 1) {
+            // We're the only owner.
+            toRemove.append(std::make_pair(pair.key, signature.ptr()));
+        }
+    }
+    for (const auto& pair : toRemove) {
+        bool removed = info.m_signatureMap.remove(SignatureHash { pair.second });
+        ASSERT_UNUSED(removed, removed);
+        removed = info.m_indexMap.remove(pair.first);
+        ASSERT_UNUSED(removed, removed);
+    }
</ins><span class="cx">     if (info.m_signatureMap.isEmpty()) {
</span><span class="cx">         ASSERT(info.m_indexMap.isEmpty());
</span><span class="cx">         info.m_nextIndex = Signature::firstValidIndex;
</span></span></pre></div>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (225367 => 225368)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog       2017-12-01 00:11:39 UTC (rev 225367)
+++ trunk/Source/WTF/ChangeLog  2017-12-01 00:14:34 UTC (rev 225368)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2017-11-30  Commit Queue  <commit-queue@webkit.org>
+
+        Unreviewed, rolling out r225362.
+        https://bugs.webkit.org/show_bug.cgi?id=180225
+
+        removeIf predicate function can touch remove target set
+        (Requested by yusukesuzuki on #webkit).
+
+        Reverted changeset:
+
+        "[JSC] Remove easy toRemove & map.remove() use"
+        https://bugs.webkit.org/show_bug.cgi?id=180208
+        https://trac.webkit.org/changeset/225362
+
</ins><span class="cx"> 2017-11-30  Mark Lam  <mark.lam@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Let's scramble MacroAssemblerCodePtr values.
</span></span></pre></div>
<a id="trunkSourceWTFwtfHashMaph"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/HashMap.h (225367 => 225368)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/HashMap.h   2017-12-01 00:11:39 UTC (rev 225367)
+++ trunk/Source/WTF/wtf/HashMap.h      2017-12-01 00:14:34 UTC (rev 225368)
</span><span class="lines">@@ -135,7 +135,7 @@
</span><span class="cx">     bool remove(const KeyType&);
</span><span class="cx">     bool remove(iterator);
</span><span class="cx">     template<typename Functor>
</span><del>-    bool removeIf(Functor&&);
</del><ins>+    void removeIf(Functor&&);
</ins><span class="cx">     void clear();
</span><span class="cx"> 
</span><span class="cx">     MappedTakeType take(const KeyType&); // efficient combination of get with remove
</span><span class="lines">@@ -443,9 +443,9 @@
</span><span class="cx"> 
</span><span class="cx"> template<typename T, typename U, typename V, typename W, typename X>
</span><span class="cx"> template<typename Functor>
</span><del>-inline bool HashMap<T, U, V, W, X>::removeIf(Functor&& functor)
</del><ins>+inline void HashMap<T, U, V, W, X>::removeIf(Functor&& functor)
</ins><span class="cx"> {
</span><del>-    return m_impl.removeIf(std::forward<Functor>(functor));
</del><ins>+    m_impl.removeIf(std::forward<Functor>(functor));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> template<typename T, typename U, typename V, typename W, typename X>
</span></span></pre></div>
<a id="trunkSourceWTFwtfHashSeth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/HashSet.h (225367 => 225368)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/HashSet.h   2017-12-01 00:11:39 UTC (rev 225367)
+++ trunk/Source/WTF/wtf/HashSet.h      2017-12-01 00:14:34 UTC (rev 225368)
</span><span class="lines">@@ -105,7 +105,7 @@
</span><span class="cx">     bool remove(const ValueType&);
</span><span class="cx">     bool remove(iterator);
</span><span class="cx">     template<typename Functor>
</span><del>-    bool removeIf(const Functor&);
</del><ins>+    void removeIf(const Functor&);
</ins><span class="cx">     void clear();
</span><span class="cx"> 
</span><span class="cx">     TakeType take(const ValueType&);
</span><span class="lines">@@ -275,9 +275,9 @@
</span><span class="cx"> 
</span><span class="cx"> template<typename T, typename U, typename V>
</span><span class="cx"> template<typename Functor>
</span><del>-inline bool HashSet<T, U, V>::removeIf(const Functor& functor)
</del><ins>+inline void HashSet<T, U, V>::removeIf(const Functor& functor)
</ins><span class="cx"> {
</span><del>-    return m_impl.removeIf(functor);
</del><ins>+    m_impl.removeIf(functor);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> template<typename T, typename U, typename V>
</span></span></pre></div>
<a id="trunkSourceWTFwtfHashTableh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/HashTable.h (225367 => 225368)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/HashTable.h 2017-12-01 00:11:39 UTC (rev 225367)
+++ trunk/Source/WTF/wtf/HashTable.h    2017-12-01 00:14:34 UTC (rev 225368)
</span><span class="lines">@@ -405,7 +405,7 @@
</span><span class="cx">         void removeWithoutEntryConsistencyCheck(iterator);
</span><span class="cx">         void removeWithoutEntryConsistencyCheck(const_iterator);
</span><span class="cx">         template<typename Functor>
</span><del>-        bool removeIf(const Functor&);
</del><ins>+        void removeIf(const Functor&);
</ins><span class="cx">         void clear();
</span><span class="cx"> 
</span><span class="cx">         static bool isEmptyBucket(const ValueType& value) { return isHashTraitsEmptyValue<KeyTraits>(Extractor::extract(value)); }
</span><span class="lines">@@ -1108,7 +1108,7 @@
</span><span class="cx"> 
</span><span class="cx">     template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
</span><span class="cx">     template<typename Functor>
</span><del>-    inline bool HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::removeIf(const Functor& functor)
</del><ins>+    inline void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::removeIf(const Functor& functor)
</ins><span class="cx">     {
</span><span class="cx">         // We must use local copies in case "functor" or "deleteBucket"
</span><span class="cx">         // make a function call, which prevents the compiler from keeping
</span><span class="lines">@@ -1134,7 +1134,6 @@
</span><span class="cx">             shrink();
</span><span class="cx">         
</span><span class="cx">         internalCheckTableConsistency();
</span><del>-        return removedBucketCount;
</del><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
</span></span></pre>
</div>
</div>

</body>
</html>