qtwebkit/0002-JSString-resolveRope-s...

41 lines
1.4 KiB
Diff

From a096458b01a9387719308c99e5917a7b42196078 Mon Sep 17 00:00:00 2001
From: Nicolas Arnaud-Cormos <nicolas.arnaud-cormos.qnx@kdab.com>
Date: Mon, 23 Apr 2012 19:54:36 -0700
Subject: [PATCH 02/11] JSString::resolveRope() should report extra memory cost
to the heap.
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 memory
cost for the new buffer.
Backport patch by Yong Li
Reviewed by Michael Saboff.
http://trac.webkit.org/changeset/109105
Signed-off-by: Simon Hausmann <simon.hausmann@nokia.com>
---
Source/JavaScriptCore/runtime/JSString.cpp | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/Source/JavaScriptCore/runtime/JSString.cpp b/Source/JavaScriptCore/runtime/JSString.cpp
index da15997..a0ba3e2 100644
--- a/Source/JavaScriptCore/runtime/JSString.cpp
+++ b/Source/JavaScriptCore/runtime/JSString.cpp
@@ -41,9 +41,10 @@ void JSString::resolveRope(ExecState* exec) const
ASSERT(isRope());
UChar* buffer;
- if (PassRefPtr<StringImpl> newImpl = StringImpl::tryCreateUninitialized(m_length, buffer))
+ if (PassRefPtr<StringImpl> newImpl = StringImpl::tryCreateUninitialized(m_length, buffer)) {
+ Heap::heap(this)->reportExtraMemoryCost(newImpl->cost());
m_value = newImpl;
- else {
+ } else {
outOfMemory(exec);
return;
}
--
1.8.0.2