Title: [109105] trunk/Source/_javascript_Core
Revision
109105
Author
[email protected]
Date
2012-02-28 08:02:02 -0800 (Tue, 28 Feb 2012)

Log Message

JSString::resolveRope() should report extra memory cost to the heap.
https://bugs.webkit.org/show_bug.cgi?id=79555

Patch by Yong Li <[email protected]> on 2012-02-28
Reviewed by Michael Saboff.

At the time a JSString is constructed with fibers, it doesn't report
extra memory cost, which is reasonable because it hasn't allocate
new memory. However when the rope is resolved, it should report meory
cost for the new buffer.

* runtime/JSString.cpp:
(JSC::JSString::resolveRope):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (109104 => 109105)


--- trunk/Source/_javascript_Core/ChangeLog	2012-02-28 16:01:19 UTC (rev 109104)
+++ trunk/Source/_javascript_Core/ChangeLog	2012-02-28 16:02:02 UTC (rev 109105)
@@ -1,3 +1,18 @@
+2012-02-28  Yong Li  <[email protected]>
+
+        JSString::resolveRope() should report extra memory cost to the heap.
+        https://bugs.webkit.org/show_bug.cgi?id=79555
+
+        Reviewed by Michael Saboff.
+
+        At the time a JSString is constructed with fibers, it doesn't report
+        extra memory cost, which is reasonable because it hasn't allocate
+        new memory. However when the rope is resolved, it should report meory
+        cost for the new buffer.
+
+        * runtime/JSString.cpp:
+        (JSC::JSString::resolveRope):
+
 2012-02-27  Oliver Hunt  <[email protected]>
 
         sputnik/Unicode/Unicode_500/S7.2_A1.6_T1.html crashes in the interpreter

Modified: trunk/Source/_javascript_Core/runtime/JSString.cpp (109104 => 109105)


--- trunk/Source/_javascript_Core/runtime/JSString.cpp	2012-02-28 16:01:19 UTC (rev 109104)
+++ trunk/Source/_javascript_Core/runtime/JSString.cpp	2012-02-28 16:02:02 UTC (rev 109105)
@@ -65,9 +65,10 @@
 
     if (is8Bit()) {
         LChar* buffer;
-        if (RefPtr<StringImpl> newImpl = StringImpl::tryCreateUninitialized(m_length, buffer))
+        if (RefPtr<StringImpl> newImpl = StringImpl::tryCreateUninitialized(m_length, buffer)) {
+            Heap::heap(this)->reportExtraMemoryCost(newImpl->cost());
             m_value = newImpl.release();
-        else {
+        } else {
             outOfMemory(exec);
             return;
         }
@@ -92,9 +93,10 @@
     }
 
     UChar* buffer;
-    if (RefPtr<StringImpl> newImpl = StringImpl::tryCreateUninitialized(m_length, buffer))
+    if (RefPtr<StringImpl> newImpl = StringImpl::tryCreateUninitialized(m_length, buffer)) {
+        Heap::heap(this)->reportExtraMemoryCost(newImpl->cost());
         m_value = newImpl.release();
-    else {
+    } else {
         outOfMemory(exec);
         return;
     }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to