From cd44dc59cdfc39534aef4d417e9f3c412e3be139 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 3 Feb 2012 09:55:33 +0100 Subject: Imported WebKit commit fce473cb4d55aa9fe9d0b0322a2fffecb731b961 (http://svn.webkit.org/repository/webkit/trunk@106560) --- Source/JavaScriptCore/runtime/JSValue.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'Source/JavaScriptCore/runtime/JSValue.cpp') diff --git a/Source/JavaScriptCore/runtime/JSValue.cpp b/Source/JavaScriptCore/runtime/JSValue.cpp index a5d3d936a..6b803c316 100644 --- a/Source/JavaScriptCore/runtime/JSValue.cpp +++ b/Source/JavaScriptCore/runtime/JSValue.cpp @@ -204,10 +204,9 @@ bool JSValue::isValidCallee() return asObject(asCell())->globalObject(); } -JSString* JSValue::toPrimitiveString(ExecState* exec) const +JSString* JSValue::toStringSlowCase(ExecState* exec) const { - if (isString()) - return static_cast(asCell()); + ASSERT(!isString()); if (isInt32()) return jsString(&exec->globalData(), exec->globalData().numericStrings.add(asInt32())); if (isDouble()) @@ -222,10 +221,11 @@ JSString* JSValue::toPrimitiveString(ExecState* exec) const return jsNontrivialString(exec, exec->propertyNames().undefined.ustring()); ASSERT(isCell()); - JSValue v = asCell()->toPrimitive(exec, NoPreference); - if (v.isString()) - return static_cast(v.asCell()); - return jsString(&exec->globalData(), v.toString(exec)); + JSValue value = asCell()->toPrimitive(exec, PreferString); + if (exec->hadException()) + return jsEmptyString(exec); + ASSERT(!value.isObject()); + return value.toString(exec); } } // namespace JSC -- cgit v1.2.1