Title: [152815] trunk/Source/WTF
Revision
152815
Author
[email protected]
Date
2013-07-17 16:34:13 -0700 (Wed, 17 Jul 2013)

Log Message

Simplify AtomicString::lower()
https://bugs.webkit.org/show_bug.cgi?id=118719
<rdar://problem/14452883>

Reviewed by Gavin Barraclough.

* wtf/text/AtomicString.cpp:
(WTF::AtomicString::lower): Previously, the code was using a copy constructor for two path
and one regular construction in another path.
Just put the StringImpl where it needs to be instead.

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (152814 => 152815)


--- trunk/Source/WTF/ChangeLog	2013-07-17 23:32:43 UTC (rev 152814)
+++ trunk/Source/WTF/ChangeLog	2013-07-17 23:34:13 UTC (rev 152815)
@@ -1,3 +1,16 @@
+2013-07-17  Benjamin Poulain  <[email protected]>
+
+        Simplify AtomicString::lower()
+        https://bugs.webkit.org/show_bug.cgi?id=118719
+        <rdar://problem/14452883>
+
+        Reviewed by Gavin Barraclough.
+
+        * wtf/text/AtomicString.cpp:
+        (WTF::AtomicString::lower): Previously, the code was using a copy constructor for two path
+        and one regular construction in another path.
+        Just put the StringImpl where it needs to be instead.
+
 2013-07-15  Benjamin Poulain  <[email protected]>
 
         Add a threading assertion to AtomicString::remove

Modified: trunk/Source/WTF/wtf/text/AtomicString.cpp (152814 => 152815)


--- trunk/Source/WTF/wtf/text/AtomicString.cpp	2013-07-17 23:32:43 UTC (rev 152814)
+++ trunk/Source/WTF/wtf/text/AtomicString.cpp	2013-07-17 23:34:13 UTC (rev 152815)
@@ -436,11 +436,15 @@
     // Note: This is a hot function in the Dromaeo benchmark.
     StringImpl* impl = this->impl();
     if (UNLIKELY(!impl))
-        return *this;
-    RefPtr<StringImpl> newImpl = impl->lower();
-    if (LIKELY(newImpl == impl))
-        return *this;
-    return AtomicString(newImpl);
+        return AtomicString();
+
+    RefPtr<StringImpl> lowerImpl = impl->lower();
+    AtomicString returnValue;
+    if (LIKELY(lowerImpl == impl))
+        returnValue.m_string = lowerImpl.release();
+    else
+        returnValue.m_string = addSlowCase(lowerImpl.get());
+    return returnValue;
 }
 
 AtomicString AtomicString::fromUTF8Internal(const char* charactersStart, const char* charactersEnd)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to