Title: [241241] trunk/Source
Revision
241241
Author
[email protected]
Date
2019-02-09 09:52:38 -0800 (Sat, 09 Feb 2019)

Log Message

Unreviewed, rolling out r241237.
https://bugs.webkit.org/show_bug.cgi?id=194474

Shows significant memory increase in WSL (Requested by
yusukesuzuki on #webkit).

Reverted changeset:

"[WTF] Use BufferInternal StringImpl if substring StringImpl
takes more memory"
https://bugs.webkit.org/show_bug.cgi?id=194469
https://trac.webkit.org/changeset/241237

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (241240 => 241241)


--- trunk/Source/_javascript_Core/ChangeLog	2019-02-09 16:04:09 UTC (rev 241240)
+++ trunk/Source/_javascript_Core/ChangeLog	2019-02-09 17:52:38 UTC (rev 241241)
@@ -1,3 +1,18 @@
+2019-02-09  Commit Queue  <[email protected]>
+
+        Unreviewed, rolling out r241237.
+        https://bugs.webkit.org/show_bug.cgi?id=194474
+
+        Shows significant memory increase in WSL (Requested by
+        yusukesuzuki on #webkit).
+
+        Reverted changeset:
+
+        "[WTF] Use BufferInternal StringImpl if substring StringImpl
+        takes more memory"
+        https://bugs.webkit.org/show_bug.cgi?id=194469
+        https://trac.webkit.org/changeset/241237
+
 2019-02-08  Yusuke Suzuki  <[email protected]>
 
         [WTF] Use BufferInternal StringImpl if substring StringImpl takes more memory

Modified: trunk/Source/_javascript_Core/runtime/JSString.h (241240 => 241241)


--- trunk/Source/_javascript_Core/runtime/JSString.h	2019-02-09 16:04:09 UTC (rev 241240)
+++ trunk/Source/_javascript_Core/runtime/JSString.h	2019-02-09 17:52:38 UTC (rev 241241)
@@ -636,10 +636,7 @@
         if (c <= maxSingleCharacterString)
             return vm->smallStrings.singleCharacterString(c);
     }
-    auto impl = StringImpl::createSubstringSharingImpl(*s.impl(), offset, length);
-    if (impl->isSubString())
-        return JSString::createHasOtherOwner(*vm, WTFMove(impl));
-    return JSString::create(*vm, WTFMove(impl));
+    return JSString::createHasOtherOwner(*vm, StringImpl::createSubstringSharingImpl(*s.impl(), offset, length));
 }
 
 inline JSString* jsOwnedString(VM* vm, const String& s)

Modified: trunk/Source/WTF/ChangeLog (241240 => 241241)


--- trunk/Source/WTF/ChangeLog	2019-02-09 16:04:09 UTC (rev 241240)
+++ trunk/Source/WTF/ChangeLog	2019-02-09 17:52:38 UTC (rev 241241)
@@ -1,3 +1,18 @@
+2019-02-09  Commit Queue  <[email protected]>
+
+        Unreviewed, rolling out r241237.
+        https://bugs.webkit.org/show_bug.cgi?id=194474
+
+        Shows significant memory increase in WSL (Requested by
+        yusukesuzuki on #webkit).
+
+        Reverted changeset:
+
+        "[WTF] Use BufferInternal StringImpl if substring StringImpl
+        takes more memory"
+        https://bugs.webkit.org/show_bug.cgi?id=194469
+        https://trac.webkit.org/changeset/241237
+
 2019-02-08  Yusuke Suzuki  <[email protected]>
 
         [WTF] Use BufferInternal StringImpl if substring StringImpl takes more memory

Modified: trunk/Source/WTF/wtf/text/StringImpl.h (241240 => 241241)


--- trunk/Source/WTF/wtf/text/StringImpl.h	2019-02-09 16:04:09 UTC (rev 241240)
+++ trunk/Source/WTF/wtf/text/StringImpl.h	2019-02-09 17:52:38 UTC (rev 241241)
@@ -297,7 +297,9 @@
     
     bool isExternal() const { return bufferOwnership() == BufferExternal; }
 
+#if STRING_STATS
     bool isSubString() const { return bufferOwnership() == BufferSubstring; }
+#endif
 
     static WTF_EXPORT_PRIVATE Expected<CString, UTF8ConversionError> utf8ForCharacters(const LChar* characters, unsigned length);
     static WTF_EXPORT_PRIVATE Expected<CString, UTF8ConversionError> utf8ForCharacters(const UChar* characters, unsigned length, ConversionMode = LenientConversion);
@@ -935,20 +937,10 @@
     if (!length)
         return *empty();
 
-    // Coyping the thing would save more memory sometimes, largely due to the size of pointer.
-    size_t substringSize = allocationSize<StringImpl*>(1);
-    if (rep.is8Bit()) {
-        if (substringSize >= allocationSize<LChar>(length))
-            return create(rep.m_data8 + offset, length);
-    } else {
-        if (substringSize >= allocationSize<UChar>(length))
-            return create(rep.m_data16 + offset, length);
-    }
-
     auto* ownerRep = ((rep.bufferOwnership() == BufferSubstring) ? rep.substringBuffer() : &rep);
 
     // We allocate a buffer that contains both the StringImpl struct as well as the pointer to the owner string.
-    auto* stringImpl = static_cast<StringImpl*>(fastMalloc(substringSize));
+    auto* stringImpl = static_cast<StringImpl*>(fastMalloc(allocationSize<StringImpl*>(1)));
     if (rep.is8Bit())
         return adoptRef(*new (NotNull, stringImpl) StringImpl(rep.m_data8 + offset, length, *ownerRep));
     return adoptRef(*new (NotNull, stringImpl) StringImpl(rep.m_data16 + offset, length, *ownerRep));
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to