Title: [91288] trunk/Source/_javascript_Core
Revision
91288
Author
[email protected]
Date
2011-07-19 12:49:07 -0700 (Tue, 19 Jul 2011)

Log Message

[JSC] WebKit allocates gigabytes of memory when doing repeated string concatenation
https://bugs.webkit.org/show_bug.cgi?id=63918

Patch by Mark Hahnenberg <[email protected]> on 2011-07-19
Reviewed by Darin Adler.

When allocating JSStrings during concatenation, we needed to call the Heap's reportExtraMemoryCost
method due to additional string copying within several of the constructors when dealing with
UStrings.  This has been added to the UString version of the appendStringInConstruct method
within the JSString class.

* runtime/JSString.h:
(JSC::RopeBuilder::JSString):
(JSC::RopeBuilder::appendStringInConstruct):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (91287 => 91288)


--- trunk/Source/_javascript_Core/ChangeLog	2011-07-19 19:40:36 UTC (rev 91287)
+++ trunk/Source/_javascript_Core/ChangeLog	2011-07-19 19:49:07 UTC (rev 91288)
@@ -1,3 +1,19 @@
+2011-07-19  Mark Hahnenberg  <[email protected]>
+
+        [JSC] WebKit allocates gigabytes of memory when doing repeated string concatenation
+        https://bugs.webkit.org/show_bug.cgi?id=63918
+
+        Reviewed by Darin Adler.
+
+        When allocating JSStrings during concatenation, we needed to call the Heap's reportExtraMemoryCost
+        method due to additional string copying within several of the constructors when dealing with 
+        UStrings.  This has been added to the UString version of the appendStringInConstruct method 
+        within the JSString class.
+
+        * runtime/JSString.h:
+        (JSC::RopeBuilder::JSString):
+        (JSC::RopeBuilder::appendStringInConstruct):
+
 2011-07-19  Gavin Barraclough  <[email protected]>
 
         https://bugs.webkit.org/show_bug.cgi?id=64677

Modified: trunk/Source/_javascript_Core/runtime/JSString.h (91287 => 91288)


--- trunk/Source/_javascript_Core/runtime/JSString.h	2011-07-19 19:40:36 UTC (rev 91287)
+++ trunk/Source/_javascript_Core/runtime/JSString.h	2011-07-19 19:49:07 UTC (rev 91288)
@@ -200,6 +200,7 @@
             , m_fiberCount(0)
         {
             ASSERT(!m_value.isNull());
+            Heap::heap(this)->reportExtraMemoryCost(value.impl()->cost());
         }
         JSString(JSGlobalData& globalData, PassRefPtr<StringImpl> value, HasOtherOwnerType)
             : JSCell(globalData, globalData.stringStructure.get())
@@ -393,6 +394,7 @@
             StringImpl* impl = string.impl();
             impl->ref();
             m_fibers[index++] = impl;
+            Heap::heap(this)->reportExtraMemoryCost(string.impl()->cost());
         }
 
         void appendStringInConstruct(unsigned& index, JSString* jsString)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to