<!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>[190103] 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/190103">190103</a></dd>
<dt>Author</dt> <dd>fpizlo@apple.com</dd>
<dt>Date</dt> <dd>2015-09-21 21:34:19 -0700 (Mon, 21 Sep 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Always use the compiler's CAS implementation and get rid of ENABLE(COMPARE_AND_SWAP)
https://bugs.webkit.org/show_bug.cgi?id=149438

Reviewed by Mark Lam.

Source/JavaScriptCore:

* heap/HeapInlines.h:
(JSC::Heap::reportExtraMemoryVisited):
(JSC::Heap::deprecatedReportExtraMemory):

Source/WebCore:

No new tests because no new behavior.

* platform/text/TextBreakIterator.cpp:
(WebCore::compareAndSwapNonSharedCharacterBreakIterator):
(WebCore::NonSharedCharacterBreakIterator::NonSharedCharacterBreakIterator):

Source/WTF:

* wtf/Atomics.h: Make weakCompareAndSwap() just forward to the system CAS via WTF::Atomic.
(WTF::weakCompareAndSwap):
(WTF::weakCompareAndSwapUIntPtr): Deleted.
(WTF::weakCompareAndSwapSize): Deleted.
* wtf/Bitmap.h: Small changes to use the new API.
(WTF::WordType&gt;::concurrentTestAndSet):
* wtf/Platform.h: Remove ENABLE(COMPARE_AND_SWAP)</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreAPItestsCompareAndSwapTestcpp">trunk/Source/JavaScriptCore/API/tests/CompareAndSwapTest.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreheapHeapInlinesh">trunk/Source/JavaScriptCore/heap/HeapInlines.h</a></li>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFwtfAtomicsh">trunk/Source/WTF/wtf/Atomics.h</a></li>
<li><a href="#trunkSourceWTFwtfBitmaph">trunk/Source/WTF/wtf/Bitmap.h</a></li>
<li><a href="#trunkSourceWTFwtfPlatformh">trunk/Source/WTF/wtf/Platform.h</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformtextTextBreakIteratorcpp">trunk/Source/WebCore/platform/text/TextBreakIterator.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreAPItestsCompareAndSwapTestcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/API/tests/CompareAndSwapTest.cpp (190102 => 190103)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/API/tests/CompareAndSwapTest.cpp        2015-09-22 04:27:09 UTC (rev 190102)
+++ trunk/Source/JavaScriptCore/API/tests/CompareAndSwapTest.cpp        2015-09-22 04:34:19 UTC (rev 190103)
</span><span class="lines">@@ -63,7 +63,7 @@
</span><span class="cx">         oldValue = *wordPtr;
</span><span class="cx">         if (oldValue &amp; mask)
</span><span class="cx">             return true;
</span><del>-    } while (!WTF::weakCompareAndSwap(wordPtr, oldValue, oldValue | mask));
</del><ins>+    } while (!WTF::weakCompareAndSwap(wordPtr, oldValue, static_cast&lt;uint8_t&gt;(oldValue | mask)));
</ins><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (190102 => 190103)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2015-09-22 04:27:09 UTC (rev 190102)
+++ trunk/Source/JavaScriptCore/ChangeLog        2015-09-22 04:34:19 UTC (rev 190103)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2015-09-21  Filip Pizlo  &lt;fpizlo@apple.com&gt;
+
+        Always use the compiler's CAS implementation and get rid of ENABLE(COMPARE_AND_SWAP)
+        https://bugs.webkit.org/show_bug.cgi?id=149438
+
+        Reviewed by Mark Lam.
+
+        * heap/HeapInlines.h:
+        (JSC::Heap::reportExtraMemoryVisited):
+        (JSC::Heap::deprecatedReportExtraMemory):
+
</ins><span class="cx"> 2015-09-21  Saam barati  &lt;sbarati@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         functionProtoFuncToString should not rely on typeProfilingEndOffset()
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreheapHeapInlinesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/heap/HeapInlines.h (190102 => 190103)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/heap/HeapInlines.h        2015-09-22 04:27:09 UTC (rev 190102)
+++ trunk/Source/JavaScriptCore/heap/HeapInlines.h        2015-09-22 04:34:19 UTC (rev 190103)
</span><span class="lines">@@ -171,15 +171,11 @@
</span><span class="cx"> 
</span><span class="cx">     size_t* counter = &amp;m_extraMemorySize;
</span><span class="cx">     
</span><del>-#if ENABLE(COMPARE_AND_SWAP)
</del><span class="cx">     for (;;) {
</span><span class="cx">         size_t oldSize = *counter;
</span><del>-        if (WTF::weakCompareAndSwapSize(counter, oldSize, oldSize + size))
</del><ins>+        if (WTF::weakCompareAndSwap(counter, oldSize, oldSize + size))
</ins><span class="cx">             return;
</span><span class="cx">     }
</span><del>-#else
-    (*counter) += size;
-#endif
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> inline void Heap::deprecatedReportExtraMemory(size_t size)
</span></span></pre></div>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (190102 => 190103)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog        2015-09-22 04:27:09 UTC (rev 190102)
+++ trunk/Source/WTF/ChangeLog        2015-09-22 04:34:19 UTC (rev 190103)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2015-09-21  Filip Pizlo  &lt;fpizlo@apple.com&gt;
+
+        Always use the compiler's CAS implementation and get rid of ENABLE(COMPARE_AND_SWAP)
+        https://bugs.webkit.org/show_bug.cgi?id=149438
+
+        Reviewed by Mark Lam.
+
+        * wtf/Atomics.h: Make weakCompareAndSwap() just forward to the system CAS via WTF::Atomic.
+        (WTF::weakCompareAndSwap):
+        (WTF::weakCompareAndSwapUIntPtr): Deleted.
+        (WTF::weakCompareAndSwapSize): Deleted.
+        * wtf/Bitmap.h: Small changes to use the new API.
+        (WTF::WordType&gt;::concurrentTestAndSet):
+        * wtf/Platform.h: Remove ENABLE(COMPARE_AND_SWAP)
+
</ins><span class="cx"> 2015-09-21  Csaba Osztrogonác  &lt;ossy@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Remove old GCC cruft from wtf/StdLibExtras.h
</span></span></pre></div>
<a id="trunkSourceWTFwtfAtomicsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/Atomics.h (190102 => 190103)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/Atomics.h        2015-09-22 04:27:09 UTC (rev 190102)
+++ trunk/Source/WTF/wtf/Atomics.h        2015-09-22 04:34:19 UTC (rev 190103)
</span><span class="lines">@@ -113,148 +113,13 @@
</span><span class="cx">     std::atomic&lt;T&gt; value;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-#if OS(WINDOWS)
-inline bool weakCompareAndSwap(volatile unsigned* location, unsigned expected, unsigned newValue)
</del><ins>+// This is a weak CAS function that takes a direct pointer and has no portable fencing guarantees.
+template&lt;typename T&gt;
+inline bool weakCompareAndSwap(volatile T* location, T expected, T newValue)
</ins><span class="cx"> {
</span><del>-    return InterlockedCompareExchange(reinterpret_cast&lt;LONG volatile*&gt;(location), static_cast&lt;LONG&gt;(newValue), static_cast&lt;LONG&gt;(expected)) == static_cast&lt;LONG&gt;(expected);
</del><ins>+    return bitwise_cast&lt;Atomic&lt;T&gt;*&gt;(location)-&gt;compareExchangeWeak(expected, newValue, std::memory_order_relaxed);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline bool weakCompareAndSwap(void*volatile* location, void* expected, void* newValue)
-{
-    return InterlockedCompareExchangePointer(location, newValue, expected) == expected;
-}
-#else // OS(WINDOWS) --&gt; not windows
-inline bool weakCompareAndSwap(volatile unsigned* location, unsigned expected, unsigned newValue) 
-{
-#if ENABLE(COMPARE_AND_SWAP)
-#if CPU(X86) || CPU(X86_64)
-    unsigned char result;
-    asm volatile(
-        &quot;lock; cmpxchgl %3, %2\n\t&quot;
-        &quot;sete %1&quot;
-        : &quot;+a&quot;(expected), &quot;=q&quot;(result), &quot;+m&quot;(*location)
-        : &quot;r&quot;(newValue)
-        : &quot;memory&quot;
-        );
-#elif CPU(ARM_THUMB2)
-    unsigned tmp;
-    unsigned result;
-    asm volatile(
-        &quot;movw %1, #1\n\t&quot;
-        &quot;ldrex %2, %0\n\t&quot;
-        &quot;cmp %3, %2\n\t&quot;
-        &quot;bne.n 0f\n\t&quot;
-        &quot;strex %1, %4, %0\n\t&quot;
-        &quot;0:&quot;
-        : &quot;+Q&quot;(*location), &quot;=&amp;r&quot;(result), &quot;=&amp;r&quot;(tmp)
-        : &quot;r&quot;(expected), &quot;r&quot;(newValue)
-        : &quot;memory&quot;);
-    result = !result;
-#elif CPU(ARM64) &amp;&amp; COMPILER(GCC_OR_CLANG)
-    unsigned tmp;
-    unsigned result;
-    asm volatile(
-        &quot;mov %w1, #1\n\t&quot;
-        &quot;ldxr %w2, [%0]\n\t&quot;
-        &quot;cmp %w3, %w2\n\t&quot;
-        &quot;b.ne 0f\n\t&quot;
-        &quot;stxr %w1, %w4, [%0]\n\t&quot;
-        &quot;0:&quot;
-        : &quot;+r&quot;(location), &quot;=&amp;r&quot;(result), &quot;=&amp;r&quot;(tmp)
-        : &quot;r&quot;(expected), &quot;r&quot;(newValue)
-        : &quot;memory&quot;);
-    result = !result;
-#elif CPU(ARM64)
-    unsigned tmp;
-    unsigned result;
-    asm volatile(
-        &quot;mov %w1, #1\n\t&quot;
-        &quot;ldxr %w2, %0\n\t&quot;
-        &quot;cmp %w3, %w2\n\t&quot;
-        &quot;b.ne 0f\n\t&quot;
-        &quot;stxr %w1, %w4, %0\n\t&quot;
-        &quot;0:&quot;
-        : &quot;+m&quot;(*location), &quot;=&amp;r&quot;(result), &quot;=&amp;r&quot;(tmp)
-        : &quot;r&quot;(expected), &quot;r&quot;(newValue)
-        : &quot;memory&quot;);
-    result = !result;
-#else
-#error &quot;Bad architecture for compare and swap.&quot;
-#endif
-    return result;
-#else
-    UNUSED_PARAM(location);
-    UNUSED_PARAM(expected);
-    UNUSED_PARAM(newValue);
-    CRASH();
-    return false;
-#endif
-}
-
-inline bool weakCompareAndSwap(void*volatile* location, void* expected, void* newValue)
-{
-#if ENABLE(COMPARE_AND_SWAP)
-#if CPU(X86_64)
-    bool result;
-    asm volatile(
-        &quot;lock; cmpxchgq %3, %2\n\t&quot;
-        &quot;sete %1&quot;
-        : &quot;+a&quot;(expected), &quot;=q&quot;(result), &quot;+m&quot;(*location)
-        : &quot;r&quot;(newValue)
-        : &quot;memory&quot;
-        );
-    return result;
-#elif CPU(ARM64) &amp;&amp; COMPILER(GCC_OR_CLANG)
-    bool result;
-    void* tmp;
-    asm volatile(
-        &quot;mov %w1, #1\n\t&quot;
-        &quot;ldxr %x2, [%0]\n\t&quot;
-        &quot;cmp %x3, %x2\n\t&quot;
-        &quot;b.ne 0f\n\t&quot;
-        &quot;stxr %w1, %x4, [%0]\n\t&quot;
-        &quot;0:&quot;
-        : &quot;+r&quot;(location), &quot;=&amp;r&quot;(result), &quot;=&amp;r&quot;(tmp)
-        : &quot;r&quot;(expected), &quot;r&quot;(newValue)
-        : &quot;memory&quot;);
-    return !result;
-#elif CPU(ARM64)
-    bool result;
-    void* tmp;
-    asm volatile(
-        &quot;mov %w1, #1\n\t&quot;
-        &quot;ldxr %x2, %0\n\t&quot;
-        &quot;cmp %x3, %x2\n\t&quot;
-        &quot;b.ne 0f\n\t&quot;
-        &quot;stxr %w1, %x4, %0\n\t&quot;
-        &quot;0:&quot;
-        : &quot;+m&quot;(*location), &quot;=&amp;r&quot;(result), &quot;=&amp;r&quot;(tmp)
-        : &quot;r&quot;(expected), &quot;r&quot;(newValue)
-        : &quot;memory&quot;);
-    return !result;
-#else
-    return weakCompareAndSwap(bitwise_cast&lt;unsigned*&gt;(location), bitwise_cast&lt;unsigned&gt;(expected), bitwise_cast&lt;unsigned&gt;(newValue));
-#endif
-#else // ENABLE(COMPARE_AND_SWAP)
-    UNUSED_PARAM(location);
-    UNUSED_PARAM(expected);
-    UNUSED_PARAM(newValue);
-    CRASH();
-    return 0;
-#endif // ENABLE(COMPARE_AND_SWAP)
-}
-#endif // OS(WINDOWS) (end of the not-windows case)
-
-inline bool weakCompareAndSwapUIntPtr(volatile uintptr_t* location, uintptr_t expected, uintptr_t newValue)
-{
-    return weakCompareAndSwap(reinterpret_cast&lt;void*volatile*&gt;(location), reinterpret_cast&lt;void*&gt;(expected), reinterpret_cast&lt;void*&gt;(newValue));
-}
-
-inline bool weakCompareAndSwapSize(volatile size_t* location, size_t expected, size_t newValue)
-{
-    return weakCompareAndSwap(reinterpret_cast&lt;void*volatile*&gt;(location), reinterpret_cast&lt;void*&gt;(expected), reinterpret_cast&lt;void*&gt;(newValue));
-}
-
</del><span class="cx"> // Just a compiler fence. Has no effect on the hardware, but tells the compiler
</span><span class="cx"> // not to move things around this call. Should not affect the compiler's ability
</span><span class="cx"> // to do things like register allocation and code motion over pure operations.
</span><span class="lines">@@ -322,69 +187,6 @@
</span><span class="cx"> 
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-inline bool weakCompareAndSwap(uint8_t* location, uint8_t expected, uint8_t newValue)
-{
-#if ENABLE(COMPARE_AND_SWAP)
-#if !OS(WINDOWS) &amp;&amp; (CPU(X86) || CPU(X86_64))
-    unsigned char result;
-    asm volatile(
-        &quot;lock; cmpxchgb %3, %2\n\t&quot;
-        &quot;sete %1&quot;
-        : &quot;+a&quot;(expected), &quot;=q&quot;(result), &quot;+m&quot;(*location)
-        : &quot;q&quot;(newValue)
-        : &quot;memory&quot;
-        );
-    return result;
-#elif OS(WINDOWS) &amp;&amp; CPU(X86)
-    // FIXME: We need a 64-bit ASM implementation, but this cannot be inline due to
-    // Microsoft's decision to exclude it from the compiler.
-    bool result = false;
-
-    __asm {
-        mov al, expected
-        mov edx, location
-        mov cl, newValue
-        lock cmpxchg byte ptr[edx], cl
-        setz result
-    }
-
-    return result;
-#else
-    uintptr_t locationValue = bitwise_cast&lt;uintptr_t&gt;(location);
-    uintptr_t alignedLocationValue = locationValue &amp; ~(sizeof(unsigned) - 1);
-    uintptr_t locationOffset = locationValue - alignedLocationValue;
-    ASSERT(locationOffset &lt; sizeof(unsigned));
-    unsigned* alignedLocation = bitwise_cast&lt;unsigned*&gt;(alignedLocationValue);
-    // Make sure that this load is always issued and never optimized away.
-    unsigned oldAlignedValue = *const_cast&lt;volatile unsigned*&gt;(alignedLocation);
-
-    struct Splicer {
-        static unsigned splice(unsigned value, uint8_t byte, uintptr_t byteIndex)
-        {
-            union {
-                unsigned word;
-                uint8_t bytes[sizeof(unsigned)];
-            } u;
-            u.word = value;
-            u.bytes[byteIndex] = byte;
-            return u.word;
-        }
-    };
-    
-    unsigned expectedAlignedValue = Splicer::splice(oldAlignedValue, expected, locationOffset);
-    unsigned newAlignedValue = Splicer::splice(oldAlignedValue, newValue, locationOffset);
-
-    return weakCompareAndSwap(alignedLocation, expectedAlignedValue, newAlignedValue);
-#endif
-#else
-    UNUSED_PARAM(location);
-    UNUSED_PARAM(expected);
-    UNUSED_PARAM(newValue);
-    CRASH();
-    return false;
-#endif
-}
-
</del><span class="cx"> } // namespace WTF
</span><span class="cx"> 
</span><span class="cx"> using WTF::Atomic;
</span></span></pre></div>
<a id="trunkSourceWTFwtfBitmaph"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/Bitmap.h (190102 => 190103)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/Bitmap.h        2015-09-22 04:27:09 UTC (rev 190102)
+++ trunk/Source/WTF/wtf/Bitmap.h        2015-09-22 04:34:19 UTC (rev 190103)
</span><span class="lines">@@ -124,7 +124,7 @@
</span><span class="cx">         oldValue = *wordPtr;
</span><span class="cx">         if (oldValue &amp; mask)
</span><span class="cx">             return true;
</span><del>-    } while (!weakCompareAndSwap(wordPtr, oldValue, oldValue | mask));
</del><ins>+    } while (!weakCompareAndSwap(wordPtr, oldValue, static_cast&lt;WordType&gt;(oldValue | mask)));
</ins><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -144,7 +144,7 @@
</span><span class="cx">         oldValue = *wordPtr;
</span><span class="cx">         if (!(oldValue &amp; mask))
</span><span class="cx">             return false;
</span><del>-    } while (!weakCompareAndSwap(wordPtr, oldValue, oldValue &amp; ~mask));
</del><ins>+    } while (!weakCompareAndSwap(wordPtr, oldValue, static_cast&lt;WordType&gt;(oldValue &amp; ~mask)));
</ins><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWTFwtfPlatformh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/Platform.h (190102 => 190103)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/Platform.h        2015-09-22 04:27:09 UTC (rev 190102)
+++ trunk/Source/WTF/wtf/Platform.h        2015-09-22 04:34:19 UTC (rev 190103)
</span><span class="lines">@@ -972,11 +972,7 @@
</span><span class="cx"> #define USE_IMLANG_FONT_LINK2 1
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-#if !defined(ENABLE_COMPARE_AND_SWAP) &amp;&amp; (OS(WINDOWS) || (COMPILER(GCC_OR_CLANG) &amp;&amp; (CPU(X86) || CPU(X86_64) || CPU(ARM_THUMB2) || CPU(ARM64))))
-#define ENABLE_COMPARE_AND_SWAP 1
-#endif
-
-#if !defined(ENABLE_PARALLEL_GC) &amp;&amp; (OS(DARWIN) || PLATFORM(EFL) || PLATFORM(GTK)) &amp;&amp; ENABLE(COMPARE_AND_SWAP)
</del><ins>+#if !defined(ENABLE_PARALLEL_GC) &amp;&amp; (OS(DARWIN) || PLATFORM(EFL) || PLATFORM(GTK))
</ins><span class="cx"> #define ENABLE_PARALLEL_GC 1
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (190102 => 190103)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-09-22 04:27:09 UTC (rev 190102)
+++ trunk/Source/WebCore/ChangeLog        2015-09-22 04:34:19 UTC (rev 190103)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2015-09-21  Filip Pizlo  &lt;fpizlo@apple.com&gt;
+
+        Always use the compiler's CAS implementation and get rid of ENABLE(COMPARE_AND_SWAP)
+        https://bugs.webkit.org/show_bug.cgi?id=149438
+
+        Reviewed by Mark Lam.
+
+        No new tests because no new behavior.
+
+        * platform/text/TextBreakIterator.cpp:
+        (WebCore::compareAndSwapNonSharedCharacterBreakIterator):
+        (WebCore::NonSharedCharacterBreakIterator::NonSharedCharacterBreakIterator):
+
</ins><span class="cx"> 2015-09-21  Timothy Horton  &lt;timothy_horton@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Allow DataDetectors to pre-filter telephone number menu items
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformtextTextBreakIteratorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/text/TextBreakIterator.cpp (190102 => 190103)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/text/TextBreakIterator.cpp        2015-09-22 04:27:09 UTC (rev 190102)
+++ trunk/Source/WebCore/platform/text/TextBreakIterator.cpp        2015-09-22 04:34:19 UTC (rev 190103)
</span><span class="lines">@@ -812,16 +812,7 @@
</span><span class="cx"> 
</span><span class="cx"> static inline bool compareAndSwapNonSharedCharacterBreakIterator(TextBreakIterator* expected, TextBreakIterator* newValue)
</span><span class="cx"> {
</span><del>-#if ENABLE(COMPARE_AND_SWAP)
-    return WTF::weakCompareAndSwap(reinterpret_cast&lt;void**&gt;(&amp;nonSharedCharacterBreakIterator), expected, newValue);
-#else
-    static StaticLock nonSharedCharacterBreakIteratorMutex;
-    std::lock_guard&lt;StaticLock&gt; locker(nonSharedCharacterBreakIteratorMutex);
-    if (nonSharedCharacterBreakIterator != expected)
-        return false;
-    nonSharedCharacterBreakIterator = newValue;
-    return true;
-#endif
</del><ins>+    return WTF::weakCompareAndSwap(&amp;nonSharedCharacterBreakIterator, expected, newValue);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> NonSharedCharacterBreakIterator::NonSharedCharacterBreakIterator(StringView string)
</span></span></pre>
</div>
</div>

</body>
</html>