From 284837daa07b29d6a63a748544a90b1f5842ac5c Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 10 Sep 2012 19:10:20 +0200 Subject: Imported WebKit commit 68645295d2e3e09af2c942f092556f06aa5f8b0d (http://svn.webkit.org/repository/webkit/trunk@128073) New snapshot --- Source/JavaScriptCore/runtime/JSString.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'Source/JavaScriptCore/runtime/JSString.cpp') diff --git a/Source/JavaScriptCore/runtime/JSString.cpp b/Source/JavaScriptCore/runtime/JSString.cpp index 4eb2a5297..f0e796d89 100644 --- a/Source/JavaScriptCore/runtime/JSString.cpp +++ b/Source/JavaScriptCore/runtime/JSString.cpp @@ -130,7 +130,10 @@ void JSRopeString::resolveRope(ExecState* exec) const for (size_t i = 0; i < s_maxInternalRopeLength && m_fibers[i]; ++i) { StringImpl* string = m_fibers[i]->m_value.impl(); unsigned length = string->length(); - StringImpl::copyChars(position, string->characters(), length); + if (string->is8Bit()) + StringImpl::copyChars(position, string->characters8(), length); + else + StringImpl::copyChars(position, string->characters16(), length); position += length; m_fibers[i].clear(); } @@ -139,7 +142,7 @@ void JSRopeString::resolveRope(ExecState* exec) const } // Overview: These functions convert a JSString from holding a string in rope form -// down to a simple UString representation. It does so by building up the string +// down to a simple String representation. It does so by building up the string // backwards, since we want to avoid recursion, we expect that the tree structure // representing the rope is likely imbalanced with more nodes down the left side // (since appending to the string is likely more common) - and as such resolving @@ -202,7 +205,10 @@ void JSRopeString::resolveRopeSlowCase(UChar* buffer) const StringImpl* string = static_cast(currentFiber->m_value.impl()); unsigned length = string->length(); position -= length; - StringImpl::copyChars(position, string->characters(), length); + if (string->is8Bit()) + StringImpl::copyChars(position, string->characters8(), length); + else + StringImpl::copyChars(position, string->characters16(), length); } ASSERT(buffer == position); @@ -214,7 +220,7 @@ void JSRopeString::outOfMemory(ExecState* exec) const for (size_t i = 0; i < s_maxInternalRopeLength && m_fibers[i]; ++i) m_fibers[i].clear(); ASSERT(isRope()); - ASSERT(m_value == UString()); + ASSERT(m_value.isNull()); if (exec) throwOutOfMemoryError(exec); } @@ -225,7 +231,7 @@ JSString* JSRopeString::getIndexSlowCase(ExecState* exec, unsigned i) resolveRope(exec); // Return a safe no-value result, this should never be used, since the excetion will be thrown. if (exec->exception()) - return jsString(exec, ""); + return jsEmptyString(exec); ASSERT(!isRope()); ASSERT(i < m_value.length()); return jsSingleCharacterSubstring(exec, m_value, i); -- cgit v1.2.1