summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/runtime/JSString.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-09-10 19:10:20 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-09-10 19:10:20 +0200
commit284837daa07b29d6a63a748544a90b1f5842ac5c (patch)
treeecd258180bde91fe741e0cfd2638beb3c6da7e8e /Source/JavaScriptCore/runtime/JSString.cpp
parent2e2ba8ff45915f40ed3e014101269c175f2a89a0 (diff)
downloadqtwebkit-284837daa07b29d6a63a748544a90b1f5842ac5c.tar.gz
Imported WebKit commit 68645295d2e3e09af2c942f092556f06aa5f8b0d (http://svn.webkit.org/repository/webkit/trunk@128073)
New snapshot
Diffstat (limited to 'Source/JavaScriptCore/runtime/JSString.cpp')
-rw-r--r--Source/JavaScriptCore/runtime/JSString.cpp16
1 files changed, 11 insertions, 5 deletions
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<StringImpl*>(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);