Title: [98216] trunk/Source/_javascript_Core
Revision
98216
Author
[email protected]
Date
2011-10-23 22:51:48 -0700 (Sun, 23 Oct 2011)

Log Message

Removed StringImpl::createStrippingNullCharacters
https://bugs.webkit.org/show_bug.cgi?id=70700

Reviewed by David Levin.
        
It was unused.

* _javascript_Core.exp:
* wtf/text/StringImpl.cpp:
* wtf/text/StringImpl.h:

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (98215 => 98216)


--- trunk/Source/_javascript_Core/ChangeLog	2011-10-24 04:36:38 UTC (rev 98215)
+++ trunk/Source/_javascript_Core/ChangeLog	2011-10-24 05:51:48 UTC (rev 98216)
@@ -1,3 +1,16 @@
+2011-10-23  Geoffrey Garen  <[email protected]>
+
+        Removed StringImpl::createStrippingNullCharacters
+        https://bugs.webkit.org/show_bug.cgi?id=70700
+
+        Reviewed by David Levin.
+        
+        It was unused.
+
+        * _javascript_Core.exp:
+        * wtf/text/StringImpl.cpp:
+        * wtf/text/StringImpl.h:
+
 2011-10-22  Filip Pizlo  <[email protected]>
 
         DFG should inline constructors

Modified: trunk/Source/_javascript_Core/_javascript_Core.exp (98215 => 98216)


--- trunk/Source/_javascript_Core/_javascript_Core.exp	2011-10-24 04:36:38 UTC (rev 98215)
+++ trunk/Source/_javascript_Core/_javascript_Core.exp	2011-10-24 05:51:48 UTC (rev 98216)
@@ -372,7 +372,6 @@
 __ZN3WTF10StringImpl22containsOnlyWhitespaceEv
 __ZN3WTF10StringImpl23defaultWritingDirectionEPb
 __ZN3WTF10StringImpl23reverseFindIgnoringCaseEPS0_j
-__ZN3WTF10StringImpl37createStrippingNullCharactersSlowCaseEPKtj
 __ZN3WTF10StringImpl4fillEt
 __ZN3WTF10StringImpl4findEPFbtEj
 __ZN3WTF10StringImpl4findEPKcj

Modified: trunk/Source/_javascript_Core/wtf/text/StringImpl.cpp (98215 => 98216)


--- trunk/Source/_javascript_Core/wtf/text/StringImpl.cpp	2011-10-24 04:36:38 UTC (rev 98215)
+++ trunk/Source/_javascript_Core/wtf/text/StringImpl.cpp	2011-10-24 05:51:48 UTC (rev 98216)
@@ -1122,20 +1122,6 @@
     return WTF::Unicode::LeftToRight;
 }
 
-// This is a hot function because it's used when parsing HTML.
-PassRefPtr<StringImpl> StringImpl::createStrippingNullCharactersSlowCase(const UChar* characters, unsigned length)
-{
-    StringBuffer strippedCopy(length);
-    unsigned strippedLength = 0;
-    for (unsigned i = 0; i < length; i++) {
-        if (int c = characters[i])
-            strippedCopy[strippedLength++] = c;
-    }
-    ASSERT(strippedLength < length);  // Only take the slow case when stripping.
-    strippedCopy.shrink(strippedLength);
-    return adopt(strippedCopy);
-}
-
 PassRefPtr<StringImpl> StringImpl::adopt(StringBuffer& buffer)
 {
     unsigned length = buffer.length();

Modified: trunk/Source/_javascript_Core/wtf/text/StringImpl.h (98215 => 98216)


--- trunk/Source/_javascript_Core/wtf/text/StringImpl.h	2011-10-24 04:36:38 UTC (rev 98215)
+++ trunk/Source/_javascript_Core/wtf/text/StringImpl.h	2011-10-24 05:51:48 UTC (rev 98216)
@@ -193,7 +193,6 @@
 
     static unsigned dataOffset() { return OBJECT_OFFSETOF(StringImpl, m_data); }
     static PassRefPtr<StringImpl> createWithTerminatingNullCharacter(const StringImpl&);
-    static PassRefPtr<StringImpl> createStrippingNullCharacters(const UChar*, unsigned length);
 
     template<size_t inlineCapacity>
     static PassRefPtr<StringImpl> adopt(Vector<UChar, inlineCapacity>& vector)
@@ -393,8 +392,6 @@
     // This number must be at least 2 to avoid sharing empty, null as well as 1 character strings from SmallStrings.
     static const unsigned s_copyCharsInlineCutOff = 20;
 
-    static PassRefPtr<StringImpl> createStrippingNullCharactersSlowCase(const UChar*, unsigned length);
-    
     BufferOwnership bufferOwnership() const { return static_cast<BufferOwnership>(m_hashAndFlags & s_hashMaskBufferOwnership); }
     bool isStatic() const { return m_refCount & s_refCountFlagIsStaticString; }
     template <class UCharPredicate> PassRefPtr<StringImpl> stripMatchedCharacters(UCharPredicate);
@@ -458,29 +455,6 @@
     return c <= 0x7F ? WTF::isASCIISpace(c) : WTF::Unicode::direction(c) == WTF::Unicode::WhiteSpaceNeutral;
 }
 
-// This is a hot function because it's used when parsing HTML.
-inline PassRefPtr<StringImpl> StringImpl::createStrippingNullCharacters(const UChar* characters, unsigned length)
-{
-    ASSERT(characters);
-    ASSERT(length);
-
-    // Optimize for the case where there are no Null characters by quickly
-    // searching for nulls, and then using StringImpl::create, which will
-    // memcpy the whole buffer.  This is faster than assigning character by
-    // character during the loop. 
-
-    // Fast case.
-    int foundNull = 0;
-    for (unsigned i = 0; !foundNull && i < length; i++) {
-        int c = characters[i]; // more efficient than using UChar here (at least on Intel Mac OS)
-        foundNull |= !c;
-    }
-    if (!foundNull)
-        return StringImpl::create(characters, length);
-
-    return StringImpl::createStrippingNullCharactersSlowCase(characters, length);
-}
-
 struct StringHash;
 
 // StringHash is the default hash for StringImpl* and RefPtr<StringImpl>
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to