summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/runtime/JSValue.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/JavaScriptCore/runtime/JSValue.cpp')
-rw-r--r--Source/JavaScriptCore/runtime/JSValue.cpp14
1 files changed, 7 insertions, 7 deletions
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<JSString*>(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<JSString*>(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