Bug 40094 - The return type of NativeFunction should be EncodedJSValue
On Windows & Linux, using JSVALUE32_64, EncodedJSValue is returned in registers, but JSValue is not.
Reviewed by Oliver Hunt.
JavaScriptCore:
* API/JSCallbackFunction.cpp:
(JSC::JSCallbackFunction::call):
* API/JSCallbackFunction.h:
* API/JSCallbackObject.h:
* API/JSCallbackObjectFunctions.h:
(JSC::::call):
* JavaScriptCore.exp:
* interpreter/Interpreter.cpp:
(JSC::Interpreter::executeCall):
* jit/JITStubs.cpp:
(JSC::DEFINE_STUB_FUNCTION):
* jit/JITStubs.h:
* jsc.cpp:
(functionPrint):
(functionDebug):
(functionGC):
(functionVersion):
(functionRun):
(functionLoad):
(functionCheckSyntax):
(functionSetSamplingFlags):
(functionClearSamplingFlags):
(functionReadline):
(functionQuit):
* runtime/ArrayConstructor.cpp:
(JSC::callArrayConstructor):
(JSC::arrayConstructorIsArray):
* runtime/ArrayPrototype.cpp:
(JSC::arrayProtoFuncToString):
(JSC::arrayProtoFuncToLocaleString):
(JSC::arrayProtoFuncJoin):
(JSC::arrayProtoFuncConcat):
(JSC::arrayProtoFuncPop):
(JSC::arrayProtoFuncPush):
(JSC::arrayProtoFuncReverse):
(JSC::arrayProtoFuncShift):
(JSC::arrayProtoFuncSlice):
(JSC::arrayProtoFuncSort):
(JSC::arrayProtoFuncSplice):
(JSC::arrayProtoFuncUnShift):
(JSC::arrayProtoFuncFilter):
(JSC::arrayProtoFuncMap):
(JSC::arrayProtoFuncEvery):
(JSC::arrayProtoFuncForEach):
(JSC::arrayProtoFuncSome):
(JSC::arrayProtoFuncReduce):
(JSC::arrayProtoFuncReduceRight):
(JSC::arrayProtoFuncIndexOf):
(JSC::arrayProtoFuncLastIndexOf):
* runtime/BooleanConstructor.cpp:
(JSC::callBooleanConstructor):
* runtime/BooleanPrototype.cpp:
(JSC::booleanProtoFuncToString):
(JSC::booleanProtoFuncValueOf):
* runtime/CallData.h:
* runtime/DateConstructor.cpp:
(JSC::callDate):
(JSC::dateParse):
(JSC::dateNow):
(JSC::dateUTC):
* runtime/DatePrototype.cpp:
(JSC::dateProtoFuncToString):
(JSC::dateProtoFuncToUTCString):
(JSC::dateProtoFuncToISOString):
(JSC::dateProtoFuncToDateString):
(JSC::dateProtoFuncToTimeString):
(JSC::dateProtoFuncToLocaleString):
(JSC::dateProtoFuncToLocaleDateString):
(JSC::dateProtoFuncToLocaleTimeString):
(JSC::dateProtoFuncGetTime):
(JSC::dateProtoFuncGetFullYear):
(JSC::dateProtoFuncGetUTCFullYear):
(JSC::dateProtoFuncToGMTString):
(JSC::dateProtoFuncGetMonth):
(JSC::dateProtoFuncGetUTCMonth):
(JSC::dateProtoFuncGetDate):
(JSC::dateProtoFuncGetUTCDate):
(JSC::dateProtoFuncGetDay):
(JSC::dateProtoFuncGetUTCDay):
(JSC::dateProtoFuncGetHours):
(JSC::dateProtoFuncGetUTCHours):
(JSC::dateProtoFuncGetMinutes):
(JSC::dateProtoFuncGetUTCMinutes):
(JSC::dateProtoFuncGetSeconds):
(JSC::dateProtoFuncGetUTCSeconds):
(JSC::dateProtoFuncGetMilliSeconds):
(JSC::dateProtoFuncGetUTCMilliseconds):
(JSC::dateProtoFuncGetTimezoneOffset):
(JSC::dateProtoFuncSetTime):
(JSC::dateProtoFuncSetMilliSeconds):
(JSC::dateProtoFuncSetUTCMilliseconds):
(JSC::dateProtoFuncSetSeconds):
(JSC::dateProtoFuncSetUTCSeconds):
(JSC::dateProtoFuncSetMinutes):
(JSC::dateProtoFuncSetUTCMinutes):
(JSC::dateProtoFuncSetHours):
(JSC::dateProtoFuncSetUTCHours):
(JSC::dateProtoFuncSetDate):
(JSC::dateProtoFuncSetUTCDate):
(JSC::dateProtoFuncSetMonth):
(JSC::dateProtoFuncSetUTCMonth):
(JSC::dateProtoFuncSetFullYear):
(JSC::dateProtoFuncSetUTCFullYear):
(JSC::dateProtoFuncSetYear):
(JSC::dateProtoFuncGetYear):
(JSC::dateProtoFuncToJSON):
* runtime/ErrorConstructor.cpp:
(JSC::callErrorConstructor):
* runtime/ErrorPrototype.cpp:
(JSC::errorProtoFuncToString):
* runtime/FunctionConstructor.cpp:
(JSC::callFunctionConstructor):
* runtime/FunctionPrototype.cpp:
(JSC::callFunctionPrototype):
(JSC::functionProtoFuncToString):
(JSC::functionProtoFuncApply):
(JSC::functionProtoFuncCall):
* runtime/JSCell.h:
(JSC::getCallData):
(JSC::getConstructData):
* runtime/JSFunction.cpp:
(JSC::callHostFunctionAsConstructor):
* runtime/JSFunction.h:
* runtime/JSGlobalObjectFunctions.cpp:
(JSC::globalFuncEval):
(JSC::globalFuncParseInt):
(JSC::globalFuncParseFloat):
(JSC::globalFuncIsNaN):
(JSC::globalFuncIsFinite):
(JSC::globalFuncDecodeURI):
(JSC::globalFuncDecodeURIComponent):
(JSC::globalFuncEncodeURI):
(JSC::globalFuncEncodeURIComponent):
(JSC::globalFuncEscape):
(JSC::globalFuncUnescape):
(JSC::globalFuncJSCPrint):
* runtime/JSGlobalObjectFunctions.h:
* runtime/JSONObject.cpp:
(JSC::JSONProtoFuncParse):
(JSC::JSONProtoFuncStringify):
* runtime/JSObject.cpp:
(JSC::callDefaultValueFunction):
* runtime/JSValue.h:
* runtime/MathObject.cpp:
(JSC::mathProtoFuncAbs):
(JSC::mathProtoFuncACos):
(JSC::mathProtoFuncASin):
(JSC::mathProtoFuncATan):
(JSC::mathProtoFuncATan2):
(JSC::mathProtoFuncCeil):
(JSC::mathProtoFuncCos):
(JSC::mathProtoFuncExp):
(JSC::mathProtoFuncFloor):
(JSC::mathProtoFuncLog):
(JSC::mathProtoFuncMax):
(JSC::mathProtoFuncMin):
(JSC::mathProtoFuncPow):
(JSC::mathProtoFuncRandom):
(JSC::mathProtoFuncRound):
(JSC::mathProtoFuncSin):
(JSC::mathProtoFuncSqrt):
(JSC::mathProtoFuncTan):
* runtime/NativeErrorConstructor.cpp:
(JSC::callNativeErrorConstructor):
* runtime/NumberConstructor.cpp:
(JSC::callNumberConstructor):
* runtime/NumberPrototype.cpp:
(JSC::numberProtoFuncToString):
(JSC::numberProtoFuncToLocaleString):
(JSC::numberProtoFuncValueOf):
(JSC::numberProtoFuncToFixed):
(JSC::numberProtoFuncToExponential):
(JSC::numberProtoFuncToPrecision):
* runtime/ObjectConstructor.cpp:
(JSC::callObjectConstructor):
(JSC::objectConstructorGetPrototypeOf):
(JSC::objectConstructorGetOwnPropertyDescriptor):
(JSC::objectConstructorGetOwnPropertyNames):
(JSC::objectConstructorKeys):
(JSC::toPropertyDescriptor):
(JSC::objectConstructorDefineProperty):
(JSC::objectConstructorDefineProperties):
(JSC::objectConstructorCreate):
* runtime/ObjectPrototype.cpp:
(JSC::objectProtoFuncValueOf):
(JSC::objectProtoFuncHasOwnProperty):
(JSC::objectProtoFuncIsPrototypeOf):
(JSC::objectProtoFuncDefineGetter):
(JSC::objectProtoFuncDefineSetter):
(JSC::objectProtoFuncLookupGetter):
(JSC::objectProtoFuncLookupSetter):
(JSC::objectProtoFuncPropertyIsEnumerable):
(JSC::objectProtoFuncToLocaleString):
(JSC::objectProtoFuncToString):
* runtime/ObjectPrototype.h:
* runtime/RegExpConstructor.cpp:
(JSC::callRegExpConstructor):
* runtime/RegExpObject.cpp:
(JSC::callRegExpObject):
* runtime/RegExpPrototype.cpp:
(JSC::regExpProtoFuncTest):
(JSC::regExpProtoFuncExec):
(JSC::regExpProtoFuncCompile):
(JSC::regExpProtoFuncToString):
* runtime/StringConstructor.cpp:
(JSC::stringFromCharCode):
(JSC::callStringConstructor):
* runtime/StringPrototype.cpp:
(JSC::stringProtoFuncReplace):
(JSC::stringProtoFuncToString):
(JSC::stringProtoFuncCharAt):
(JSC::stringProtoFuncCharCodeAt):
(JSC::stringProtoFuncConcat):
(JSC::stringProtoFuncIndexOf):
(JSC::stringProtoFuncLastIndexOf):
(JSC::stringProtoFuncMatch):
(JSC::stringProtoFuncSearch):
(JSC::stringProtoFuncSlice):
(JSC::stringProtoFuncSplit):
(JSC::stringProtoFuncSubstr):
(JSC::stringProtoFuncSubstring):
(JSC::stringProtoFuncToLowerCase):
(JSC::stringProtoFuncToUpperCase):
(JSC::stringProtoFuncLocaleCompare):
(JSC::stringProtoFuncBig):
(JSC::stringProtoFuncSmall):
(JSC::stringProtoFuncBlink):
(JSC::stringProtoFuncBold):
(JSC::stringProtoFuncFixed):
(JSC::stringProtoFuncItalics):
(JSC::stringProtoFuncStrike):
(JSC::stringProtoFuncSub):
(JSC::stringProtoFuncSup):
(JSC::stringProtoFuncFontcolor):
(JSC::stringProtoFuncFontsize):
(JSC::stringProtoFuncAnchor):
(JSC::stringProtoFuncLink):
(JSC::stringProtoFuncTrim):
(JSC::stringProtoFuncTrimLeft):
(JSC::stringProtoFuncTrimRight):
JavaScriptGlue:
* JSObject.cpp:
(nativeCallFunction):
WebCore:
* bindings/js/JSCallbackData.cpp:
(WebCore::JSCallbackData::invokeCallback):
* bindings/js/JSCustomXPathNSResolver.cpp:
(WebCore::JSCustomXPathNSResolver::lookupNamespaceURI):
* bindings/js/JSEventListener.cpp:
(WebCore::JSEventListener::handleEvent):
* bindings/js/JSHTMLAllCollectionCustom.cpp:
(WebCore::callHTMLAllCollection):
* bindings/js/JSHTMLCollectionCustom.cpp:
(WebCore::callHTMLCollection):
* bindings/js/JSHTMLDocumentCustom.cpp:
(WebCore::JSHTMLDocument::open):
* bindings/js/JSInjectedScriptHostCustom.cpp:
(WebCore::InjectedScriptHost::createInjectedScript):
* bindings/js/JSNodeFilterCondition.cpp:
(WebCore::JSNodeFilterCondition::acceptNode):
* bindings/js/JSNodeListCustom.cpp:
(WebCore::callNodeList):
* bindings/js/JSPluginElementFunctions.cpp:
(WebCore::callPlugin):
* bindings/js/ScheduledAction.cpp:
(WebCore::ScheduledAction::create):
(WebCore::ScheduledAction::executeFunctionInContext):
* bindings/js/ScriptFunctionCall.cpp:
(WebCore::ScriptFunctionCall::call):
* bindings/js/SerializedScriptValue.cpp:
(WebCore::SerializingTreeWalker::convertIfTerminal):
* bindings/objc/WebScriptObject.mm:
(-[WebScriptObject callWebScriptMethod:withArguments:]):
* bindings/scripts/CodeGeneratorJS.pm:
* bridge/NP_jsobject.cpp:
(_NPN_InvokeDefault):
(_NPN_Invoke):
(_NPN_Construct):
* bridge/jni/jni_jsobject.mm:
(JavaJSObject::call):
* bridge/objc/objc_runtime.mm:
(JSC::Bindings::callObjCFallbackObject):
* bridge/runtime_method.cpp:
(JSC::callRuntimeMethod):
* bridge/runtime_object.cpp:
(JSC::Bindings::callRuntimeObject):
WebKit/mac:
* Plugins/Hosted/NetscapePluginInstanceProxy.h:
* Plugins/Hosted/NetscapePluginInstanceProxy.mm:
(WebKit::NetscapePluginInstanceProxy::invoke):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@60631 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JavaScriptCore/runtime/ArrayConstructor.cpp b/JavaScriptCore/runtime/ArrayConstructor.cpp
index 674d00a..5a576c4 100644
--- a/JavaScriptCore/runtime/ArrayConstructor.cpp
+++ b/JavaScriptCore/runtime/ArrayConstructor.cpp
@@ -35,7 +35,7 @@
ASSERT_CLASS_FITS_IN_CELL(ArrayConstructor);
-static JSValue JSC_HOST_CALL arrayConstructorIsArray(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayConstructorIsArray(ExecState*);
ArrayConstructor::ArrayConstructor(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, ArrayPrototype* arrayPrototype, Structure* prototypeFunctionStructure)
: InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, arrayPrototype->classInfo()->className))
@@ -76,10 +76,10 @@
return ConstructTypeHost;
}
-static JSValue JSC_HOST_CALL callArrayConstructor(ExecState* exec)
+static EncodedJSValue JSC_HOST_CALL callArrayConstructor(ExecState* exec)
{
ArgList args(exec);
- return constructArrayWithSizeQuirk(exec, args);
+ return JSValue::encode(constructArrayWithSizeQuirk(exec, args));
}
// ECMA 15.6.1
@@ -90,9 +90,9 @@
return CallTypeHost;
}
-JSValue JSC_HOST_CALL arrayConstructorIsArray(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL arrayConstructorIsArray(ExecState* exec)
{
- return jsBoolean(exec->argument(0).inherits(&JSArray::info));
+ return JSValue::encode(jsBoolean(exec->argument(0).inherits(&JSArray::info)));
}
} // namespace JSC
diff --git a/JavaScriptCore/runtime/ArrayPrototype.cpp b/JavaScriptCore/runtime/ArrayPrototype.cpp
index c7dea3b..c88a7e8 100644
--- a/JavaScriptCore/runtime/ArrayPrototype.cpp
+++ b/JavaScriptCore/runtime/ArrayPrototype.cpp
@@ -40,27 +40,27 @@
ASSERT_CLASS_FITS_IN_CELL(ArrayPrototype);
-static JSValue JSC_HOST_CALL arrayProtoFuncToString(ExecState*);
-static JSValue JSC_HOST_CALL arrayProtoFuncToLocaleString(ExecState*);
-static JSValue JSC_HOST_CALL arrayProtoFuncConcat(ExecState*);
-static JSValue JSC_HOST_CALL arrayProtoFuncJoin(ExecState*);
-static JSValue JSC_HOST_CALL arrayProtoFuncPop(ExecState*);
-static JSValue JSC_HOST_CALL arrayProtoFuncPush(ExecState*);
-static JSValue JSC_HOST_CALL arrayProtoFuncReverse(ExecState*);
-static JSValue JSC_HOST_CALL arrayProtoFuncShift(ExecState*);
-static JSValue JSC_HOST_CALL arrayProtoFuncSlice(ExecState*);
-static JSValue JSC_HOST_CALL arrayProtoFuncSort(ExecState*);
-static JSValue JSC_HOST_CALL arrayProtoFuncSplice(ExecState*);
-static JSValue JSC_HOST_CALL arrayProtoFuncUnShift(ExecState*);
-static JSValue JSC_HOST_CALL arrayProtoFuncEvery(ExecState*);
-static JSValue JSC_HOST_CALL arrayProtoFuncForEach(ExecState*);
-static JSValue JSC_HOST_CALL arrayProtoFuncSome(ExecState*);
-static JSValue JSC_HOST_CALL arrayProtoFuncIndexOf(ExecState*);
-static JSValue JSC_HOST_CALL arrayProtoFuncFilter(ExecState*);
-static JSValue JSC_HOST_CALL arrayProtoFuncMap(ExecState*);
-static JSValue JSC_HOST_CALL arrayProtoFuncReduce(ExecState*);
-static JSValue JSC_HOST_CALL arrayProtoFuncReduceRight(ExecState*);
-static JSValue JSC_HOST_CALL arrayProtoFuncLastIndexOf(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncToString(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncToLocaleString(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncConcat(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncJoin(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncPop(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncPush(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncReverse(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncShift(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncSlice(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncSort(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncSplice(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncUnShift(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncEvery(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncForEach(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncSome(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncIndexOf(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncFilter(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncMap(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncReduce(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncReduceRight(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncLastIndexOf(ExecState*);
}
@@ -149,23 +149,23 @@
obj->put(exec, propertyName, value, slot);
}
-JSValue JSC_HOST_CALL arrayProtoFuncToString(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncToString(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
bool isRealArray = isJSArray(&exec->globalData(), thisValue);
if (!isRealArray && !thisValue.inherits(&JSArray::info))
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
JSArray* thisObj = asArray(thisValue);
HashSet<JSObject*>& arrayVisitedElements = exec->globalData().arrayVisitedElements;
if (arrayVisitedElements.size() >= MaxSmallThreadReentryDepth) {
if (arrayVisitedElements.size() >= exec->globalData().maxReentryDepth)
- return throwError(exec, RangeError, "Maximum call stack size exceeded.");
+ return JSValue::encode(throwError(exec, RangeError, "Maximum call stack size exceeded."));
}
bool alreadyVisited = !arrayVisitedElements.add(thisObj).second;
if (alreadyVisited)
- return jsEmptyString(exec); // return an empty string, avoiding infinite recursion.
+ return JSValue::encode(jsEmptyString(exec)); // return an empty string, avoiding infinite recursion.
unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
unsigned totalSize = length ? length - 1 : 0;
@@ -193,11 +193,11 @@
}
arrayVisitedElements.remove(thisObj);
if (!totalSize)
- return jsEmptyString(exec);
+ return JSValue::encode(jsEmptyString(exec));
Vector<UChar> buffer;
buffer.reserveCapacity(totalSize);
if (!buffer.data())
- return throwOutOfMemoryError(exec);
+ return JSValue::encode(throwOutOfMemoryError(exec));
for (unsigned i = 0; i < length; i++) {
if (i)
@@ -206,25 +206,25 @@
buffer.append(rep->characters(), rep->length());
}
ASSERT(buffer.size() == totalSize);
- return jsString(exec, UString::adopt(buffer));
+ return JSValue::encode(jsString(exec, UString::adopt(buffer)));
}
-JSValue JSC_HOST_CALL arrayProtoFuncToLocaleString(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncToLocaleString(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSArray::info))
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
JSObject* thisObj = asArray(thisValue);
HashSet<JSObject*>& arrayVisitedElements = exec->globalData().arrayVisitedElements;
if (arrayVisitedElements.size() >= MaxSmallThreadReentryDepth) {
if (arrayVisitedElements.size() >= exec->globalData().maxReentryDepth)
- return throwError(exec, RangeError, "Maximum call stack size exceeded.");
+ return JSValue::encode(throwError(exec, RangeError, "Maximum call stack size exceeded."));
}
bool alreadyVisited = !arrayVisitedElements.add(thisObj).second;
if (alreadyVisited)
- return jsEmptyString(exec); // return an empty string, avoding infinite recursion.
+ return JSValue::encode(jsEmptyString(exec)); // return an empty string, avoding infinite recursion.
JSStringBuilder strBuffer;
unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
@@ -238,7 +238,7 @@
JSValue conversionFunction = o->get(exec, exec->propertyNames().toLocaleString);
UString str;
CallData callData;
- CallType callType = conversionFunction.getCallData(callData);
+ CallType callType = getCallData(conversionFunction, callData);
if (callType != CallTypeNone)
str = call(exec, conversionFunction, callType, callData, element, exec->emptyList()).toString(exec);
else
@@ -247,10 +247,10 @@
}
}
arrayVisitedElements.remove(thisObj);
- return strBuffer.build(exec);
+ return JSValue::encode(strBuffer.build(exec));
}
-JSValue JSC_HOST_CALL arrayProtoFuncJoin(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncJoin(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
JSObject* thisObj = thisValue.toThisObject(exec);
@@ -258,12 +258,12 @@
HashSet<JSObject*>& arrayVisitedElements = exec->globalData().arrayVisitedElements;
if (arrayVisitedElements.size() >= MaxSmallThreadReentryDepth) {
if (arrayVisitedElements.size() >= exec->globalData().maxReentryDepth)
- return throwError(exec, RangeError, "Maximum call stack size exceeded.");
+ return JSValue::encode(throwError(exec, RangeError, "Maximum call stack size exceeded."));
}
bool alreadyVisited = !arrayVisitedElements.add(thisObj).second;
if (alreadyVisited)
- return jsEmptyString(exec); // return an empty string, avoding infinite recursion.
+ return JSValue::encode(jsEmptyString(exec)); // return an empty string, avoding infinite recursion.
JSStringBuilder strBuffer;
@@ -319,10 +319,10 @@
strBuffer.append(element.toString(exec));
}
arrayVisitedElements.remove(thisObj);
- return strBuffer.build(exec);
+ return JSValue::encode(strBuffer.build(exec));
}
-JSValue JSC_HOST_CALL arrayProtoFuncConcat(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncConcat(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
JSArray* arr = constructEmptyArray(exec);
@@ -349,14 +349,14 @@
++i;
}
arr->setLength(n);
- return arr;
+ return JSValue::encode(arr);
}
-JSValue JSC_HOST_CALL arrayProtoFuncPop(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncPop(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (isJSArray(&exec->globalData(), thisValue))
- return asArray(thisValue)->pop();
+ return JSValue::encode(asArray(thisValue)->pop());
JSObject* thisObj = thisValue.toThisObject(exec);
JSValue result;
@@ -369,16 +369,16 @@
thisObj->deleteProperty(exec, length - 1);
putProperty(exec, thisObj, exec->propertyNames().length, jsNumber(exec, length - 1));
}
- return result;
+ return JSValue::encode(result);
}
-JSValue JSC_HOST_CALL arrayProtoFuncPush(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncPush(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (isJSArray(&exec->globalData(), thisValue) && exec->argumentCount() == 1) {
JSArray* array = asArray(thisValue);
array->push(exec, exec->argument(0));
- return jsNumber(exec, array->length());
+ return JSValue::encode(jsNumber(exec, array->length()));
}
JSObject* thisObj = thisValue.toThisObject(exec);
@@ -387,10 +387,10 @@
thisObj->put(exec, length + n, exec->argument(n));
length += exec->argumentCount();
putProperty(exec, thisObj, exec->propertyNames().length, jsNumber(exec, length));
- return jsNumber(exec, length);
+ return JSValue::encode(jsNumber(exec, length));
}
-JSValue JSC_HOST_CALL arrayProtoFuncReverse(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncReverse(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
JSObject* thisObj = thisValue.toThisObject(exec);
@@ -412,10 +412,10 @@
else
thisObj->deleteProperty(exec, lk1);
}
- return thisObj;
+ return JSValue::encode(thisObj);
}
-JSValue JSC_HOST_CALL arrayProtoFuncShift(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncShift(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
JSObject* thisObj = thisValue.toThisObject(exec);
@@ -436,10 +436,10 @@
thisObj->deleteProperty(exec, length - 1);
putProperty(exec, thisObj, exec->propertyNames().length, jsNumber(exec, length - 1));
}
- return result;
+ return JSValue::encode(result);
}
-JSValue JSC_HOST_CALL arrayProtoFuncSlice(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncSlice(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
// http://developer.netscape.com/docs/manuals/js/client/jsref/array.htm#1193713 or 15.4.4.10
@@ -482,17 +482,17 @@
resObj->put(exec, n, v);
}
resObj->setLength(n);
- return result;
+ return JSValue::encode(result);
}
-JSValue JSC_HOST_CALL arrayProtoFuncSort(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncSort(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
JSObject* thisObj = thisValue.toThisObject(exec);
JSValue function = exec->argument(0);
CallData callData;
- CallType callType = function.getCallData(callData);
+ CallType callType = getCallData(function, callData);
if (thisObj->classInfo() == &JSArray::info) {
if (isNumericCompareFunction(exec, callType, callData))
@@ -501,13 +501,13 @@
asArray(thisObj)->sort(exec, function, callType, callData);
else
asArray(thisObj)->sort(exec);
- return thisObj;
+ return JSValue::encode(thisObj);
}
unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
if (!length)
- return thisObj;
+ return JSValue::encode(thisObj);
// "Min" sort. Not the fastest, but definitely less code than heapsort
// or quicksort, and much less swapping than bubblesort/insertionsort.
@@ -541,10 +541,10 @@
thisObj->put(exec, themin, iObj);
}
}
- return thisObj;
+ return JSValue::encode(thisObj);
}
-JSValue JSC_HOST_CALL arrayProtoFuncSplice(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncSplice(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
JSObject* thisObj = thisValue.toThisObject(exec);
@@ -555,7 +555,7 @@
// FIXME: Firefox returns an empty array.
if (!exec->argumentCount())
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
double relativeBegin = exec->argument(0).toInteger(exec);
@@ -602,10 +602,10 @@
thisObj->put(exec, k + begin, exec->argument(k + 2));
putProperty(exec, thisObj, exec->propertyNames().length, jsNumber(exec, length - deleteCount + additionalArgs));
- return result;
+ return JSValue::encode(result);
}
-JSValue JSC_HOST_CALL arrayProtoFuncUnShift(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncUnShift(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
JSObject* thisObj = thisValue.toThisObject(exec);
@@ -625,19 +625,19 @@
thisObj->put(exec, k, exec->argument(k));
JSValue result = jsNumber(exec, length + nrArgs);
putProperty(exec, thisObj, exec->propertyNames().length, result);
- return result;
+ return JSValue::encode(result);
}
-JSValue JSC_HOST_CALL arrayProtoFuncFilter(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncFilter(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
JSObject* thisObj = thisValue.toThisObject(exec);
JSValue function = exec->argument(0);
CallData callData;
- CallType callType = function.getCallData(callData);
+ CallType callType = getCallData(function, callData);
if (callType == CallTypeNone)
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
JSObject* applyThis = exec->argument(1).isUndefinedOrNull() ? exec->globalThisValue() : exec->argument(1).toObject(exec);
JSArray* resultArray = constructEmptyArray(exec);
@@ -663,7 +663,7 @@
resultArray->put(exec, filterIndex++, v);
}
if (k == length)
- return resultArray;
+ return JSValue::encode(resultArray);
}
for (; k < length && !exec->hadException(); ++k) {
PropertySlot slot(thisObj);
@@ -684,19 +684,19 @@
if (result.toBoolean(exec))
resultArray->put(exec, filterIndex++, v);
}
- return resultArray;
+ return JSValue::encode(resultArray);
}
-JSValue JSC_HOST_CALL arrayProtoFuncMap(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncMap(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
JSObject* thisObj = thisValue.toThisObject(exec);
JSValue function = exec->argument(0);
CallData callData;
- CallType callType = function.getCallData(callData);
+ CallType callType = getCallData(function, callData);
if (callType == CallTypeNone)
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
JSObject* applyThis = exec->argument(1).isUndefinedOrNull() ? exec->globalThisValue() : exec->argument(1).toObject(exec);
@@ -737,7 +737,7 @@
resultArray->put(exec, k, result);
}
- return resultArray;
+ return JSValue::encode(resultArray);
}
// Documentation for these three is available at:
@@ -745,16 +745,16 @@
// http://developer-test.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Objects:Array:forEach
// http://developer-test.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Objects:Array:some
-JSValue JSC_HOST_CALL arrayProtoFuncEvery(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncEvery(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
JSObject* thisObj = thisValue.toThisObject(exec);
JSValue function = exec->argument(0);
CallData callData;
- CallType callType = function.getCallData(callData);
+ CallType callType = getCallData(function, callData);
if (callType == CallTypeNone)
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
JSObject* applyThis = exec->argument(1).isUndefinedOrNull() ? exec->globalThisValue() : exec->argument(1).toObject(exec);
@@ -776,7 +776,7 @@
cachedCall.setArgument(2, thisObj);
JSValue result = cachedCall.call();
if (!result.toBoolean(cachedCall.newCallFrame(exec)))
- return jsBoolean(false);
+ return JSValue::encode(jsBoolean(false));
}
}
for (; k < length && !exec->hadException(); ++k) {
@@ -799,19 +799,19 @@
}
}
- return result;
+ return JSValue::encode(result);
}
-JSValue JSC_HOST_CALL arrayProtoFuncForEach(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncForEach(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
JSObject* thisObj = thisValue.toThisObject(exec);
JSValue function = exec->argument(0);
CallData callData;
- CallType callType = function.getCallData(callData);
+ CallType callType = getCallData(function, callData);
if (callType == CallTypeNone)
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
JSObject* applyThis = exec->argument(1).isUndefinedOrNull() ? exec->globalThisValue() : exec->argument(1).toObject(exec);
@@ -845,19 +845,19 @@
call(exec, function, callType, callData, applyThis, eachArguments);
}
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
}
-JSValue JSC_HOST_CALL arrayProtoFuncSome(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncSome(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
JSObject* thisObj = thisValue.toThisObject(exec);
JSValue function = exec->argument(0);
CallData callData;
- CallType callType = function.getCallData(callData);
+ CallType callType = getCallData(function, callData);
if (callType == CallTypeNone)
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
JSObject* applyThis = exec->argument(1).isUndefinedOrNull() ? exec->globalThisValue() : exec->argument(1).toObject(exec);
@@ -879,7 +879,7 @@
cachedCall.setArgument(2, thisObj);
JSValue result = cachedCall.call();
if (result.toBoolean(cachedCall.newCallFrame(exec)))
- return jsBoolean(true);
+ return JSValue::encode(jsBoolean(true));
}
}
for (; k < length && !exec->hadException(); ++k) {
@@ -899,25 +899,25 @@
break;
}
}
- return result;
+ return JSValue::encode(result);
}
-JSValue JSC_HOST_CALL arrayProtoFuncReduce(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncReduce(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
JSObject* thisObj = thisValue.toThisObject(exec);
JSValue function = exec->argument(0);
CallData callData;
- CallType callType = function.getCallData(callData);
+ CallType callType = getCallData(function, callData);
if (callType == CallTypeNone)
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
unsigned i = 0;
JSValue rv;
unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
if (!length && exec->argumentCount() == 1)
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
JSArray* array = 0;
if (isJSArray(&exec->globalData(), thisObj))
array = asArray(thisObj);
@@ -934,7 +934,7 @@
break;
}
if (!rv)
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
i++;
}
@@ -954,7 +954,7 @@
rv = cachedCall.call();
}
if (i == length) // only return if we reached the end of the array
- return rv;
+ return JSValue::encode(rv);
}
for (; i < length && !exec->hadException(); ++i) {
@@ -970,25 +970,25 @@
rv = call(exec, function, callType, callData, jsNull(), eachArguments);
}
- return rv;
+ return JSValue::encode(rv);
}
-JSValue JSC_HOST_CALL arrayProtoFuncReduceRight(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncReduceRight(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
JSObject* thisObj = thisValue.toThisObject(exec);
JSValue function = exec->argument(0);
CallData callData;
- CallType callType = function.getCallData(callData);
+ CallType callType = getCallData(function, callData);
if (callType == CallTypeNone)
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
unsigned i = 0;
JSValue rv;
unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
if (!length && exec->argumentCount() == 1)
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
JSArray* array = 0;
if (isJSArray(&exec->globalData(), thisObj))
array = asArray(thisObj);
@@ -1005,7 +1005,7 @@
break;
}
if (!rv)
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
i++;
}
@@ -1023,7 +1023,7 @@
rv = cachedCall.call();
}
if (i == length) // only return if we reached the end of the array
- return rv;
+ return JSValue::encode(rv);
}
for (; i < length && !exec->hadException(); ++i) {
@@ -1040,10 +1040,10 @@
rv = call(exec, function, callType, callData, jsNull(), eachArguments);
}
- return rv;
+ return JSValue::encode(rv);
}
-JSValue JSC_HOST_CALL arrayProtoFuncIndexOf(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncIndexOf(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
// JavaScript 1.5 Extension by Mozilla
@@ -1069,13 +1069,13 @@
if (!e)
continue;
if (JSValue::strictEqual(exec, searchElement, e))
- return jsNumber(exec, index);
+ return JSValue::encode(jsNumber(exec, index));
}
- return jsNumber(exec, -1);
+ return JSValue::encode(jsNumber(exec, -1));
}
-JSValue JSC_HOST_CALL arrayProtoFuncLastIndexOf(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncLastIndexOf(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
// JavaScript 1.6 Extension by Mozilla
@@ -1090,7 +1090,7 @@
if (d < 0) {
d += length;
if (d < 0)
- return jsNumber(exec, -1);
+ return JSValue::encode(jsNumber(exec, -1));
}
if (d < length)
index = static_cast<int>(d);
@@ -1101,10 +1101,10 @@
if (!e)
continue;
if (JSValue::strictEqual(exec, searchElement, e))
- return jsNumber(exec, index);
+ return JSValue::encode(jsNumber(exec, index));
}
- return jsNumber(exec, -1);
+ return JSValue::encode(jsNumber(exec, -1));
}
} // namespace JSC
diff --git a/JavaScriptCore/runtime/BooleanConstructor.cpp b/JavaScriptCore/runtime/BooleanConstructor.cpp
index bc12858..06cf90a 100644
--- a/JavaScriptCore/runtime/BooleanConstructor.cpp
+++ b/JavaScriptCore/runtime/BooleanConstructor.cpp
@@ -57,9 +57,9 @@
}
// ECMA 15.6.1
-static JSValue JSC_HOST_CALL callBooleanConstructor(ExecState* exec)
+static EncodedJSValue JSC_HOST_CALL callBooleanConstructor(ExecState* exec)
{
- return jsBoolean(exec->argument(0).toBoolean(exec));
+ return JSValue::encode(jsBoolean(exec->argument(0).toBoolean(exec)));
}
CallType BooleanConstructor::getCallData(CallData& callData)
diff --git a/JavaScriptCore/runtime/BooleanPrototype.cpp b/JavaScriptCore/runtime/BooleanPrototype.cpp
index dbb27b2..f79c9c6 100644
--- a/JavaScriptCore/runtime/BooleanPrototype.cpp
+++ b/JavaScriptCore/runtime/BooleanPrototype.cpp
@@ -32,8 +32,8 @@
ASSERT_CLASS_FITS_IN_CELL(BooleanPrototype);
// Functions
-static JSValue JSC_HOST_CALL booleanProtoFuncToString(ExecState*);
-static JSValue JSC_HOST_CALL booleanProtoFuncValueOf(ExecState*);
+static EncodedJSValue JSC_HOST_CALL booleanProtoFuncToString(ExecState*);
+static EncodedJSValue JSC_HOST_CALL booleanProtoFuncValueOf(ExecState*);
// ECMA 15.6.4
@@ -51,35 +51,35 @@
// ECMA 15.6.4.2 + 15.6.4.3
-JSValue JSC_HOST_CALL booleanProtoFuncToString(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL booleanProtoFuncToString(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (thisValue == jsBoolean(false))
- return jsNontrivialString(exec, "false");
+ return JSValue::encode(jsNontrivialString(exec, "false"));
if (thisValue == jsBoolean(true))
- return jsNontrivialString(exec, "true");
+ return JSValue::encode(jsNontrivialString(exec, "true"));
if (!thisValue.inherits(&BooleanObject::info))
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
if (asBooleanObject(thisValue)->internalValue() == jsBoolean(false))
- return jsNontrivialString(exec, "false");
+ return JSValue::encode(jsNontrivialString(exec, "false"));
ASSERT(asBooleanObject(thisValue)->internalValue() == jsBoolean(true));
- return jsNontrivialString(exec, "true");
+ return JSValue::encode(jsNontrivialString(exec, "true"));
}
-JSValue JSC_HOST_CALL booleanProtoFuncValueOf(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL booleanProtoFuncValueOf(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (thisValue.isBoolean())
- return thisValue;
+ return JSValue::encode(thisValue);
if (!thisValue.inherits(&BooleanObject::info))
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
- return asBooleanObject(thisValue)->internalValue();
+ return JSValue::encode(asBooleanObject(thisValue)->internalValue());
}
} // namespace JSC
diff --git a/JavaScriptCore/runtime/CallData.h b/JavaScriptCore/runtime/CallData.h
index 5294e54..32e1094 100644
--- a/JavaScriptCore/runtime/CallData.h
+++ b/JavaScriptCore/runtime/CallData.h
@@ -29,6 +29,7 @@
#ifndef CallData_h
#define CallData_h
+#include "JSValue.h"
#include "NativeFunctionWrapper.h"
namespace JSC {
@@ -37,7 +38,6 @@
class ExecState;
class FunctionExecutable;
class JSObject;
- class JSValue;
class ScopeChainNode;
enum CallType {
@@ -46,7 +46,7 @@
CallTypeJS
};
- typedef JSValue (JSC_HOST_CALL *NativeFunction)(ExecState*);
+ typedef EncodedJSValue (JSC_HOST_CALL *NativeFunction)(ExecState*);
union CallData {
struct {
diff --git a/JavaScriptCore/runtime/DateConstructor.cpp b/JavaScriptCore/runtime/DateConstructor.cpp
index 015a01a..1dde8e7 100644
--- a/JavaScriptCore/runtime/DateConstructor.cpp
+++ b/JavaScriptCore/runtime/DateConstructor.cpp
@@ -54,9 +54,9 @@
ASSERT_CLASS_FITS_IN_CELL(DateConstructor);
-static JSValue JSC_HOST_CALL dateParse(ExecState*);
-static JSValue JSC_HOST_CALL dateNow(ExecState*);
-static JSValue JSC_HOST_CALL dateUTC(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateParse(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateNow(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateUTC(ExecState*);
DateConstructor::DateConstructor(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, Structure* prototypeFunctionStructure, DatePrototype* datePrototype)
: InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, datePrototype->classInfo()->className))
@@ -128,7 +128,7 @@
}
// ECMA 15.9.2
-static JSValue JSC_HOST_CALL callDate(ExecState* exec)
+static EncodedJSValue JSC_HOST_CALL callDate(ExecState* exec)
{
time_t localTime = time(0);
tm localTM;
@@ -138,7 +138,7 @@
DateConversionBuffer time;
formatDate(ts, date);
formatTime(ts, time);
- return jsMakeNontrivialString(exec, date, " ", time);
+ return JSValue::encode(jsMakeNontrivialString(exec, date, " ", time));
}
CallType DateConstructor::getCallData(CallData& callData)
@@ -147,17 +147,17 @@
return CallTypeHost;
}
-static JSValue JSC_HOST_CALL dateParse(ExecState* exec)
+static EncodedJSValue JSC_HOST_CALL dateParse(ExecState* exec)
{
- return jsNumber(exec, parseDate(exec, exec->argument(0).toString(exec)));
+ return JSValue::encode(jsNumber(exec, parseDate(exec, exec->argument(0).toString(exec))));
}
-static JSValue JSC_HOST_CALL dateNow(ExecState* exec)
+static EncodedJSValue JSC_HOST_CALL dateNow(ExecState* exec)
{
- return jsNumber(exec, jsCurrentTime());
+ return JSValue::encode(jsNumber(exec, jsCurrentTime()));
}
-static JSValue JSC_HOST_CALL dateUTC(ExecState* exec)
+static EncodedJSValue JSC_HOST_CALL dateUTC(ExecState* exec)
{
int n = exec->argumentCount();
if (isnan(exec->argument(0).toNumber(exec))
@@ -167,7 +167,7 @@
|| (n >= 5 && isnan(exec->argument(4).toNumber(exec)))
|| (n >= 6 && isnan(exec->argument(5).toNumber(exec)))
|| (n >= 7 && isnan(exec->argument(6).toNumber(exec))))
- return jsNaN(exec);
+ return JSValue::encode(jsNaN(exec));
GregorianDateTime t;
int year = exec->argument(0).toInt32(exec);
@@ -178,7 +178,7 @@
t.minute = exec->argument(4).toInt32(exec);
t.second = exec->argument(5).toInt32(exec);
double ms = (n >= 7) ? exec->argument(6).toNumber(exec) : 0;
- return jsNumber(exec, timeClip(gregorianDateTimeToMS(exec, t, ms, true)));
+ return JSValue::encode(jsNumber(exec, timeClip(gregorianDateTimeToMS(exec, t, ms, true))));
}
} // namespace JSC
diff --git a/JavaScriptCore/runtime/DatePrototype.cpp b/JavaScriptCore/runtime/DatePrototype.cpp
index c31a4d0..332e84d 100644
--- a/JavaScriptCore/runtime/DatePrototype.cpp
+++ b/JavaScriptCore/runtime/DatePrototype.cpp
@@ -73,51 +73,51 @@
ASSERT_CLASS_FITS_IN_CELL(DatePrototype);
-static JSValue JSC_HOST_CALL dateProtoFuncGetDate(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncGetDay(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncGetFullYear(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncGetHours(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncGetMilliSeconds(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncGetMinutes(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncGetMonth(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncGetSeconds(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncGetTime(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncGetTimezoneOffset(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncGetUTCDate(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncGetUTCDay(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncGetUTCFullYear(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncGetUTCHours(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncGetUTCMilliseconds(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncGetUTCMinutes(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncGetUTCMonth(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncGetUTCSeconds(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncGetYear(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncSetDate(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncSetFullYear(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncSetHours(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncSetMilliSeconds(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncSetMinutes(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncSetMonth(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncSetSeconds(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncSetTime(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncSetUTCDate(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncSetUTCFullYear(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncSetUTCHours(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncSetUTCMilliseconds(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncSetUTCMinutes(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncSetUTCMonth(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncSetUTCSeconds(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncSetYear(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncToDateString(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncToGMTString(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncToLocaleDateString(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncToLocaleString(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncToLocaleTimeString(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncToString(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncToTimeString(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncToUTCString(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncToISOString(ExecState*);
-static JSValue JSC_HOST_CALL dateProtoFuncToJSON(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetDate(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetDay(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetFullYear(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetHours(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetMilliSeconds(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetMinutes(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetMonth(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetSeconds(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetTime(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetTimezoneOffset(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCDate(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCDay(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCFullYear(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCHours(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCMilliseconds(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCMinutes(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCMonth(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCSeconds(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetYear(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetDate(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetFullYear(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetHours(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetMilliSeconds(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetMinutes(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetMonth(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetSeconds(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetTime(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCDate(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCFullYear(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCHours(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCMilliseconds(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCMinutes(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCMonth(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCSeconds(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetYear(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncToDateString(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncToGMTString(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncToLocaleDateString(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncToLocaleString(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncToLocaleTimeString(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncToString(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncToTimeString(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncToUTCString(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncToISOString(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncToJSON(ExecState*);
}
@@ -437,404 +437,404 @@
// Functions
-JSValue JSC_HOST_CALL dateProtoFuncToString(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncToString(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
DateInstance* thisDateObj = asDateInstance(thisValue);
const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
if (!gregorianDateTime)
- return jsNontrivialString(exec, "Invalid Date");
+ return JSValue::encode(jsNontrivialString(exec, "Invalid Date"));
DateConversionBuffer date;
DateConversionBuffer time;
formatDate(*gregorianDateTime, date);
formatTime(*gregorianDateTime, time);
- return jsMakeNontrivialString(exec, date, " ", time);
+ return JSValue::encode(jsMakeNontrivialString(exec, date, " ", time));
}
-JSValue JSC_HOST_CALL dateProtoFuncToUTCString(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncToUTCString(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
DateInstance* thisDateObj = asDateInstance(thisValue);
const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec);
if (!gregorianDateTime)
- return jsNontrivialString(exec, "Invalid Date");
+ return JSValue::encode(jsNontrivialString(exec, "Invalid Date"));
DateConversionBuffer date;
DateConversionBuffer time;
formatDateUTCVariant(*gregorianDateTime, date);
formatTimeUTC(*gregorianDateTime, time);
- return jsMakeNontrivialString(exec, date, " ", time);
+ return JSValue::encode(jsMakeNontrivialString(exec, date, " ", time));
}
-JSValue JSC_HOST_CALL dateProtoFuncToISOString(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncToISOString(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
DateInstance* thisDateObj = asDateInstance(thisValue);
const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec);
if (!gregorianDateTime)
- return jsNontrivialString(exec, "Invalid Date");
+ return JSValue::encode(jsNontrivialString(exec, "Invalid Date"));
// Maximum amount of space we need in buffer: 6 (max. digits in year) + 2 * 5 (2 characters each for month, day, hour, minute, second) + 4 (. + 3 digits for milliseconds)
// 6 for formatting and one for null termination = 27. We add one extra character to allow us to force null termination.
char buffer[28];
snprintf(buffer, sizeof(buffer) - 1, "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ", 1900 + gregorianDateTime->year, gregorianDateTime->month + 1, gregorianDateTime->monthDay, gregorianDateTime->hour, gregorianDateTime->minute, gregorianDateTime->second, static_cast<int>(fmod(thisDateObj->internalNumber(), 1000)));
buffer[sizeof(buffer) - 1] = 0;
- return jsNontrivialString(exec, buffer);
+ return JSValue::encode(jsNontrivialString(exec, buffer));
}
-JSValue JSC_HOST_CALL dateProtoFuncToDateString(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncToDateString(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
DateInstance* thisDateObj = asDateInstance(thisValue);
const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
if (!gregorianDateTime)
- return jsNontrivialString(exec, "Invalid Date");
+ return JSValue::encode(jsNontrivialString(exec, "Invalid Date"));
DateConversionBuffer date;
formatDate(*gregorianDateTime, date);
- return jsNontrivialString(exec, date);
+ return JSValue::encode(jsNontrivialString(exec, date));
}
-JSValue JSC_HOST_CALL dateProtoFuncToTimeString(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncToTimeString(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
DateInstance* thisDateObj = asDateInstance(thisValue);
const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
if (!gregorianDateTime)
- return jsNontrivialString(exec, "Invalid Date");
+ return JSValue::encode(jsNontrivialString(exec, "Invalid Date"));
DateConversionBuffer time;
formatTime(*gregorianDateTime, time);
- return jsNontrivialString(exec, time);
+ return JSValue::encode(jsNontrivialString(exec, time));
}
-JSValue JSC_HOST_CALL dateProtoFuncToLocaleString(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncToLocaleString(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
DateInstance* thisDateObj = asDateInstance(thisValue);
- return formatLocaleDate(exec, thisDateObj, thisDateObj->internalNumber(), LocaleDateAndTime);
+ return JSValue::encode(formatLocaleDate(exec, thisDateObj, thisDateObj->internalNumber(), LocaleDateAndTime));
}
-JSValue JSC_HOST_CALL dateProtoFuncToLocaleDateString(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncToLocaleDateString(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
DateInstance* thisDateObj = asDateInstance(thisValue);
- return formatLocaleDate(exec, thisDateObj, thisDateObj->internalNumber(), LocaleDate);
+ return JSValue::encode(formatLocaleDate(exec, thisDateObj, thisDateObj->internalNumber(), LocaleDate));
}
-JSValue JSC_HOST_CALL dateProtoFuncToLocaleTimeString(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncToLocaleTimeString(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
DateInstance* thisDateObj = asDateInstance(thisValue);
- return formatLocaleDate(exec, thisDateObj, thisDateObj->internalNumber(), LocaleTime);
+ return JSValue::encode(formatLocaleDate(exec, thisDateObj, thisDateObj->internalNumber(), LocaleTime));
}
-JSValue JSC_HOST_CALL dateProtoFuncGetTime(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetTime(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
- return asDateInstance(thisValue)->internalValue();
+ return JSValue::encode(asDateInstance(thisValue)->internalValue());
}
-JSValue JSC_HOST_CALL dateProtoFuncGetFullYear(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetFullYear(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
DateInstance* thisDateObj = asDateInstance(thisValue);
const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
if (!gregorianDateTime)
- return jsNaN(exec);
- return jsNumber(exec, 1900 + gregorianDateTime->year);
+ return JSValue::encode(jsNaN(exec));
+ return JSValue::encode(jsNumber(exec, 1900 + gregorianDateTime->year));
}
-JSValue JSC_HOST_CALL dateProtoFuncGetUTCFullYear(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCFullYear(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
DateInstance* thisDateObj = asDateInstance(thisValue);
const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec);
if (!gregorianDateTime)
- return jsNaN(exec);
- return jsNumber(exec, 1900 + gregorianDateTime->year);
+ return JSValue::encode(jsNaN(exec));
+ return JSValue::encode(jsNumber(exec, 1900 + gregorianDateTime->year));
}
-JSValue JSC_HOST_CALL dateProtoFuncToGMTString(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncToGMTString(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
DateInstance* thisDateObj = asDateInstance(thisValue);
const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec);
if (!gregorianDateTime)
- return jsNontrivialString(exec, "Invalid Date");
+ return JSValue::encode(jsNontrivialString(exec, "Invalid Date"));
DateConversionBuffer date;
DateConversionBuffer time;
formatDateUTCVariant(*gregorianDateTime, date);
formatTimeUTC(*gregorianDateTime, time);
- return jsMakeNontrivialString(exec, date, " ", time);
+ return JSValue::encode(jsMakeNontrivialString(exec, date, " ", time));
}
-JSValue JSC_HOST_CALL dateProtoFuncGetMonth(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetMonth(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
DateInstance* thisDateObj = asDateInstance(thisValue);
const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
if (!gregorianDateTime)
- return jsNaN(exec);
- return jsNumber(exec, gregorianDateTime->month);
+ return JSValue::encode(jsNaN(exec));
+ return JSValue::encode(jsNumber(exec, gregorianDateTime->month));
}
-JSValue JSC_HOST_CALL dateProtoFuncGetUTCMonth(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCMonth(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
DateInstance* thisDateObj = asDateInstance(thisValue);
const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec);
if (!gregorianDateTime)
- return jsNaN(exec);
- return jsNumber(exec, gregorianDateTime->month);
+ return JSValue::encode(jsNaN(exec));
+ return JSValue::encode(jsNumber(exec, gregorianDateTime->month));
}
-JSValue JSC_HOST_CALL dateProtoFuncGetDate(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetDate(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
DateInstance* thisDateObj = asDateInstance(thisValue);
const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
if (!gregorianDateTime)
- return jsNaN(exec);
- return jsNumber(exec, gregorianDateTime->monthDay);
+ return JSValue::encode(jsNaN(exec));
+ return JSValue::encode(jsNumber(exec, gregorianDateTime->monthDay));
}
-JSValue JSC_HOST_CALL dateProtoFuncGetUTCDate(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCDate(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
DateInstance* thisDateObj = asDateInstance(thisValue);
const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec);
if (!gregorianDateTime)
- return jsNaN(exec);
- return jsNumber(exec, gregorianDateTime->monthDay);
+ return JSValue::encode(jsNaN(exec));
+ return JSValue::encode(jsNumber(exec, gregorianDateTime->monthDay));
}
-JSValue JSC_HOST_CALL dateProtoFuncGetDay(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetDay(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
DateInstance* thisDateObj = asDateInstance(thisValue);
const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
if (!gregorianDateTime)
- return jsNaN(exec);
- return jsNumber(exec, gregorianDateTime->weekDay);
+ return JSValue::encode(jsNaN(exec));
+ return JSValue::encode(jsNumber(exec, gregorianDateTime->weekDay));
}
-JSValue JSC_HOST_CALL dateProtoFuncGetUTCDay(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCDay(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
DateInstance* thisDateObj = asDateInstance(thisValue);
const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec);
if (!gregorianDateTime)
- return jsNaN(exec);
- return jsNumber(exec, gregorianDateTime->weekDay);
+ return JSValue::encode(jsNaN(exec));
+ return JSValue::encode(jsNumber(exec, gregorianDateTime->weekDay));
}
-JSValue JSC_HOST_CALL dateProtoFuncGetHours(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetHours(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
DateInstance* thisDateObj = asDateInstance(thisValue);
const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
if (!gregorianDateTime)
- return jsNaN(exec);
- return jsNumber(exec, gregorianDateTime->hour);
+ return JSValue::encode(jsNaN(exec));
+ return JSValue::encode(jsNumber(exec, gregorianDateTime->hour));
}
-JSValue JSC_HOST_CALL dateProtoFuncGetUTCHours(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCHours(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
DateInstance* thisDateObj = asDateInstance(thisValue);
const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec);
if (!gregorianDateTime)
- return jsNaN(exec);
- return jsNumber(exec, gregorianDateTime->hour);
+ return JSValue::encode(jsNaN(exec));
+ return JSValue::encode(jsNumber(exec, gregorianDateTime->hour));
}
-JSValue JSC_HOST_CALL dateProtoFuncGetMinutes(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetMinutes(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
DateInstance* thisDateObj = asDateInstance(thisValue);
const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
if (!gregorianDateTime)
- return jsNaN(exec);
- return jsNumber(exec, gregorianDateTime->minute);
+ return JSValue::encode(jsNaN(exec));
+ return JSValue::encode(jsNumber(exec, gregorianDateTime->minute));
}
-JSValue JSC_HOST_CALL dateProtoFuncGetUTCMinutes(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCMinutes(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
DateInstance* thisDateObj = asDateInstance(thisValue);
const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec);
if (!gregorianDateTime)
- return jsNaN(exec);
- return jsNumber(exec, gregorianDateTime->minute);
+ return JSValue::encode(jsNaN(exec));
+ return JSValue::encode(jsNumber(exec, gregorianDateTime->minute));
}
-JSValue JSC_HOST_CALL dateProtoFuncGetSeconds(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetSeconds(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
DateInstance* thisDateObj = asDateInstance(thisValue);
const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
if (!gregorianDateTime)
- return jsNaN(exec);
- return jsNumber(exec, gregorianDateTime->second);
+ return JSValue::encode(jsNaN(exec));
+ return JSValue::encode(jsNumber(exec, gregorianDateTime->second));
}
-JSValue JSC_HOST_CALL dateProtoFuncGetUTCSeconds(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCSeconds(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
DateInstance* thisDateObj = asDateInstance(thisValue);
const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec);
if (!gregorianDateTime)
- return jsNaN(exec);
- return jsNumber(exec, gregorianDateTime->second);
+ return JSValue::encode(jsNaN(exec));
+ return JSValue::encode(jsNumber(exec, gregorianDateTime->second));
}
-JSValue JSC_HOST_CALL dateProtoFuncGetMilliSeconds(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetMilliSeconds(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
DateInstance* thisDateObj = asDateInstance(thisValue);
double milli = thisDateObj->internalNumber();
if (isnan(milli))
- return jsNaN(exec);
+ return JSValue::encode(jsNaN(exec));
double secs = floor(milli / msPerSecond);
double ms = milli - secs * msPerSecond;
- return jsNumber(exec, ms);
+ return JSValue::encode(jsNumber(exec, ms));
}
-JSValue JSC_HOST_CALL dateProtoFuncGetUTCMilliseconds(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCMilliseconds(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
DateInstance* thisDateObj = asDateInstance(thisValue);
double milli = thisDateObj->internalNumber();
if (isnan(milli))
- return jsNaN(exec);
+ return JSValue::encode(jsNaN(exec));
double secs = floor(milli / msPerSecond);
double ms = milli - secs * msPerSecond;
- return jsNumber(exec, ms);
+ return JSValue::encode(jsNumber(exec, ms));
}
-JSValue JSC_HOST_CALL dateProtoFuncGetTimezoneOffset(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetTimezoneOffset(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
DateInstance* thisDateObj = asDateInstance(thisValue);
const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
if (!gregorianDateTime)
- return jsNaN(exec);
- return jsNumber(exec, -gregorianDateTime->utcOffset / minutesPerHour);
+ return JSValue::encode(jsNaN(exec));
+ return JSValue::encode(jsNumber(exec, -gregorianDateTime->utcOffset / minutesPerHour));
}
-JSValue JSC_HOST_CALL dateProtoFuncSetTime(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncSetTime(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
DateInstance* thisDateObj = asDateInstance(thisValue);
double milli = timeClip(exec->argument(0).toNumber(exec));
JSValue result = jsNumber(exec, milli);
thisDateObj->setInternalValue(result);
- return result;
+ return JSValue::encode(result);
}
static JSValue setNewValueFromTimeArgs(ExecState* exec, int numArgsToUse, bool inputIsUTC)
@@ -914,101 +914,101 @@
return result;
}
-JSValue JSC_HOST_CALL dateProtoFuncSetMilliSeconds(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncSetMilliSeconds(ExecState* exec)
{
const bool inputIsUTC = false;
- return setNewValueFromTimeArgs(exec, 1, inputIsUTC);
+ return JSValue::encode(setNewValueFromTimeArgs(exec, 1, inputIsUTC));
}
-JSValue JSC_HOST_CALL dateProtoFuncSetUTCMilliseconds(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCMilliseconds(ExecState* exec)
{
const bool inputIsUTC = true;
- return setNewValueFromTimeArgs(exec, 1, inputIsUTC);
+ return JSValue::encode(setNewValueFromTimeArgs(exec, 1, inputIsUTC));
}
-JSValue JSC_HOST_CALL dateProtoFuncSetSeconds(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncSetSeconds(ExecState* exec)
{
const bool inputIsUTC = false;
- return setNewValueFromTimeArgs(exec, 2, inputIsUTC);
+ return JSValue::encode(setNewValueFromTimeArgs(exec, 2, inputIsUTC));
}
-JSValue JSC_HOST_CALL dateProtoFuncSetUTCSeconds(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCSeconds(ExecState* exec)
{
const bool inputIsUTC = true;
- return setNewValueFromTimeArgs(exec, 2, inputIsUTC);
+ return JSValue::encode(setNewValueFromTimeArgs(exec, 2, inputIsUTC));
}
-JSValue JSC_HOST_CALL dateProtoFuncSetMinutes(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncSetMinutes(ExecState* exec)
{
const bool inputIsUTC = false;
- return setNewValueFromTimeArgs(exec, 3, inputIsUTC);
+ return JSValue::encode(setNewValueFromTimeArgs(exec, 3, inputIsUTC));
}
-JSValue JSC_HOST_CALL dateProtoFuncSetUTCMinutes(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCMinutes(ExecState* exec)
{
const bool inputIsUTC = true;
- return setNewValueFromTimeArgs(exec, 3, inputIsUTC);
+ return JSValue::encode(setNewValueFromTimeArgs(exec, 3, inputIsUTC));
}
-JSValue JSC_HOST_CALL dateProtoFuncSetHours(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncSetHours(ExecState* exec)
{
const bool inputIsUTC = false;
- return setNewValueFromTimeArgs(exec, 4, inputIsUTC);
+ return JSValue::encode(setNewValueFromTimeArgs(exec, 4, inputIsUTC));
}
-JSValue JSC_HOST_CALL dateProtoFuncSetUTCHours(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCHours(ExecState* exec)
{
const bool inputIsUTC = true;
- return setNewValueFromTimeArgs(exec, 4, inputIsUTC);
+ return JSValue::encode(setNewValueFromTimeArgs(exec, 4, inputIsUTC));
}
-JSValue JSC_HOST_CALL dateProtoFuncSetDate(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncSetDate(ExecState* exec)
{
const bool inputIsUTC = false;
- return setNewValueFromDateArgs(exec, 1, inputIsUTC);
+ return JSValue::encode(setNewValueFromDateArgs(exec, 1, inputIsUTC));
}
-JSValue JSC_HOST_CALL dateProtoFuncSetUTCDate(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCDate(ExecState* exec)
{
const bool inputIsUTC = true;
- return setNewValueFromDateArgs(exec, 1, inputIsUTC);
+ return JSValue::encode(setNewValueFromDateArgs(exec, 1, inputIsUTC));
}
-JSValue JSC_HOST_CALL dateProtoFuncSetMonth(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncSetMonth(ExecState* exec)
{
const bool inputIsUTC = false;
- return setNewValueFromDateArgs(exec, 2, inputIsUTC);
+ return JSValue::encode(setNewValueFromDateArgs(exec, 2, inputIsUTC));
}
-JSValue JSC_HOST_CALL dateProtoFuncSetUTCMonth(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCMonth(ExecState* exec)
{
const bool inputIsUTC = true;
- return setNewValueFromDateArgs(exec, 2, inputIsUTC);
+ return JSValue::encode(setNewValueFromDateArgs(exec, 2, inputIsUTC));
}
-JSValue JSC_HOST_CALL dateProtoFuncSetFullYear(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncSetFullYear(ExecState* exec)
{
const bool inputIsUTC = false;
- return setNewValueFromDateArgs(exec, 3, inputIsUTC);
+ return JSValue::encode(setNewValueFromDateArgs(exec, 3, inputIsUTC));
}
-JSValue JSC_HOST_CALL dateProtoFuncSetUTCFullYear(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCFullYear(ExecState* exec)
{
const bool inputIsUTC = true;
- return setNewValueFromDateArgs(exec, 3, inputIsUTC);
+ return JSValue::encode(setNewValueFromDateArgs(exec, 3, inputIsUTC));
}
-JSValue JSC_HOST_CALL dateProtoFuncSetYear(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncSetYear(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
DateInstance* thisDateObj = asDateInstance(thisValue);
if (!exec->argumentCount()) {
JSValue result = jsNaN(exec);
thisDateObj->setInternalValue(result);
- return result;
+ return JSValue::encode(result);
}
double milli = thisDateObj->internalNumber();
@@ -1031,53 +1031,53 @@
if (!ok) {
JSValue result = jsNaN(exec);
thisDateObj->setInternalValue(result);
- return result;
+ return JSValue::encode(result);
}
gregorianDateTime.year = (year > 99 || year < 0) ? year - 1900 : year;
JSValue result = jsNumber(exec, gregorianDateTimeToMS(exec, gregorianDateTime, ms, false));
thisDateObj->setInternalValue(result);
- return result;
+ return JSValue::encode(result);
}
-JSValue JSC_HOST_CALL dateProtoFuncGetYear(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetYear(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&DateInstance::info))
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
DateInstance* thisDateObj = asDateInstance(thisValue);
const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
if (!gregorianDateTime)
- return jsNaN(exec);
+ return JSValue::encode(jsNaN(exec));
// NOTE: IE returns the full year even in getYear.
- return jsNumber(exec, gregorianDateTime->year);
+ return JSValue::encode(jsNumber(exec, gregorianDateTime->year));
}
-JSValue JSC_HOST_CALL dateProtoFuncToJSON(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL dateProtoFuncToJSON(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
JSObject* object = thisValue.toThisObject(exec);
if (exec->hadException())
- return jsNull();
+ return JSValue::encode(jsNull());
JSValue toISOValue = object->get(exec, exec->globalData().propertyNames->toISOString);
if (exec->hadException())
- return jsNull();
+ return JSValue::encode(jsNull());
CallData callData;
- CallType callType = toISOValue.getCallData(callData);
+ CallType callType = getCallData(toISOValue, callData);
if (callType == CallTypeNone)
- return throwError(exec, TypeError, "toISOString is not a function");
+ return JSValue::encode(throwError(exec, TypeError, "toISOString is not a function"));
JSValue result = call(exec, asObject(toISOValue), callType, callData, object, exec->emptyList());
if (exec->hadException())
- return jsNull();
+ return JSValue::encode(jsNull());
if (result.isObject())
- return throwError(exec, TypeError, "toISOString did not return a primitive value");
- return result;
+ return JSValue::encode(throwError(exec, TypeError, "toISOString did not return a primitive value"));
+ return JSValue::encode(result);
}
} // namespace JSC
diff --git a/JavaScriptCore/runtime/ErrorConstructor.cpp b/JavaScriptCore/runtime/ErrorConstructor.cpp
index b4b0ba2..14e0699 100644
--- a/JavaScriptCore/runtime/ErrorConstructor.cpp
+++ b/JavaScriptCore/runtime/ErrorConstructor.cpp
@@ -57,10 +57,10 @@
return ConstructTypeHost;
}
-static JSValue JSC_HOST_CALL callErrorConstructor(ExecState* exec)
+static EncodedJSValue JSC_HOST_CALL callErrorConstructor(ExecState* exec)
{
ArgList args(exec);
- return constructError(exec, args);
+ return JSValue::encode(constructError(exec, args));
}
CallType ErrorConstructor::getCallData(CallData& callData)
diff --git a/JavaScriptCore/runtime/ErrorPrototype.cpp b/JavaScriptCore/runtime/ErrorPrototype.cpp
index 4c895fa..9115870 100644
--- a/JavaScriptCore/runtime/ErrorPrototype.cpp
+++ b/JavaScriptCore/runtime/ErrorPrototype.cpp
@@ -32,7 +32,7 @@
ASSERT_CLASS_FITS_IN_CELL(ErrorPrototype);
-static JSValue JSC_HOST_CALL errorProtoFuncToString(ExecState*);
+static EncodedJSValue JSC_HOST_CALL errorProtoFuncToString(ExecState*);
// ECMA 15.9.4
ErrorPrototype::ErrorPrototype(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, Structure* prototypeFunctionStructure)
@@ -46,7 +46,7 @@
putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 0, exec->propertyNames().toString, errorProtoFuncToString), DontEnum);
}
-JSValue JSC_HOST_CALL errorProtoFuncToString(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL errorProtoFuncToString(ExecState* exec)
{
JSObject* thisObj = exec->hostThisValue().toThisObject(exec);
JSValue name = thisObj->get(exec, exec->propertyNames().name);
@@ -56,12 +56,12 @@
if (!name.isUndefined()) {
if (!message.isUndefined())
- return jsMakeNontrivialString(exec, name.toString(exec), ": ", message.toString(exec));
- return jsNontrivialString(exec, name.toString(exec));
+ return JSValue::encode(jsMakeNontrivialString(exec, name.toString(exec), ": ", message.toString(exec)));
+ return JSValue::encode(jsNontrivialString(exec, name.toString(exec)));
}
if (!message.isUndefined())
- return jsMakeNontrivialString(exec, "Error: ", message.toString(exec));
- return jsNontrivialString(exec, "Error");
+ return JSValue::encode(jsMakeNontrivialString(exec, "Error: ", message.toString(exec)));
+ return JSValue::encode(jsNontrivialString(exec, "Error"));
}
} // namespace JSC
diff --git a/JavaScriptCore/runtime/FunctionConstructor.cpp b/JavaScriptCore/runtime/FunctionConstructor.cpp
index de9fff1..7022e1f 100644
--- a/JavaScriptCore/runtime/FunctionConstructor.cpp
+++ b/JavaScriptCore/runtime/FunctionConstructor.cpp
@@ -55,10 +55,10 @@
return ConstructTypeHost;
}
-static JSValue JSC_HOST_CALL callFunctionConstructor(ExecState* exec)
+static EncodedJSValue JSC_HOST_CALL callFunctionConstructor(ExecState* exec)
{
ArgList args(exec);
- return constructFunction(exec, args);
+ return JSValue::encode(constructFunction(exec, args));
}
// ECMA 15.3.1 The Function Constructor Called as a Function
diff --git a/JavaScriptCore/runtime/FunctionPrototype.cpp b/JavaScriptCore/runtime/FunctionPrototype.cpp
index 15392cf..526c0a4 100644
--- a/JavaScriptCore/runtime/FunctionPrototype.cpp
+++ b/JavaScriptCore/runtime/FunctionPrototype.cpp
@@ -34,9 +34,9 @@
ASSERT_CLASS_FITS_IN_CELL(FunctionPrototype);
-static JSValue JSC_HOST_CALL functionProtoFuncToString(ExecState*);
-static JSValue JSC_HOST_CALL functionProtoFuncApply(ExecState*);
-static JSValue JSC_HOST_CALL functionProtoFuncCall(ExecState*);
+static EncodedJSValue JSC_HOST_CALL functionProtoFuncToString(ExecState*);
+static EncodedJSValue JSC_HOST_CALL functionProtoFuncApply(ExecState*);
+static EncodedJSValue JSC_HOST_CALL functionProtoFuncCall(ExecState*);
FunctionPrototype::FunctionPrototype(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure)
: InternalFunction(&exec->globalData(), globalObject, structure, exec->propertyNames().nullIdentifier)
@@ -53,9 +53,9 @@
putDirectFunctionWithoutTransition(exec, *callFunction, DontEnum);
}
-static JSValue JSC_HOST_CALL callFunctionPrototype(ExecState*)
+static EncodedJSValue JSC_HOST_CALL callFunctionPrototype(ExecState*)
{
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
}
// ECMA 15.3.4
@@ -83,41 +83,41 @@
}
}
-JSValue JSC_HOST_CALL functionProtoFuncToString(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL functionProtoFuncToString(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (thisValue.inherits(&JSFunction::info)) {
JSFunction* function = asFunction(thisValue);
if (function->isHostFunction())
- return jsMakeNontrivialString(exec, "function ", function->name(exec), "() {\n [native code]\n}");
+ return JSValue::encode(jsMakeNontrivialString(exec, "function ", function->name(exec), "() {\n [native code]\n}"));
FunctionExecutable* executable = function->jsExecutable();
UString sourceString = executable->source().toString();
insertSemicolonIfNeeded(sourceString);
- return jsMakeNontrivialString(exec, "function ", function->name(exec), "(", executable->paramString(), ") ", sourceString);
+ return JSValue::encode(jsMakeNontrivialString(exec, "function ", function->name(exec), "(", executable->paramString(), ") ", sourceString));
}
if (thisValue.inherits(&InternalFunction::info)) {
InternalFunction* function = asInternalFunction(thisValue);
- return jsMakeNontrivialString(exec, "function ", function->name(exec), "() {\n [native code]\n}");
+ return JSValue::encode(jsMakeNontrivialString(exec, "function ", function->name(exec), "() {\n [native code]\n}"));
}
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
}
-JSValue JSC_HOST_CALL functionProtoFuncApply(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL functionProtoFuncApply(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
CallData callData;
- CallType callType = thisValue.getCallData(callData);
+ CallType callType = getCallData(thisValue, callData);
if (callType == CallTypeNone)
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
JSValue array = exec->argument(1);
MarkedArgumentBuffer applyArgs;
if (!array.isUndefinedOrNull()) {
if (!array.isObject())
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
if (asObject(array)->classInfo() == &Arguments::info)
asArguments(array)->fillArgList(exec, applyArgs);
else if (isJSArray(&exec->globalData(), array))
@@ -127,24 +127,24 @@
for (unsigned i = 0; i < length; ++i)
applyArgs.append(asArray(array)->get(exec, i));
} else
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
}
- return call(exec, thisValue, callType, callData, exec->argument(0), applyArgs);
+ return JSValue::encode(call(exec, thisValue, callType, callData, exec->argument(0), applyArgs));
}
-JSValue JSC_HOST_CALL functionProtoFuncCall(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL functionProtoFuncCall(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
CallData callData;
- CallType callType = thisValue.getCallData(callData);
+ CallType callType = getCallData(thisValue, callData);
if (callType == CallTypeNone)
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
ArgList args(exec);
ArgList callArgs;
args.getSlice(1, callArgs);
- return call(exec, thisValue, callType, callData, exec->argument(0), callArgs);
+ return JSValue::encode(call(exec, thisValue, callType, callData, exec->argument(0), callArgs));
}
} // namespace JSC
diff --git a/JavaScriptCore/runtime/JSCell.h b/JavaScriptCore/runtime/JSCell.h
index c083825..72f81df 100644
--- a/JavaScriptCore/runtime/JSCell.h
+++ b/JavaScriptCore/runtime/JSCell.h
@@ -23,6 +23,8 @@
#ifndef JSCell_h
#define JSCell_h
+#include "CallData.h"
+#include "ConstructData.h"
#include "Collector.h"
#include "JSImmediate.h"
#include "JSValue.h"
@@ -205,17 +207,17 @@
return isCell() ? asCell()->getObject() : 0;
}
- inline CallType JSValue::getCallData(CallData& callData)
+ inline CallType getCallData(JSValue value, CallData& callData)
{
- CallType result = isCell() ? asCell()->getCallData(callData) : CallTypeNone;
- ASSERT(result == CallTypeNone || isValidCallee());
+ CallType result = value.isCell() ? asCell(value)->getCallData(callData) : CallTypeNone;
+ ASSERT(result == CallTypeNone || value.isValidCallee());
return result;
}
- inline ConstructType JSValue::getConstructData(ConstructData& constructData)
+ inline ConstructType getConstructData(JSValue value, ConstructData& constructData)
{
- ConstructType result = isCell() ? asCell()->getConstructData(constructData) : ConstructTypeNone;
- ASSERT(result == ConstructTypeNone || isValidCallee());
+ ConstructType result = value.isCell() ? asCell(value)->getConstructData(constructData) : ConstructTypeNone;
+ ASSERT(result == ConstructTypeNone || value.isValidCallee());
return result;
}
diff --git a/JavaScriptCore/runtime/JSFunction.cpp b/JavaScriptCore/runtime/JSFunction.cpp
index f44ca2f..e09170c 100644
--- a/JavaScriptCore/runtime/JSFunction.cpp
+++ b/JavaScriptCore/runtime/JSFunction.cpp
@@ -43,12 +43,12 @@
namespace JSC {
-JSValue JSC_HOST_CALL callHostFunctionAsConstructor(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL callHostFunctionAsConstructor(ExecState* exec)
{
CodeBlock* codeBlock = exec->callerFrame()->codeBlock();
unsigned vPCIndex = codeBlock->bytecodeOffset(exec, exec->returnPC());
exec->setException(createNotAConstructorError(exec, exec->callee(), vPCIndex, codeBlock));
- return JSValue();
+ return JSValue::encode(JSValue());
}
ASSERT_CLASS_FITS_IN_CELL(JSFunction);
diff --git a/JavaScriptCore/runtime/JSFunction.h b/JavaScriptCore/runtime/JSFunction.h
index a906b2e..3a2fe30 100644
--- a/JavaScriptCore/runtime/JSFunction.h
+++ b/JavaScriptCore/runtime/JSFunction.h
@@ -35,7 +35,7 @@
class JSGlobalObject;
class NativeExecutable;
- JSValue JSC_HOST_CALL callHostFunctionAsConstructor(ExecState*);
+ EncodedJSValue JSC_HOST_CALL callHostFunctionAsConstructor(ExecState*);
class JSFunction : public JSObjectWithGlobalObject {
friend class JIT;
diff --git a/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp b/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
index 21d06b7..b6b1f08 100644
--- a/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
+++ b/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
@@ -272,84 +272,84 @@
return s.toDouble(true /*tolerant*/, false /* NaN for empty string */);
}
-JSValue JSC_HOST_CALL globalFuncEval(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL globalFuncEval(ExecState* exec)
{
JSObject* thisObject = exec->hostThisValue().toThisObject(exec);
JSObject* unwrappedObject = thisObject->unwrappedObject();
if (!unwrappedObject->isGlobalObject() || static_cast<JSGlobalObject*>(unwrappedObject)->evalFunction() != exec->callee())
- return throwError(exec, EvalError, "The \"this\" value passed to eval must be the global object from which eval originated");
+ return JSValue::encode(throwError(exec, EvalError, "The \"this\" value passed to eval must be the global object from which eval originated"));
JSValue x = exec->argument(0);
if (!x.isString())
- return x;
+ return JSValue::encode(x);
UString s = x.toString(exec);
LiteralParser preparser(exec, s, LiteralParser::NonStrictJSON);
if (JSValue parsedObject = preparser.tryLiteralParse())
- return parsedObject;
+ return JSValue::encode(parsedObject);
RefPtr<EvalExecutable> eval = EvalExecutable::create(exec, makeSource(s));
JSObject* error = eval->compile(exec, static_cast<JSGlobalObject*>(unwrappedObject)->globalScopeChain().node());
if (error)
- return throwError(exec, error);
+ return JSValue::encode(throwError(exec, error));
- return exec->interpreter()->execute(eval.get(), exec, thisObject, static_cast<JSGlobalObject*>(unwrappedObject)->globalScopeChain().node(), exec->exceptionSlot());
+ return JSValue::encode(exec->interpreter()->execute(eval.get(), exec, thisObject, static_cast<JSGlobalObject*>(unwrappedObject)->globalScopeChain().node(), exec->exceptionSlot()));
}
-JSValue JSC_HOST_CALL globalFuncParseInt(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL globalFuncParseInt(ExecState* exec)
{
JSValue value = exec->argument(0);
int32_t radix = exec->argument(1).toInt32(exec);
if (radix != 0 && radix != 10)
- return jsNumber(exec, parseInt(value.toString(exec), radix));
+ return JSValue::encode(jsNumber(exec, parseInt(value.toString(exec), radix)));
if (value.isInt32())
- return value;
+ return JSValue::encode(value);
if (value.isDouble()) {
double d = value.asDouble();
if (isfinite(d))
- return jsNumber(exec, (d > 0) ? floor(d) : ceil(d));
+ return JSValue::encode(jsNumber(exec, (d > 0) ? floor(d) : ceil(d)));
if (isnan(d) || isinf(d))
- return jsNaN(exec);
- return jsNumber(exec, 0);
+ return JSValue::encode(jsNaN(exec));
+ return JSValue::encode(jsNumber(exec, 0));
}
- return jsNumber(exec, parseInt(value.toString(exec), radix));
+ return JSValue::encode(jsNumber(exec, parseInt(value.toString(exec), radix)));
}
-JSValue JSC_HOST_CALL globalFuncParseFloat(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL globalFuncParseFloat(ExecState* exec)
{
- return jsNumber(exec, parseFloat(exec->argument(0).toString(exec)));
+ return JSValue::encode(jsNumber(exec, parseFloat(exec->argument(0).toString(exec))));
}
-JSValue JSC_HOST_CALL globalFuncIsNaN(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL globalFuncIsNaN(ExecState* exec)
{
- return jsBoolean(isnan(exec->argument(0).toNumber(exec)));
+ return JSValue::encode(jsBoolean(isnan(exec->argument(0).toNumber(exec))));
}
-JSValue JSC_HOST_CALL globalFuncIsFinite(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL globalFuncIsFinite(ExecState* exec)
{
double n = exec->argument(0).toNumber(exec);
- return jsBoolean(!isnan(n) && !isinf(n));
+ return JSValue::encode(jsBoolean(!isnan(n) && !isinf(n)));
}
-JSValue JSC_HOST_CALL globalFuncDecodeURI(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL globalFuncDecodeURI(ExecState* exec)
{
static const char do_not_unescape_when_decoding_URI[] =
"#$&+,/:;=?@";
- return decode(exec, do_not_unescape_when_decoding_URI, true);
+ return JSValue::encode(decode(exec, do_not_unescape_when_decoding_URI, true));
}
-JSValue JSC_HOST_CALL globalFuncDecodeURIComponent(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL globalFuncDecodeURIComponent(ExecState* exec)
{
- return decode(exec, "", true);
+ return JSValue::encode(decode(exec, "", true));
}
-JSValue JSC_HOST_CALL globalFuncEncodeURI(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL globalFuncEncodeURI(ExecState* exec)
{
static const char do_not_escape_when_encoding_URI[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
@@ -357,10 +357,10 @@
"0123456789"
"!#$&'()*+,-./:;=?@_~";
- return encode(exec, do_not_escape_when_encoding_URI);
+ return JSValue::encode(encode(exec, do_not_escape_when_encoding_URI));
}
-JSValue JSC_HOST_CALL globalFuncEncodeURIComponent(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL globalFuncEncodeURIComponent(ExecState* exec)
{
static const char do_not_escape_when_encoding_URI_component[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
@@ -368,10 +368,10 @@
"0123456789"
"!'()*-._~";
- return encode(exec, do_not_escape_when_encoding_URI_component);
+ return JSValue::encode(encode(exec, do_not_escape_when_encoding_URI_component));
}
-JSValue JSC_HOST_CALL globalFuncEscape(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL globalFuncEscape(ExecState* exec)
{
static const char do_not_escape[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
@@ -397,10 +397,10 @@
}
}
- return builder.build(exec);
+ return JSValue::encode(builder.build(exec));
}
-JSValue JSC_HOST_CALL globalFuncUnescape(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL globalFuncUnescape(ExecState* exec)
{
StringBuilder builder;
UString str = exec->argument(0).toString(exec);
@@ -424,15 +424,15 @@
builder.append(*c);
}
- return jsString(exec, builder.build());
+ return JSValue::encode(jsString(exec, builder.build()));
}
#ifndef NDEBUG
-JSValue JSC_HOST_CALL globalFuncJSCPrint(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL globalFuncJSCPrint(ExecState* exec)
{
CString string = exec->argument(0).toString(exec).UTF8String();
puts(string.data());
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
}
#endif
diff --git a/JavaScriptCore/runtime/JSGlobalObjectFunctions.h b/JavaScriptCore/runtime/JSGlobalObjectFunctions.h
index b1dada4..91dfca8 100644
--- a/JavaScriptCore/runtime/JSGlobalObjectFunctions.h
+++ b/JavaScriptCore/runtime/JSGlobalObjectFunctions.h
@@ -24,6 +24,7 @@
#ifndef JSGlobalObjectFunctions_h
#define JSGlobalObjectFunctions_h
+#include "JSValue.h"
#include <wtf/unicode/Unicode.h>
namespace JSC {
@@ -31,24 +32,23 @@
class ArgList;
class ExecState;
class JSObject;
- class JSValue;
// FIXME: These functions should really be in JSGlobalObject.cpp, but putting them there
// is a 0.5% reduction.
- JSValue JSC_HOST_CALL globalFuncEval(ExecState*);
- JSValue JSC_HOST_CALL globalFuncParseInt(ExecState*);
- JSValue JSC_HOST_CALL globalFuncParseFloat(ExecState*);
- JSValue JSC_HOST_CALL globalFuncIsNaN(ExecState*);
- JSValue JSC_HOST_CALL globalFuncIsFinite(ExecState*);
- JSValue JSC_HOST_CALL globalFuncDecodeURI(ExecState*);
- JSValue JSC_HOST_CALL globalFuncDecodeURIComponent(ExecState*);
- JSValue JSC_HOST_CALL globalFuncEncodeURI(ExecState*);
- JSValue JSC_HOST_CALL globalFuncEncodeURIComponent(ExecState*);
- JSValue JSC_HOST_CALL globalFuncEscape(ExecState*);
- JSValue JSC_HOST_CALL globalFuncUnescape(ExecState*);
+ EncodedJSValue JSC_HOST_CALL globalFuncEval(ExecState*);
+ EncodedJSValue JSC_HOST_CALL globalFuncParseInt(ExecState*);
+ EncodedJSValue JSC_HOST_CALL globalFuncParseFloat(ExecState*);
+ EncodedJSValue JSC_HOST_CALL globalFuncIsNaN(ExecState*);
+ EncodedJSValue JSC_HOST_CALL globalFuncIsFinite(ExecState*);
+ EncodedJSValue JSC_HOST_CALL globalFuncDecodeURI(ExecState*);
+ EncodedJSValue JSC_HOST_CALL globalFuncDecodeURIComponent(ExecState*);
+ EncodedJSValue JSC_HOST_CALL globalFuncEncodeURI(ExecState*);
+ EncodedJSValue JSC_HOST_CALL globalFuncEncodeURIComponent(ExecState*);
+ EncodedJSValue JSC_HOST_CALL globalFuncEscape(ExecState*);
+ EncodedJSValue JSC_HOST_CALL globalFuncUnescape(ExecState*);
#ifndef NDEBUG
- JSValue JSC_HOST_CALL globalFuncJSCPrint(ExecState*);
+ EncodedJSValue JSC_HOST_CALL globalFuncJSCPrint(ExecState*);
#endif
static const double mantissaOverflowLowerBound = 9007199254740992.0;
diff --git a/JavaScriptCore/runtime/JSONObject.cpp b/JavaScriptCore/runtime/JSONObject.cpp
index 86604d8..c4b0150 100644
--- a/JavaScriptCore/runtime/JSONObject.cpp
+++ b/JavaScriptCore/runtime/JSONObject.cpp
@@ -41,8 +41,8 @@
ASSERT_CLASS_FITS_IN_CELL(JSONObject);
-static JSValue JSC_HOST_CALL JSONProtoFuncParse(ExecState*);
-static JSValue JSC_HOST_CALL JSONProtoFuncStringify(ExecState*);
+static EncodedJSValue JSC_HOST_CALL JSONProtoFuncParse(ExecState*);
+static EncodedJSValue JSC_HOST_CALL JSONProtoFuncStringify(ExecState*);
}
@@ -839,40 +839,40 @@
}
// ECMA-262 v5 15.12.2
-JSValue JSC_HOST_CALL JSONProtoFuncParse(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL JSONProtoFuncParse(ExecState* exec)
{
if (!exec->argumentCount())
- return throwError(exec, GeneralError, "JSON.parse requires at least one parameter");
+ return JSValue::encode(throwError(exec, GeneralError, "JSON.parse requires at least one parameter"));
JSValue value = exec->argument(0);
UString source = value.toString(exec);
if (exec->hadException())
- return jsNull();
+ return JSValue::encode(jsNull());
LiteralParser jsonParser(exec, source, LiteralParser::StrictJSON);
JSValue unfiltered = jsonParser.tryLiteralParse();
if (!unfiltered)
- return throwError(exec, SyntaxError, "Unable to parse JSON string");
+ return JSValue::encode(throwError(exec, SyntaxError, "Unable to parse JSON string"));
if (exec->argumentCount() < 2)
- return unfiltered;
+ return JSValue::encode(unfiltered);
JSValue function = exec->argument(1);
CallData callData;
- CallType callType = function.getCallData(callData);
+ CallType callType = getCallData(function, callData);
if (callType == CallTypeNone)
- return unfiltered;
- return Walker(exec, asObject(function), callType, callData).walk(unfiltered);
+ return JSValue::encode(unfiltered);
+ return JSValue::encode(Walker(exec, asObject(function), callType, callData).walk(unfiltered));
}
// ECMA-262 v5 15.12.3
-JSValue JSC_HOST_CALL JSONProtoFuncStringify(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL JSONProtoFuncStringify(ExecState* exec)
{
if (!exec->argumentCount())
- return throwError(exec, GeneralError, "No input to stringify");
+ return JSValue::encode(throwError(exec, GeneralError, "No input to stringify"));
JSValue value = exec->argument(0);
JSValue replacer = exec->argument(1);
JSValue space = exec->argument(2);
- return Stringifier(exec, replacer, space).stringify(value);
+ return JSValue::encode(Stringifier(exec, replacer, space).stringify(value));
}
UString JSONStringify(ExecState* exec, JSValue value, unsigned indent)
diff --git a/JavaScriptCore/runtime/JSObject.cpp b/JavaScriptCore/runtime/JSObject.cpp
index 5cff4fa..b9c01ab 100644
--- a/JavaScriptCore/runtime/JSObject.cpp
+++ b/JavaScriptCore/runtime/JSObject.cpp
@@ -224,7 +224,7 @@
{
JSValue function = object->get(exec, propertyName);
CallData callData;
- CallType callType = function.getCallData(callData);
+ CallType callType = getCallData(function, callData);
if (callType == CallTypeNone)
return exec->exception();
diff --git a/JavaScriptCore/runtime/JSValue.h b/JavaScriptCore/runtime/JSValue.h
index 914e2d5..9190f70 100644
--- a/JavaScriptCore/runtime/JSValue.h
+++ b/JavaScriptCore/runtime/JSValue.h
@@ -23,8 +23,6 @@
#ifndef JSValue_h
#define JSValue_h
-#include "CallData.h"
-#include "ConstructData.h"
#include <math.h>
#include <stddef.h> // for size_t
#include <stdint.h>
@@ -35,6 +33,7 @@
namespace JSC {
+ class ExecState;
class Identifier;
class JSCell;
class JSGlobalData;
@@ -143,9 +142,6 @@
UString getString(ExecState* exec) const; // null string if not a string
JSObject* getObject() const; // 0 if not an object
- CallType getCallData(CallData&);
- ConstructType getConstructData(ConstructData&);
-
// Extracting integer values.
bool getUInt32(uint32_t&) const;
diff --git a/JavaScriptCore/runtime/MathObject.cpp b/JavaScriptCore/runtime/MathObject.cpp
index 28997db..cfbaab2 100644
--- a/JavaScriptCore/runtime/MathObject.cpp
+++ b/JavaScriptCore/runtime/MathObject.cpp
@@ -34,24 +34,24 @@
ASSERT_CLASS_FITS_IN_CELL(MathObject);
-static JSValue JSC_HOST_CALL mathProtoFuncAbs(ExecState*);
-static JSValue JSC_HOST_CALL mathProtoFuncACos(ExecState*);
-static JSValue JSC_HOST_CALL mathProtoFuncASin(ExecState*);
-static JSValue JSC_HOST_CALL mathProtoFuncATan(ExecState*);
-static JSValue JSC_HOST_CALL mathProtoFuncATan2(ExecState*);
-static JSValue JSC_HOST_CALL mathProtoFuncCeil(ExecState*);
-static JSValue JSC_HOST_CALL mathProtoFuncCos(ExecState*);
-static JSValue JSC_HOST_CALL mathProtoFuncExp(ExecState*);
-static JSValue JSC_HOST_CALL mathProtoFuncFloor(ExecState*);
-static JSValue JSC_HOST_CALL mathProtoFuncLog(ExecState*);
-static JSValue JSC_HOST_CALL mathProtoFuncMax(ExecState*);
-static JSValue JSC_HOST_CALL mathProtoFuncMin(ExecState*);
-static JSValue JSC_HOST_CALL mathProtoFuncPow(ExecState*);
-static JSValue JSC_HOST_CALL mathProtoFuncRandom(ExecState*);
-static JSValue JSC_HOST_CALL mathProtoFuncRound(ExecState*);
-static JSValue JSC_HOST_CALL mathProtoFuncSin(ExecState*);
-static JSValue JSC_HOST_CALL mathProtoFuncSqrt(ExecState*);
-static JSValue JSC_HOST_CALL mathProtoFuncTan(ExecState*);
+static EncodedJSValue JSC_HOST_CALL mathProtoFuncAbs(ExecState*);
+static EncodedJSValue JSC_HOST_CALL mathProtoFuncACos(ExecState*);
+static EncodedJSValue JSC_HOST_CALL mathProtoFuncASin(ExecState*);
+static EncodedJSValue JSC_HOST_CALL mathProtoFuncATan(ExecState*);
+static EncodedJSValue JSC_HOST_CALL mathProtoFuncATan2(ExecState*);
+static EncodedJSValue JSC_HOST_CALL mathProtoFuncCeil(ExecState*);
+static EncodedJSValue JSC_HOST_CALL mathProtoFuncCos(ExecState*);
+static EncodedJSValue JSC_HOST_CALL mathProtoFuncExp(ExecState*);
+static EncodedJSValue JSC_HOST_CALL mathProtoFuncFloor(ExecState*);
+static EncodedJSValue JSC_HOST_CALL mathProtoFuncLog(ExecState*);
+static EncodedJSValue JSC_HOST_CALL mathProtoFuncMax(ExecState*);
+static EncodedJSValue JSC_HOST_CALL mathProtoFuncMin(ExecState*);
+static EncodedJSValue JSC_HOST_CALL mathProtoFuncPow(ExecState*);
+static EncodedJSValue JSC_HOST_CALL mathProtoFuncRandom(ExecState*);
+static EncodedJSValue JSC_HOST_CALL mathProtoFuncRound(ExecState*);
+static EncodedJSValue JSC_HOST_CALL mathProtoFuncSin(ExecState*);
+static EncodedJSValue JSC_HOST_CALL mathProtoFuncSqrt(ExecState*);
+static EncodedJSValue JSC_HOST_CALL mathProtoFuncTan(ExecState*);
}
@@ -113,57 +113,57 @@
// ------------------------------ Functions --------------------------------
-JSValue JSC_HOST_CALL mathProtoFuncAbs(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL mathProtoFuncAbs(ExecState* exec)
{
- return jsNumber(exec, fabs(exec->argument(0).toNumber(exec)));
+ return JSValue::encode(jsNumber(exec, fabs(exec->argument(0).toNumber(exec))));
}
-JSValue JSC_HOST_CALL mathProtoFuncACos(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL mathProtoFuncACos(ExecState* exec)
{
- return jsDoubleNumber(exec, acos(exec->argument(0).toNumber(exec)));
+ return JSValue::encode(jsDoubleNumber(exec, acos(exec->argument(0).toNumber(exec))));
}
-JSValue JSC_HOST_CALL mathProtoFuncASin(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL mathProtoFuncASin(ExecState* exec)
{
- return jsDoubleNumber(exec, asin(exec->argument(0).toNumber(exec)));
+ return JSValue::encode(jsDoubleNumber(exec, asin(exec->argument(0).toNumber(exec))));
}
-JSValue JSC_HOST_CALL mathProtoFuncATan(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL mathProtoFuncATan(ExecState* exec)
{
- return jsDoubleNumber(exec, atan(exec->argument(0).toNumber(exec)));
+ return JSValue::encode(jsDoubleNumber(exec, atan(exec->argument(0).toNumber(exec))));
}
-JSValue JSC_HOST_CALL mathProtoFuncATan2(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL mathProtoFuncATan2(ExecState* exec)
{
- return jsDoubleNumber(exec, atan2(exec->argument(0).toNumber(exec), exec->argument(1).toNumber(exec)));
+ return JSValue::encode(jsDoubleNumber(exec, atan2(exec->argument(0).toNumber(exec), exec->argument(1).toNumber(exec))));
}
-JSValue JSC_HOST_CALL mathProtoFuncCeil(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL mathProtoFuncCeil(ExecState* exec)
{
- return jsNumber(exec, ceil(exec->argument(0).toNumber(exec)));
+ return JSValue::encode(jsNumber(exec, ceil(exec->argument(0).toNumber(exec))));
}
-JSValue JSC_HOST_CALL mathProtoFuncCos(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL mathProtoFuncCos(ExecState* exec)
{
- return jsDoubleNumber(exec, cos(exec->argument(0).toNumber(exec)));
+ return JSValue::encode(jsDoubleNumber(exec, cos(exec->argument(0).toNumber(exec))));
}
-JSValue JSC_HOST_CALL mathProtoFuncExp(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL mathProtoFuncExp(ExecState* exec)
{
- return jsDoubleNumber(exec, exp(exec->argument(0).toNumber(exec)));
+ return JSValue::encode(jsDoubleNumber(exec, exp(exec->argument(0).toNumber(exec))));
}
-JSValue JSC_HOST_CALL mathProtoFuncFloor(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL mathProtoFuncFloor(ExecState* exec)
{
- return jsNumber(exec, floor(exec->argument(0).toNumber(exec)));
+ return JSValue::encode(jsNumber(exec, floor(exec->argument(0).toNumber(exec))));
}
-JSValue JSC_HOST_CALL mathProtoFuncLog(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL mathProtoFuncLog(ExecState* exec)
{
- return jsDoubleNumber(exec, log(exec->argument(0).toNumber(exec)));
+ return JSValue::encode(jsDoubleNumber(exec, log(exec->argument(0).toNumber(exec))));
}
-JSValue JSC_HOST_CALL mathProtoFuncMax(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL mathProtoFuncMax(ExecState* exec)
{
unsigned argsCount = exec->argumentCount();
double result = -Inf;
@@ -176,10 +176,10 @@
if (val > result || (val == 0 && result == 0 && !signbit(val)))
result = val;
}
- return jsNumber(exec, result);
+ return JSValue::encode(jsNumber(exec, result));
}
-JSValue JSC_HOST_CALL mathProtoFuncMin(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL mathProtoFuncMin(ExecState* exec)
{
unsigned argsCount = exec->argumentCount();
double result = +Inf;
@@ -192,10 +192,10 @@
if (val < result || (val == 0 && result == 0 && signbit(val)))
result = val;
}
- return jsNumber(exec, result);
+ return JSValue::encode(jsNumber(exec, result));
}
-JSValue JSC_HOST_CALL mathProtoFuncPow(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL mathProtoFuncPow(ExecState* exec)
{
// ECMA 15.8.2.1.13
@@ -203,37 +203,37 @@
double arg2 = exec->argument(1).toNumber(exec);
if (isnan(arg2))
- return jsNaN(exec);
+ return JSValue::encode(jsNaN(exec));
if (isinf(arg2) && fabs(arg) == 1)
- return jsNaN(exec);
- return jsNumber(exec, pow(arg, arg2));
+ return JSValue::encode(jsNaN(exec));
+ return JSValue::encode(jsNumber(exec, pow(arg, arg2)));
}
-JSValue JSC_HOST_CALL mathProtoFuncRandom(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL mathProtoFuncRandom(ExecState* exec)
{
- return jsDoubleNumber(exec, exec->globalData().weakRandom.get());
+ return JSValue::encode(jsDoubleNumber(exec, exec->globalData().weakRandom.get()));
}
-JSValue JSC_HOST_CALL mathProtoFuncRound(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL mathProtoFuncRound(ExecState* exec)
{
double arg = exec->argument(0).toNumber(exec);
double integer = ceil(arg);
- return jsNumber(exec, integer - (integer - arg > 0.5));
+ return JSValue::encode(jsNumber(exec, integer - (integer - arg > 0.5)));
}
-JSValue JSC_HOST_CALL mathProtoFuncSin(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL mathProtoFuncSin(ExecState* exec)
{
- return exec->globalData().cachedSin(exec, exec->argument(0).toNumber(exec));
+ return JSValue::encode(exec->globalData().cachedSin(exec, exec->argument(0).toNumber(exec)));
}
-JSValue JSC_HOST_CALL mathProtoFuncSqrt(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL mathProtoFuncSqrt(ExecState* exec)
{
- return jsDoubleNumber(exec, sqrt(exec->argument(0).toNumber(exec)));
+ return JSValue::encode(jsDoubleNumber(exec, sqrt(exec->argument(0).toNumber(exec))));
}
-JSValue JSC_HOST_CALL mathProtoFuncTan(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL mathProtoFuncTan(ExecState* exec)
{
- return jsDoubleNumber(exec, tan(exec->argument(0).toNumber(exec)));
+ return JSValue::encode(jsDoubleNumber(exec, tan(exec->argument(0).toNumber(exec))));
}
} // namespace JSC
diff --git a/JavaScriptCore/runtime/NativeErrorConstructor.cpp b/JavaScriptCore/runtime/NativeErrorConstructor.cpp
index 32ae6b8..6b4e8ee 100644
--- a/JavaScriptCore/runtime/NativeErrorConstructor.cpp
+++ b/JavaScriptCore/runtime/NativeErrorConstructor.cpp
@@ -62,10 +62,10 @@
return ConstructTypeHost;
}
-static JSValue JSC_HOST_CALL callNativeErrorConstructor(ExecState* exec)
+static EncodedJSValue JSC_HOST_CALL callNativeErrorConstructor(ExecState* exec)
{
ArgList args(exec);
- return static_cast<NativeErrorConstructor*>(exec->callee())->construct(exec, args);
+ return JSValue::encode(static_cast<NativeErrorConstructor*>(exec->callee())->construct(exec, args));
}
CallType NativeErrorConstructor::getCallData(CallData& callData)
diff --git a/JavaScriptCore/runtime/NumberConstructor.cpp b/JavaScriptCore/runtime/NumberConstructor.cpp
index fe91f2e..c3a3e9f 100644
--- a/JavaScriptCore/runtime/NumberConstructor.cpp
+++ b/JavaScriptCore/runtime/NumberConstructor.cpp
@@ -115,9 +115,9 @@
}
// ECMA 15.7.2
-static JSValue JSC_HOST_CALL callNumberConstructor(ExecState* exec)
+static EncodedJSValue JSC_HOST_CALL callNumberConstructor(ExecState* exec)
{
- return jsNumber(exec, !exec->argumentCount() ? 0 : exec->argument(0).toNumber(exec));
+ return JSValue::encode(jsNumber(exec, !exec->argumentCount() ? 0 : exec->argument(0).toNumber(exec)));
}
CallType NumberConstructor::getCallData(CallData& callData)
diff --git a/JavaScriptCore/runtime/NumberPrototype.cpp b/JavaScriptCore/runtime/NumberPrototype.cpp
index 0f1590c..a8b8e3e 100644
--- a/JavaScriptCore/runtime/NumberPrototype.cpp
+++ b/JavaScriptCore/runtime/NumberPrototype.cpp
@@ -38,12 +38,12 @@
ASSERT_CLASS_FITS_IN_CELL(NumberPrototype);
-static JSValue JSC_HOST_CALL numberProtoFuncToString(ExecState*);
-static JSValue JSC_HOST_CALL numberProtoFuncToLocaleString(ExecState*);
-static JSValue JSC_HOST_CALL numberProtoFuncValueOf(ExecState*);
-static JSValue JSC_HOST_CALL numberProtoFuncToFixed(ExecState*);
-static JSValue JSC_HOST_CALL numberProtoFuncToExponential(ExecState*);
-static JSValue JSC_HOST_CALL numberProtoFuncToPrecision(ExecState*);
+static EncodedJSValue JSC_HOST_CALL numberProtoFuncToString(ExecState*);
+static EncodedJSValue JSC_HOST_CALL numberProtoFuncToLocaleString(ExecState*);
+static EncodedJSValue JSC_HOST_CALL numberProtoFuncValueOf(ExecState*);
+static EncodedJSValue JSC_HOST_CALL numberProtoFuncToFixed(ExecState*);
+static EncodedJSValue JSC_HOST_CALL numberProtoFuncToExponential(ExecState*);
+static EncodedJSValue JSC_HOST_CALL numberProtoFuncToPrecision(ExecState*);
// ECMA 15.7.4
@@ -137,12 +137,12 @@
return static_cast<double>(result);
}
-JSValue JSC_HOST_CALL numberProtoFuncToString(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL numberProtoFuncToString(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
JSValue v = thisValue.getJSNumber();
if (!v)
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
JSValue radixValue = exec->argument(0);
int radix;
@@ -154,7 +154,7 @@
radix = static_cast<int>(radixValue.toInteger(exec)); // nan -> 0
if (radix == 10)
- return jsString(exec, v.toString(exec));
+ return JSValue::encode(jsString(exec, v.toString(exec)));
static const char* const digits = "0123456789abcdefghijklmnopqrstuvwxyz";
@@ -164,13 +164,13 @@
int x = v.asInt32();
if (static_cast<unsigned>(x) < 36) { // Exclude negatives
JSGlobalData* globalData = &exec->globalData();
- return globalData->smallStrings.singleCharacterString(globalData, digits[x]);
+ return JSValue::encode(globalData->smallStrings.singleCharacterString(globalData, digits[x]));
}
}
}
if (radix < 2 || radix > 36)
- return throwError(exec, RangeError, "toString() radix argument must be between 2 and 36");
+ return JSValue::encode(throwError(exec, RangeError, "toString() radix argument must be between 2 and 36"));
// INT_MAX results in 1024 characters left of the dot with radix 2
// give the same space on the right side. safety checks are in place
@@ -179,7 +179,7 @@
const char* lastCharInString = s + sizeof(s) - 1;
double x = v.uncheckedGetNumber();
if (isnan(x) || isinf(x))
- return jsString(exec, UString::from(x));
+ return JSValue::encode(jsString(exec, UString::from(x)));
bool isNegative = x < 0.0;
if (isNegative)
@@ -218,47 +218,47 @@
*p = '\0';
ASSERT(p < s + sizeof(s));
- return jsString(exec, startOfResultString);
+ return JSValue::encode(jsString(exec, startOfResultString));
}
-JSValue JSC_HOST_CALL numberProtoFuncToLocaleString(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL numberProtoFuncToLocaleString(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
// FIXME: Not implemented yet.
JSValue v = thisValue.getJSNumber();
if (!v)
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
- return jsString(exec, v.toString(exec));
+ return JSValue::encode(jsString(exec, v.toString(exec)));
}
-JSValue JSC_HOST_CALL numberProtoFuncValueOf(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL numberProtoFuncValueOf(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
JSValue v = thisValue.getJSNumber();
if (!v)
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
- return v;
+ return JSValue::encode(v);
}
-JSValue JSC_HOST_CALL numberProtoFuncToFixed(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL numberProtoFuncToFixed(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
JSValue v = thisValue.getJSNumber();
if (!v)
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
JSValue fractionDigits = exec->argument(0);
double df = fractionDigits.toInteger(exec);
if (!(df >= 0 && df <= 20))
- return throwError(exec, RangeError, "toFixed() digits argument must be between 0 and 20");
+ return JSValue::encode(throwError(exec, RangeError, "toFixed() digits argument must be between 0 and 20"));
int f = static_cast<int>(df);
double x = v.uncheckedGetNumber();
if (isnan(x))
- return jsNontrivialString(exec, "NaN");
+ return JSValue::encode(jsNontrivialString(exec, "NaN"));
UString s;
if (x < 0) {
@@ -271,7 +271,7 @@
}
if (x >= pow(10.0, 21.0))
- return jsString(exec, makeString(s, UString::from(x)));
+ return JSValue::encode(jsString(exec, makeString(s, UString::from(x))));
const double tenToTheF = pow(10.0, f);
double n = floor(x * tenToTheF);
@@ -293,8 +293,8 @@
int kMinusf = k - f;
if (kMinusf < static_cast<int>(m.size()))
- return jsString(exec, makeString(s, m.substr(0, kMinusf), ".", m.substr(kMinusf)));
- return jsString(exec, makeString(s, m.substr(0, kMinusf)));
+ return JSValue::encode(jsString(exec, makeString(s, m.substr(0, kMinusf), ".", m.substr(kMinusf))));
+ return JSValue::encode(jsString(exec, makeString(s, m.substr(0, kMinusf))));
}
static void fractionalPartToString(char* buf, int& i, const char* result, int resultLength, int fractionalDigits)
@@ -335,22 +335,22 @@
buf[i++] = static_cast<char>('0' + exponential % 10);
}
-JSValue JSC_HOST_CALL numberProtoFuncToExponential(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL numberProtoFuncToExponential(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
JSValue v = thisValue.getJSNumber();
if (!v)
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
double x = v.uncheckedGetNumber();
if (isnan(x) || isinf(x))
- return jsString(exec, UString::from(x));
+ return JSValue::encode(jsString(exec, UString::from(x)));
JSValue fractionalDigitsValue = exec->argument(0);
double df = fractionalDigitsValue.toInteger(exec);
if (!(df >= 0 && df <= 20))
- return throwError(exec, RangeError, "toExponential() argument must between 0 and 20");
+ return JSValue::encode(throwError(exec, RangeError, "toExponential() argument must between 0 and 20"));
int fractionalDigits = static_cast<int>(df);
bool includeAllDigits = fractionalDigitsValue.isUndefined();
@@ -371,7 +371,7 @@
}
if (isnan(x))
- return jsNontrivialString(exec, "NaN");
+ return JSValue::encode(jsNontrivialString(exec, "NaN"));
if (x == -0.0) // (-0.0).toExponential() should print as 0 instead of -0
x = 0;
@@ -405,20 +405,20 @@
}
ASSERT(i <= 80);
- return jsString(exec, buf);
+ return JSValue::encode(jsString(exec, buf));
}
-JSValue JSC_HOST_CALL numberProtoFuncToPrecision(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL numberProtoFuncToPrecision(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
JSValue v = thisValue.getJSNumber();
if (!v)
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
double doublePrecision = exec->argument(0).toIntegerPreserveNaN(exec);
double x = v.uncheckedGetNumber();
if (exec->argument(0).isUndefined() || isnan(x) || isinf(x))
- return jsString(exec, v.toString(exec));
+ return JSValue::encode(jsString(exec, v.toString(exec)));
UString s;
if (x < 0) {
@@ -428,7 +428,7 @@
s = "";
if (!(doublePrecision >= 1 && doublePrecision <= 21)) // true for NaN
- return throwError(exec, RangeError, "toPrecision() argument must be between 1 and 21");
+ return JSValue::encode(throwError(exec, RangeError, "toPrecision() argument must be between 1 and 21"));
int precision = static_cast<int>(doublePrecision);
int e = 0;
@@ -458,8 +458,8 @@
if (m.size() > 1)
m = makeString(m.substr(0, 1), ".", m.substr(1));
if (e >= 0)
- return jsMakeNontrivialString(exec, s, m, "e+", UString::from(e));
- return jsMakeNontrivialString(exec, s, m, "e-", UString::from(-e));
+ return JSValue::encode(jsMakeNontrivialString(exec, s, m, "e+", UString::from(e)));
+ return JSValue::encode(jsMakeNontrivialString(exec, s, m, "e-", UString::from(-e)));
}
} else {
m = charSequence('0', precision);
@@ -467,13 +467,13 @@
}
if (e == precision - 1)
- return jsString(exec, makeString(s, m));
+ return JSValue::encode(jsString(exec, makeString(s, m)));
if (e >= 0) {
if (e + 1 < static_cast<int>(m.size()))
- return jsString(exec, makeString(s, m.substr(0, e + 1), ".", m.substr(e + 1)));
- return jsString(exec, makeString(s, m));
+ return JSValue::encode(jsString(exec, makeString(s, m.substr(0, e + 1), ".", m.substr(e + 1))));
+ return JSValue::encode(jsString(exec, makeString(s, m)));
}
- return jsMakeNontrivialString(exec, s, "0.", charSequence('0', -(e + 1)), m);
+ return JSValue::encode(jsMakeNontrivialString(exec, s, "0.", charSequence('0', -(e + 1)), m));
}
} // namespace JSC
diff --git a/JavaScriptCore/runtime/ObjectConstructor.cpp b/JavaScriptCore/runtime/ObjectConstructor.cpp
index c373f87..5a7fa74 100644
--- a/JavaScriptCore/runtime/ObjectConstructor.cpp
+++ b/JavaScriptCore/runtime/ObjectConstructor.cpp
@@ -34,13 +34,13 @@
ASSERT_CLASS_FITS_IN_CELL(ObjectConstructor);
-static JSValue JSC_HOST_CALL objectConstructorGetPrototypeOf(ExecState*);
-static JSValue JSC_HOST_CALL objectConstructorGetOwnPropertyDescriptor(ExecState*);
-static JSValue JSC_HOST_CALL objectConstructorGetOwnPropertyNames(ExecState*);
-static JSValue JSC_HOST_CALL objectConstructorKeys(ExecState*);
-static JSValue JSC_HOST_CALL objectConstructorDefineProperty(ExecState*);
-static JSValue JSC_HOST_CALL objectConstructorDefineProperties(ExecState*);
-static JSValue JSC_HOST_CALL objectConstructorCreate(ExecState*);
+static EncodedJSValue JSC_HOST_CALL objectConstructorGetPrototypeOf(ExecState*);
+static EncodedJSValue JSC_HOST_CALL objectConstructorGetOwnPropertyDescriptor(ExecState*);
+static EncodedJSValue JSC_HOST_CALL objectConstructorGetOwnPropertyNames(ExecState*);
+static EncodedJSValue JSC_HOST_CALL objectConstructorKeys(ExecState*);
+static EncodedJSValue JSC_HOST_CALL objectConstructorDefineProperty(ExecState*);
+static EncodedJSValue JSC_HOST_CALL objectConstructorDefineProperties(ExecState*);
+static EncodedJSValue JSC_HOST_CALL objectConstructorCreate(ExecState*);
ObjectConstructor::ObjectConstructor(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, ObjectPrototype* objectPrototype, Structure* prototypeFunctionStructure)
: InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, "Object"))
@@ -80,10 +80,10 @@
return ConstructTypeHost;
}
-static JSValue JSC_HOST_CALL callObjectConstructor(ExecState* exec)
+static EncodedJSValue JSC_HOST_CALL callObjectConstructor(ExecState* exec)
{
ArgList args(exec);
- return constructObject(exec, args);
+ return JSValue::encode(constructObject(exec, args));
}
CallType ObjectConstructor::getCallData(CallData& callData)
@@ -92,26 +92,26 @@
return CallTypeHost;
}
-JSValue JSC_HOST_CALL objectConstructorGetPrototypeOf(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL objectConstructorGetPrototypeOf(ExecState* exec)
{
if (!exec->argument(0).isObject())
- return throwError(exec, TypeError, "Requested prototype of a value that is not an object.");
- return asObject(exec->argument(0))->prototype();
+ return JSValue::encode(throwError(exec, TypeError, "Requested prototype of a value that is not an object."));
+ return JSValue::encode(asObject(exec->argument(0))->prototype());
}
-JSValue JSC_HOST_CALL objectConstructorGetOwnPropertyDescriptor(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL objectConstructorGetOwnPropertyDescriptor(ExecState* exec)
{
if (!exec->argument(0).isObject())
- return throwError(exec, TypeError, "Requested property descriptor of a value that is not an object.");
+ return JSValue::encode(throwError(exec, TypeError, "Requested property descriptor of a value that is not an object."));
UString propertyName = exec->argument(1).toString(exec);
if (exec->hadException())
- return jsNull();
+ return JSValue::encode(jsNull());
JSObject* object = asObject(exec->argument(0));
PropertyDescriptor descriptor;
if (!object->getOwnPropertyDescriptor(exec, Identifier(exec, propertyName), descriptor))
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
if (exec->hadException())
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
JSObject* description = constructEmptyObject(exec);
if (!descriptor.isAccessorDescriptor()) {
@@ -125,35 +125,35 @@
description->putDirect(exec->propertyNames().enumerable, jsBoolean(descriptor.enumerable()), 0);
description->putDirect(exec->propertyNames().configurable, jsBoolean(descriptor.configurable()), 0);
- return description;
+ return JSValue::encode(description);
}
// FIXME: Use the enumeration cache.
-JSValue JSC_HOST_CALL objectConstructorGetOwnPropertyNames(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL objectConstructorGetOwnPropertyNames(ExecState* exec)
{
if (!exec->argument(0).isObject())
- return throwError(exec, TypeError, "Requested property names of a value that is not an object.");
+ return JSValue::encode(throwError(exec, TypeError, "Requested property names of a value that is not an object."));
PropertyNameArray properties(exec);
asObject(exec->argument(0))->getOwnPropertyNames(exec, properties, IncludeDontEnumProperties);
JSArray* names = constructEmptyArray(exec);
size_t numProperties = properties.size();
for (size_t i = 0; i < numProperties; i++)
names->push(exec, jsOwnedString(exec, properties[i].ustring()));
- return names;
+ return JSValue::encode(names);
}
// FIXME: Use the enumeration cache.
-JSValue JSC_HOST_CALL objectConstructorKeys(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL objectConstructorKeys(ExecState* exec)
{
if (!exec->argument(0).isObject())
- return throwError(exec, TypeError, "Requested keys of a value that is not an object.");
+ return JSValue::encode(throwError(exec, TypeError, "Requested keys of a value that is not an object."));
PropertyNameArray properties(exec);
asObject(exec->argument(0))->getOwnPropertyNames(exec, properties);
JSArray* keys = constructEmptyArray(exec);
size_t numProperties = properties.size();
for (size_t i = 0; i < numProperties; i++)
keys->push(exec, jsOwnedString(exec, properties[i].ustring()));
- return keys;
+ return JSValue::encode(keys);
}
// ES5 8.10.5 ToPropertyDescriptor
@@ -201,7 +201,7 @@
return false;
if (!get.isUndefined()) {
CallData callData;
- if (get.getCallData(callData) == CallTypeNone) {
+ if (getCallData(get, callData) == CallTypeNone) {
throwError(exec, TypeError, "Getter must be a function.");
return false;
}
@@ -217,7 +217,7 @@
return false;
if (!set.isUndefined()) {
CallData callData;
- if (set.getCallData(callData) == CallTypeNone) {
+ if (getCallData(set, callData) == CallTypeNone) {
throwError(exec, TypeError, "Setter must be a function.");
return false;
}
@@ -242,21 +242,21 @@
return true;
}
-JSValue JSC_HOST_CALL objectConstructorDefineProperty(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL objectConstructorDefineProperty(ExecState* exec)
{
if (!exec->argument(0).isObject())
- return throwError(exec, TypeError, "Properties can only be defined on Objects.");
+ return JSValue::encode(throwError(exec, TypeError, "Properties can only be defined on Objects."));
JSObject* O = asObject(exec->argument(0));
UString propertyName = exec->argument(1).toString(exec);
if (exec->hadException())
- return jsNull();
+ return JSValue::encode(jsNull());
PropertyDescriptor descriptor;
if (!toPropertyDescriptor(exec, exec->argument(2), descriptor))
- return jsNull();
+ return JSValue::encode(jsNull());
ASSERT((descriptor.attributes() & (Getter | Setter)) || (!descriptor.isAccessorDescriptor()));
ASSERT(!exec->hadException());
O->defineOwnProperty(exec, Identifier(exec, propertyName), descriptor, true);
- return O;
+ return JSValue::encode(O);
}
static JSValue defineProperties(ExecState* exec, JSObject* object, JSObject* properties)
@@ -293,26 +293,26 @@
return object;
}
-JSValue JSC_HOST_CALL objectConstructorDefineProperties(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL objectConstructorDefineProperties(ExecState* exec)
{
if (!exec->argument(0).isObject())
- return throwError(exec, TypeError, "Properties can only be defined on Objects.");
+ return JSValue::encode(throwError(exec, TypeError, "Properties can only be defined on Objects."));
if (!exec->argument(1).isObject())
- return throwError(exec, TypeError, "Property descriptor list must be an Object.");
- return defineProperties(exec, asObject(exec->argument(0)), asObject(exec->argument(1)));
+ return JSValue::encode(throwError(exec, TypeError, "Property descriptor list must be an Object."));
+ return JSValue::encode(defineProperties(exec, asObject(exec->argument(0)), asObject(exec->argument(1))));
}
-JSValue JSC_HOST_CALL objectConstructorCreate(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL objectConstructorCreate(ExecState* exec)
{
if (!exec->argument(0).isObject() && !exec->argument(0).isNull())
- return throwError(exec, TypeError, "Object prototype may only be an Object or null.");
+ return JSValue::encode(throwError(exec, TypeError, "Object prototype may only be an Object or null."));
JSObject* newObject = constructEmptyObject(exec);
newObject->setPrototype(exec->argument(0));
if (exec->argument(1).isUndefined())
- return newObject;
+ return JSValue::encode(newObject);
if (!exec->argument(1).isObject())
- return throwError(exec, TypeError, "Property descriptor list must be an Object.");
- return defineProperties(exec, newObject, asObject(exec->argument(1)));
+ return JSValue::encode(throwError(exec, TypeError, "Property descriptor list must be an Object."));
+ return JSValue::encode(defineProperties(exec, newObject, asObject(exec->argument(1))));
}
} // namespace JSC
diff --git a/JavaScriptCore/runtime/ObjectPrototype.cpp b/JavaScriptCore/runtime/ObjectPrototype.cpp
index 87212da..ceb89fa 100644
--- a/JavaScriptCore/runtime/ObjectPrototype.cpp
+++ b/JavaScriptCore/runtime/ObjectPrototype.cpp
@@ -31,15 +31,15 @@
ASSERT_CLASS_FITS_IN_CELL(ObjectPrototype);
-static JSValue JSC_HOST_CALL objectProtoFuncValueOf(ExecState*);
-static JSValue JSC_HOST_CALL objectProtoFuncHasOwnProperty(ExecState*);
-static JSValue JSC_HOST_CALL objectProtoFuncIsPrototypeOf(ExecState*);
-static JSValue JSC_HOST_CALL objectProtoFuncDefineGetter(ExecState*);
-static JSValue JSC_HOST_CALL objectProtoFuncDefineSetter(ExecState*);
-static JSValue JSC_HOST_CALL objectProtoFuncLookupGetter(ExecState*);
-static JSValue JSC_HOST_CALL objectProtoFuncLookupSetter(ExecState*);
-static JSValue JSC_HOST_CALL objectProtoFuncPropertyIsEnumerable(ExecState*);
-static JSValue JSC_HOST_CALL objectProtoFuncToLocaleString(ExecState*);
+static EncodedJSValue JSC_HOST_CALL objectProtoFuncValueOf(ExecState*);
+static EncodedJSValue JSC_HOST_CALL objectProtoFuncHasOwnProperty(ExecState*);
+static EncodedJSValue JSC_HOST_CALL objectProtoFuncIsPrototypeOf(ExecState*);
+static EncodedJSValue JSC_HOST_CALL objectProtoFuncDefineGetter(ExecState*);
+static EncodedJSValue JSC_HOST_CALL objectProtoFuncDefineSetter(ExecState*);
+static EncodedJSValue JSC_HOST_CALL objectProtoFuncLookupGetter(ExecState*);
+static EncodedJSValue JSC_HOST_CALL objectProtoFuncLookupSetter(ExecState*);
+static EncodedJSValue JSC_HOST_CALL objectProtoFuncPropertyIsEnumerable(ExecState*);
+static EncodedJSValue JSC_HOST_CALL objectProtoFuncToLocaleString(ExecState*);
ObjectPrototype::ObjectPrototype(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> stucture, Structure* prototypeFunctionStructure)
: JSObject(stucture)
@@ -81,85 +81,85 @@
// ECMA 15.2.4.2, 15.2.4.4, 15.2.4.5, 15.2.4.7
-JSValue JSC_HOST_CALL objectProtoFuncValueOf(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL objectProtoFuncValueOf(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
- return thisValue.toThisObject(exec);
+ return JSValue::encode(thisValue.toThisObject(exec));
}
-JSValue JSC_HOST_CALL objectProtoFuncHasOwnProperty(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL objectProtoFuncHasOwnProperty(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
- return jsBoolean(thisValue.toThisObject(exec)->hasOwnProperty(exec, Identifier(exec, exec->argument(0).toString(exec))));
+ return JSValue::encode(jsBoolean(thisValue.toThisObject(exec)->hasOwnProperty(exec, Identifier(exec, exec->argument(0).toString(exec)))));
}
-JSValue JSC_HOST_CALL objectProtoFuncIsPrototypeOf(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL objectProtoFuncIsPrototypeOf(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
JSObject* thisObj = thisValue.toThisObject(exec);
if (!exec->argument(0).isObject())
- return jsBoolean(false);
+ return JSValue::encode(jsBoolean(false));
JSValue v = asObject(exec->argument(0))->prototype();
while (true) {
if (!v.isObject())
- return jsBoolean(false);
+ return JSValue::encode(jsBoolean(false));
if (v == thisObj)
- return jsBoolean(true);
+ return JSValue::encode(jsBoolean(true));
v = asObject(v)->prototype();
}
}
-JSValue JSC_HOST_CALL objectProtoFuncDefineGetter(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL objectProtoFuncDefineGetter(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
CallData callData;
- if (exec->argument(1).getCallData(callData) == CallTypeNone)
- return throwError(exec, SyntaxError, "invalid getter usage");
+ if (getCallData(exec->argument(1), callData) == CallTypeNone)
+ return JSValue::encode(throwError(exec, SyntaxError, "invalid getter usage"));
thisValue.toThisObject(exec)->defineGetter(exec, Identifier(exec, exec->argument(0).toString(exec)), asObject(exec->argument(1)));
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
}
-JSValue JSC_HOST_CALL objectProtoFuncDefineSetter(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL objectProtoFuncDefineSetter(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
CallData callData;
- if (exec->argument(1).getCallData(callData) == CallTypeNone)
- return throwError(exec, SyntaxError, "invalid setter usage");
+ if (getCallData(exec->argument(1), callData) == CallTypeNone)
+ return JSValue::encode(throwError(exec, SyntaxError, "invalid setter usage"));
thisValue.toThisObject(exec)->defineSetter(exec, Identifier(exec, exec->argument(0).toString(exec)), asObject(exec->argument(1)));
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
}
-JSValue JSC_HOST_CALL objectProtoFuncLookupGetter(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL objectProtoFuncLookupGetter(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
- return thisValue.toThisObject(exec)->lookupGetter(exec, Identifier(exec, exec->argument(0).toString(exec)));
+ return JSValue::encode(thisValue.toThisObject(exec)->lookupGetter(exec, Identifier(exec, exec->argument(0).toString(exec))));
}
-JSValue JSC_HOST_CALL objectProtoFuncLookupSetter(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL objectProtoFuncLookupSetter(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
- return thisValue.toThisObject(exec)->lookupSetter(exec, Identifier(exec, exec->argument(0).toString(exec)));
+ return JSValue::encode(thisValue.toThisObject(exec)->lookupSetter(exec, Identifier(exec, exec->argument(0).toString(exec))));
}
-JSValue JSC_HOST_CALL objectProtoFuncPropertyIsEnumerable(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL objectProtoFuncPropertyIsEnumerable(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
- return jsBoolean(thisValue.toThisObject(exec)->propertyIsEnumerable(exec, Identifier(exec, exec->argument(0).toString(exec))));
+ return JSValue::encode(jsBoolean(thisValue.toThisObject(exec)->propertyIsEnumerable(exec, Identifier(exec, exec->argument(0).toString(exec)))));
}
-JSValue JSC_HOST_CALL objectProtoFuncToLocaleString(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL objectProtoFuncToLocaleString(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
- return thisValue.toThisJSString(exec);
+ return JSValue::encode(thisValue.toThisJSString(exec));
}
-JSValue JSC_HOST_CALL objectProtoFuncToString(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL objectProtoFuncToString(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
- return jsMakeNontrivialString(exec, "[object ", thisValue.toThisObject(exec)->className(), "]");
+ return JSValue::encode(jsMakeNontrivialString(exec, "[object ", thisValue.toThisObject(exec)->className(), "]"));
}
} // namespace JSC
diff --git a/JavaScriptCore/runtime/ObjectPrototype.h b/JavaScriptCore/runtime/ObjectPrototype.h
index 8865d6b..0382ae4 100644
--- a/JavaScriptCore/runtime/ObjectPrototype.h
+++ b/JavaScriptCore/runtime/ObjectPrototype.h
@@ -36,7 +36,7 @@
bool m_hasNoPropertiesWithUInt32Names;
};
- JSValue JSC_HOST_CALL objectProtoFuncToString(ExecState*);
+ EncodedJSValue JSC_HOST_CALL objectProtoFuncToString(ExecState*);
} // namespace JSC
diff --git a/JavaScriptCore/runtime/RegExpConstructor.cpp b/JavaScriptCore/runtime/RegExpConstructor.cpp
index c79d5f8..6dbd25a 100644
--- a/JavaScriptCore/runtime/RegExpConstructor.cpp
+++ b/JavaScriptCore/runtime/RegExpConstructor.cpp
@@ -319,10 +319,10 @@
}
// ECMA 15.10.3
-static JSValue JSC_HOST_CALL callRegExpConstructor(ExecState* exec)
+static EncodedJSValue JSC_HOST_CALL callRegExpConstructor(ExecState* exec)
{
ArgList args(exec);
- return constructRegExp(exec, args);
+ return JSValue::encode(constructRegExp(exec, args));
}
CallType RegExpConstructor::getCallData(CallData& callData)
diff --git a/JavaScriptCore/runtime/RegExpObject.cpp b/JavaScriptCore/runtime/RegExpObject.cpp
index acec966..a43d254 100644
--- a/JavaScriptCore/runtime/RegExpObject.cpp
+++ b/JavaScriptCore/runtime/RegExpObject.cpp
@@ -125,9 +125,9 @@
return jsNull();
}
-static JSValue JSC_HOST_CALL callRegExpObject(ExecState* exec)
+static EncodedJSValue JSC_HOST_CALL callRegExpObject(ExecState* exec)
{
- return asRegExpObject(exec->callee())->exec(exec);
+ return JSValue::encode(asRegExpObject(exec->callee())->exec(exec));
}
CallType RegExpObject::getCallData(CallData& callData)
diff --git a/JavaScriptCore/runtime/RegExpPrototype.cpp b/JavaScriptCore/runtime/RegExpPrototype.cpp
index 0a531ac..7fd0024 100644
--- a/JavaScriptCore/runtime/RegExpPrototype.cpp
+++ b/JavaScriptCore/runtime/RegExpPrototype.cpp
@@ -38,10 +38,10 @@
ASSERT_CLASS_FITS_IN_CELL(RegExpPrototype);
-static JSValue JSC_HOST_CALL regExpProtoFuncTest(ExecState*);
-static JSValue JSC_HOST_CALL regExpProtoFuncExec(ExecState*);
-static JSValue JSC_HOST_CALL regExpProtoFuncCompile(ExecState*);
-static JSValue JSC_HOST_CALL regExpProtoFuncToString(ExecState*);
+static EncodedJSValue JSC_HOST_CALL regExpProtoFuncTest(ExecState*);
+static EncodedJSValue JSC_HOST_CALL regExpProtoFuncExec(ExecState*);
+static EncodedJSValue JSC_HOST_CALL regExpProtoFuncCompile(ExecState*);
+static EncodedJSValue JSC_HOST_CALL regExpProtoFuncToString(ExecState*);
// ECMA 15.10.5
@@ -57,28 +57,28 @@
}
// ------------------------------ Functions ---------------------------
-
-JSValue JSC_HOST_CALL regExpProtoFuncTest(ExecState* exec)
+
+EncodedJSValue JSC_HOST_CALL regExpProtoFuncTest(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&RegExpObject::info))
- return throwError(exec, TypeError);
- return asRegExpObject(thisValue)->test(exec);
+ return JSValue::encode(throwError(exec, TypeError));
+ return JSValue::encode(asRegExpObject(thisValue)->test(exec));
}
-JSValue JSC_HOST_CALL regExpProtoFuncExec(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL regExpProtoFuncExec(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&RegExpObject::info))
- return throwError(exec, TypeError);
- return asRegExpObject(thisValue)->exec(exec);
+ return JSValue::encode(throwError(exec, TypeError));
+ return JSValue::encode(asRegExpObject(thisValue)->exec(exec));
}
-JSValue JSC_HOST_CALL regExpProtoFuncCompile(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL regExpProtoFuncCompile(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&RegExpObject::info))
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
RefPtr<RegExp> regExp;
JSValue arg0 = exec->argument(0);
@@ -86,7 +86,7 @@
if (arg0.inherits(&RegExpObject::info)) {
if (!arg1.isUndefined())
- return throwError(exec, TypeError, "Cannot supply flags when constructing one RegExp from another.");
+ return JSValue::encode(throwError(exec, TypeError, "Cannot supply flags when constructing one RegExp from another."));
regExp = asRegExpObject(arg0)->regExp();
} else {
UString pattern = !exec->argumentCount() ? UString("") : arg0.toString(exec);
@@ -95,20 +95,20 @@
}
if (!regExp->isValid())
- return throwError(exec, SyntaxError, makeString("Invalid regular expression: ", regExp->errorMessage()));
+ return JSValue::encode(throwError(exec, SyntaxError, makeString("Invalid regular expression: ", regExp->errorMessage())));
asRegExpObject(thisValue)->setRegExp(regExp.release());
asRegExpObject(thisValue)->setLastIndex(0);
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
}
-JSValue JSC_HOST_CALL regExpProtoFuncToString(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL regExpProtoFuncToString(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&RegExpObject::info)) {
if (thisValue.inherits(&RegExpPrototype::info))
- return jsNontrivialString(exec, "//");
- return throwError(exec, TypeError);
+ return JSValue::encode(jsNontrivialString(exec, "//"));
+ return JSValue::encode(throwError(exec, TypeError));
}
char postfix[5] = { '/', 0, 0, 0, 0 };
@@ -121,7 +121,7 @@
postfix[index] = 'm';
UString source = asRegExpObject(thisValue)->get(exec, exec->propertyNames().source).toString(exec);
// If source is empty, use "/(?:)/" to avoid colliding with comment syntax
- return jsMakeNontrivialString(exec, "/", source.size() ? source : UString("(?:)"), postfix);
+ return JSValue::encode(jsMakeNontrivialString(exec, "/", source.size() ? source : UString("(?:)"), postfix));
}
} // namespace JSC
diff --git a/JavaScriptCore/runtime/StringConstructor.cpp b/JavaScriptCore/runtime/StringConstructor.cpp
index c1484c5..736828a 100644
--- a/JavaScriptCore/runtime/StringConstructor.cpp
+++ b/JavaScriptCore/runtime/StringConstructor.cpp
@@ -40,11 +40,11 @@
return jsString(exec, impl);
}
-static JSValue JSC_HOST_CALL stringFromCharCode(ExecState* exec)
+static EncodedJSValue JSC_HOST_CALL stringFromCharCode(ExecState* exec)
{
if (LIKELY(exec->argumentCount() == 1))
- return jsSingleCharacterString(exec, exec->argument(0).toUInt32(exec));
- return stringFromCharCodeSlowCase(exec);
+ return JSValue::encode(jsSingleCharacterString(exec, exec->argument(0).toUInt32(exec)));
+ return JSValue::encode(stringFromCharCodeSlowCase(exec));
}
ASSERT_CLASS_FITS_IN_CELL(StringConstructor);
@@ -80,11 +80,11 @@
}
// ECMA 15.5.1
-static JSValue JSC_HOST_CALL callStringConstructor(ExecState* exec)
+static EncodedJSValue JSC_HOST_CALL callStringConstructor(ExecState* exec)
{
if (!exec->argumentCount())
- return jsEmptyString(exec);
- return jsString(exec, exec->argument(0).toString(exec));
+ return JSValue::encode(jsEmptyString(exec));
+ return JSValue::encode(jsString(exec, exec->argument(0).toString(exec)));
}
CallType StringConstructor::getCallData(CallData& callData)
diff --git a/JavaScriptCore/runtime/StringPrototype.cpp b/JavaScriptCore/runtime/StringPrototype.cpp
index f90d908..83ff0eb 100644
--- a/JavaScriptCore/runtime/StringPrototype.cpp
+++ b/JavaScriptCore/runtime/StringPrototype.cpp
@@ -45,38 +45,38 @@
ASSERT_CLASS_FITS_IN_CELL(StringPrototype);
-static JSValue JSC_HOST_CALL stringProtoFuncToString(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncCharAt(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncCharCodeAt(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncConcat(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncIndexOf(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncLastIndexOf(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncMatch(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncReplace(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncSearch(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncSlice(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncSplit(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncSubstr(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncSubstring(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncToLowerCase(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncToUpperCase(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncLocaleCompare(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncBig(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncSmall(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncBlink(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncBold(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncFixed(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncItalics(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncStrike(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncSub(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncSup(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncFontcolor(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncFontsize(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncAnchor(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncLink(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncTrim(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncTrimLeft(ExecState*);
-static JSValue JSC_HOST_CALL stringProtoFuncTrimRight(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncToString(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncCharAt(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncCharCodeAt(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncConcat(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncIndexOf(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncLastIndexOf(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncMatch(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncReplace(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncSearch(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncSlice(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncSplit(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncSubstr(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncSubstring(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncToLowerCase(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncToUpperCase(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncLocaleCompare(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncBig(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncSmall(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncBlink(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncBold(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncFixed(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncItalics(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncStrike(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncSub(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncSup(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncFontcolor(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncFontsize(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncAnchor(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncLink(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncTrim(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncTrimLeft(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncTrimRight(ExecState*);
}
@@ -286,7 +286,7 @@
return jsString(exec, impl);
}
-JSValue JSC_HOST_CALL stringProtoFuncReplace(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncReplace(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
JSString* sourceVal = thisValue.toThisJSString(exec);
@@ -295,14 +295,14 @@
UString replacementString;
CallData callData;
- CallType callType = replacement.getCallData(callData);
+ CallType callType = getCallData(replacement, callData);
if (callType == CallTypeNone)
replacementString = replacement.toString(exec);
if (pattern.inherits(&RegExpObject::info)) {
const UString& source = sourceVal->value(exec);
if (exec->hadException())
- return JSValue();
+ return JSValue::encode(JSValue());
RegExp* reg = asRegExpObject(pattern)->regExp();
bool global = reg->global();
@@ -321,7 +321,7 @@
JSFunction* func = asFunction(replacement);
CachedCall cachedCall(exec, func, argCount, exec->exceptionSlot());
if (exec->hadException())
- return jsNull();
+ return JSValue::encode(jsNull());
while (true) {
int matchIndex;
int matchLen = 0;
@@ -413,25 +413,25 @@
}
if (!lastIndex && replacements.isEmpty())
- return sourceVal;
+ return JSValue::encode(sourceVal);
if (static_cast<unsigned>(lastIndex) < source.size())
sourceRanges.append(StringRange(lastIndex, source.size() - lastIndex));
- return jsSpliceSubstringsWithSeparators(exec, sourceVal, source, sourceRanges.data(), sourceRanges.size(), replacements.data(), replacements.size());
+ return JSValue::encode(jsSpliceSubstringsWithSeparators(exec, sourceVal, source, sourceRanges.data(), sourceRanges.size(), replacements.data(), replacements.size()));
}
// Not a regular expression, so treat the pattern as a string.
UString patternString = pattern.toString(exec);
if (patternString.size() == 1 && callType == CallTypeNone)
- return sourceVal->replaceCharacter(exec, patternString[0], replacementString);
+ return JSValue::encode(sourceVal->replaceCharacter(exec, patternString[0], replacementString));
const UString& source = sourceVal->value(exec);
unsigned matchPos = source.find(patternString);
if (matchPos == UString::NotFound)
- return sourceVal;
+ return JSValue::encode(sourceVal);
int matchLen = patternString.size();
if (callType != CallTypeNone) {
@@ -445,24 +445,24 @@
size_t matchEnd = matchPos + matchLen;
int ovector[2] = { matchPos, matchEnd };
- return jsString(exec, source.substr(0, matchPos), substituteBackreferences(replacementString, source, ovector, 0), source.substr(matchEnd));
+ return JSValue::encode(jsString(exec, source.substr(0, matchPos), substituteBackreferences(replacementString, source, ovector, 0), source.substr(matchEnd)));
}
-JSValue JSC_HOST_CALL stringProtoFuncToString(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncToString(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
// Also used for valueOf.
if (thisValue.isString())
- return thisValue;
+ return JSValue::encode(thisValue);
if (thisValue.inherits(&StringObject::info))
- return asStringObject(thisValue)->internalValue();
+ return JSValue::encode(asStringObject(thisValue)->internalValue());
- return throwError(exec, TypeError);
+ return JSValue::encode(throwError(exec, TypeError));
}
-JSValue JSC_HOST_CALL stringProtoFuncCharAt(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncCharAt(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
UString s = thisValue.toThisString(exec);
@@ -471,16 +471,16 @@
if (a0.isUInt32()) {
uint32_t i = a0.asUInt32();
if (i < len)
- return jsSingleCharacterSubstring(exec, s, i);
- return jsEmptyString(exec);
+ return JSValue::encode(jsSingleCharacterSubstring(exec, s, i));
+ return JSValue::encode(jsEmptyString(exec));
}
double dpos = a0.toInteger(exec);
if (dpos >= 0 && dpos < len)
- return jsSingleCharacterSubstring(exec, s, static_cast<unsigned>(dpos));
- return jsEmptyString(exec);
+ return JSValue::encode(jsSingleCharacterSubstring(exec, s, static_cast<unsigned>(dpos)));
+ return JSValue::encode(jsEmptyString(exec));
}
-JSValue JSC_HOST_CALL stringProtoFuncCharCodeAt(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncCharCodeAt(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
UString s = thisValue.toThisString(exec);
@@ -489,29 +489,29 @@
if (a0.isUInt32()) {
uint32_t i = a0.asUInt32();
if (i < len)
- return jsNumber(exec, s.data()[i]);
- return jsNaN(exec);
+ return JSValue::encode(jsNumber(exec, s.data()[i]));
+ return JSValue::encode(jsNaN(exec));
}
double dpos = a0.toInteger(exec);
if (dpos >= 0 && dpos < len)
- return jsNumber(exec, s[static_cast<int>(dpos)]);
- return jsNaN(exec);
+ return JSValue::encode(jsNumber(exec, s[static_cast<int>(dpos)]));
+ return JSValue::encode(jsNaN(exec));
}
-JSValue JSC_HOST_CALL stringProtoFuncConcat(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncConcat(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (thisValue.isString() && (exec->argumentCount() == 1)) {
JSValue v = exec->argument(0);
- return v.isString()
+ return JSValue::encode(v.isString()
? jsString(exec, asString(thisValue), asString(v))
- : jsString(exec, asString(thisValue), v.toString(exec));
+ : jsString(exec, asString(thisValue), v.toString(exec)));
}
- return jsString(exec, thisValue);
+ return JSValue::encode(jsString(exec, thisValue));
}
-JSValue JSC_HOST_CALL stringProtoFuncIndexOf(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncIndexOf(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
UString s = thisValue.toThisString(exec);
@@ -536,11 +536,11 @@
unsigned result = s.find(u2, pos);
if (result == UString::NotFound)
- return jsNumber(exec, -1);
- return jsNumber(exec, result);
+ return JSValue::encode(jsNumber(exec, -1));
+ return JSValue::encode(jsNumber(exec, result));
}
-JSValue JSC_HOST_CALL stringProtoFuncLastIndexOf(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncLastIndexOf(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
UString s = thisValue.toThisString(exec);
@@ -563,11 +563,11 @@
unsigned result = s.rfind(u2, static_cast<unsigned>(dpos));
if (result == UString::NotFound)
- return jsNumber(exec, -1);
- return jsNumber(exec, result);
+ return JSValue::encode(jsNumber(exec, -1));
+ return JSValue::encode(jsNumber(exec, result));
}
-JSValue JSC_HOST_CALL stringProtoFuncMatch(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncMatch(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
UString s = thisValue.toThisString(exec);
@@ -594,8 +594,8 @@
if (!(reg->global())) {
// case without 'g' flag is handled like RegExp.prototype.exec
if (pos < 0)
- return jsNull();
- return regExpConstructor->arrayOfMatches(exec);
+ return JSValue::encode(jsNull());
+ return JSValue::encode(regExpConstructor->arrayOfMatches(exec));
}
// return array of matches
@@ -613,13 +613,13 @@
// if there are no matches at all, it's important to return
// Null instead of an empty array, because this matches
// other browsers and because Null is a false value.
- return jsNull();
+ return JSValue::encode(jsNull());
}
- return constructArray(exec, list);
+ return JSValue::encode(constructArray(exec, list));
}
-JSValue JSC_HOST_CALL stringProtoFuncSearch(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncSearch(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
UString s = thisValue.toThisString(exec);
@@ -642,10 +642,10 @@
int pos;
int matchLength = 0;
regExpConstructor->performMatch(reg.get(), u, 0, pos, matchLength);
- return jsNumber(exec, pos);
+ return JSValue::encode(jsNumber(exec, pos));
}
-JSValue JSC_HOST_CALL stringProtoFuncSlice(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncSlice(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
UString s = thisValue.toThisString(exec);
@@ -664,13 +664,13 @@
from = 0;
if (to > len)
to = len;
- return jsSubstring(exec, s, static_cast<unsigned>(from), static_cast<unsigned>(to) - static_cast<unsigned>(from));
+ return JSValue::encode(jsSubstring(exec, s, static_cast<unsigned>(from), static_cast<unsigned>(to) - static_cast<unsigned>(from)));
}
- return jsEmptyString(exec);
+ return JSValue::encode(jsEmptyString(exec));
}
-JSValue JSC_HOST_CALL stringProtoFuncSplit(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncSplit(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
UString s = thisValue.toThisString(exec);
@@ -686,7 +686,7 @@
RegExp* reg = asRegExpObject(a0)->regExp();
if (s.isEmpty() && reg->match(s, 0) >= 0) {
// empty string matched by regexp -> empty array
- return result;
+ return JSValue::encode(result);
}
unsigned pos = 0;
while (i != limit && pos < s.size()) {
@@ -713,7 +713,7 @@
if (u2.isEmpty()) {
if (s.isEmpty()) {
// empty separator matches empty string -> empty array
- return result;
+ return JSValue::encode(result);
}
while (i != limit && p0 < s.size() - 1)
result->put(exec, i++, jsSingleCharacterSubstring(exec, s, p0++));
@@ -731,10 +731,10 @@
if (i != limit)
result->put(exec, i++, jsSubstring(exec, s, p0, s.size() - p0));
- return result;
+ return JSValue::encode(result);
}
-JSValue JSC_HOST_CALL stringProtoFuncSubstr(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncSubstr(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
UString s = thisValue.toThisString(exec);
@@ -746,7 +746,7 @@
double start = a0.toInteger(exec);
double length = a1.isUndefined() ? len : a1.toInteger(exec);
if (start >= len || length <= 0)
- return jsEmptyString(exec);
+ return JSValue::encode(jsEmptyString(exec));
if (start < 0) {
start += len;
if (start < 0)
@@ -754,10 +754,10 @@
}
if (start + length > len)
length = len - start;
- return jsSubstring(exec, s, static_cast<unsigned>(start), static_cast<unsigned>(length));
+ return JSValue::encode(jsSubstring(exec, s, static_cast<unsigned>(start), static_cast<unsigned>(length)));
}
-JSValue JSC_HOST_CALL stringProtoFuncSubstring(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncSubstring(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
UString s = thisValue.toThisString(exec);
@@ -786,10 +786,10 @@
end = start;
start = temp;
}
- return jsSubstring(exec, s, static_cast<unsigned>(start), static_cast<unsigned>(end) - static_cast<unsigned>(start));
+ return JSValue::encode(jsSubstring(exec, s, static_cast<unsigned>(start), static_cast<unsigned>(end) - static_cast<unsigned>(start)));
}
-JSValue JSC_HOST_CALL stringProtoFuncToLowerCase(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncToLowerCase(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
JSString* sVal = thisValue.toThisJSString(exec);
@@ -797,7 +797,7 @@
int sSize = s.size();
if (!sSize)
- return sVal;
+ return JSValue::encode(sVal);
const UChar* sData = s.data();
Vector<UChar> buffer(sSize);
@@ -809,7 +809,7 @@
buffer[i] = toASCIILower(c);
}
if (!(ored & ~0x7f))
- return jsString(exec, UString::adopt(buffer));
+ return JSValue::encode(jsString(exec, UString::adopt(buffer)));
bool error;
int length = Unicode::toLower(buffer.data(), sSize, sData, sSize, &error);
@@ -817,17 +817,17 @@
buffer.resize(length);
length = Unicode::toLower(buffer.data(), length, sData, sSize, &error);
if (error)
- return sVal;
+ return JSValue::encode(sVal);
}
if (length == sSize) {
if (memcmp(buffer.data(), sData, length * sizeof(UChar)) == 0)
- return sVal;
+ return JSValue::encode(sVal);
} else
buffer.resize(length);
- return jsString(exec, UString::adopt(buffer));
+ return JSValue::encode(jsString(exec, UString::adopt(buffer)));
}
-JSValue JSC_HOST_CALL stringProtoFuncToUpperCase(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncToUpperCase(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
JSString* sVal = thisValue.toThisJSString(exec);
@@ -835,7 +835,7 @@
int sSize = s.size();
if (!sSize)
- return sVal;
+ return JSValue::encode(sVal);
const UChar* sData = s.data();
Vector<UChar> buffer(sSize);
@@ -847,7 +847,7 @@
buffer[i] = toASCIIUpper(c);
}
if (!(ored & ~0x7f))
- return jsString(exec, UString::adopt(buffer));
+ return JSValue::encode(jsString(exec, UString::adopt(buffer)));
bool error;
int length = Unicode::toUpper(buffer.data(), sSize, sData, sSize, &error);
@@ -855,99 +855,99 @@
buffer.resize(length);
length = Unicode::toUpper(buffer.data(), length, sData, sSize, &error);
if (error)
- return sVal;
+ return JSValue::encode(sVal);
}
if (length == sSize) {
if (memcmp(buffer.data(), sData, length * sizeof(UChar)) == 0)
- return sVal;
+ return JSValue::encode(sVal);
} else
buffer.resize(length);
- return jsString(exec, UString::adopt(buffer));
+ return JSValue::encode(jsString(exec, UString::adopt(buffer)));
}
-JSValue JSC_HOST_CALL stringProtoFuncLocaleCompare(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncLocaleCompare(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (exec->argumentCount() < 1)
- return jsNumber(exec, 0);
+ return JSValue::encode(jsNumber(exec, 0));
UString s = thisValue.toThisString(exec);
JSValue a0 = exec->argument(0);
- return jsNumber(exec, localeCompare(s, a0.toString(exec)));
+ return JSValue::encode(jsNumber(exec, localeCompare(s, a0.toString(exec))));
}
-JSValue JSC_HOST_CALL stringProtoFuncBig(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncBig(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
UString s = thisValue.toThisString(exec);
- return jsMakeNontrivialString(exec, "<big>", s, "</big>");
+ return JSValue::encode(jsMakeNontrivialString(exec, "<big>", s, "</big>"));
}
-JSValue JSC_HOST_CALL stringProtoFuncSmall(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncSmall(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
UString s = thisValue.toThisString(exec);
- return jsMakeNontrivialString(exec, "<small>", s, "</small>");
+ return JSValue::encode(jsMakeNontrivialString(exec, "<small>", s, "</small>"));
}
-JSValue JSC_HOST_CALL stringProtoFuncBlink(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncBlink(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
UString s = thisValue.toThisString(exec);
- return jsMakeNontrivialString(exec, "<blink>", s, "</blink>");
+ return JSValue::encode(jsMakeNontrivialString(exec, "<blink>", s, "</blink>"));
}
-JSValue JSC_HOST_CALL stringProtoFuncBold(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncBold(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
UString s = thisValue.toThisString(exec);
- return jsMakeNontrivialString(exec, "<b>", s, "</b>");
+ return JSValue::encode(jsMakeNontrivialString(exec, "<b>", s, "</b>"));
}
-JSValue JSC_HOST_CALL stringProtoFuncFixed(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncFixed(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
UString s = thisValue.toThisString(exec);
- return jsMakeNontrivialString(exec, "<tt>", s, "</tt>");
+ return JSValue::encode(jsMakeNontrivialString(exec, "<tt>", s, "</tt>"));
}
-JSValue JSC_HOST_CALL stringProtoFuncItalics(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncItalics(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
UString s = thisValue.toThisString(exec);
- return jsMakeNontrivialString(exec, "<i>", s, "</i>");
+ return JSValue::encode(jsMakeNontrivialString(exec, "<i>", s, "</i>"));
}
-JSValue JSC_HOST_CALL stringProtoFuncStrike(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncStrike(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
UString s = thisValue.toThisString(exec);
- return jsMakeNontrivialString(exec, "<strike>", s, "</strike>");
+ return JSValue::encode(jsMakeNontrivialString(exec, "<strike>", s, "</strike>"));
}
-JSValue JSC_HOST_CALL stringProtoFuncSub(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncSub(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
UString s = thisValue.toThisString(exec);
- return jsMakeNontrivialString(exec, "<sub>", s, "</sub>");
+ return JSValue::encode(jsMakeNontrivialString(exec, "<sub>", s, "</sub>"));
}
-JSValue JSC_HOST_CALL stringProtoFuncSup(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncSup(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
UString s = thisValue.toThisString(exec);
- return jsMakeNontrivialString(exec, "<sup>", s, "</sup>");
+ return JSValue::encode(jsMakeNontrivialString(exec, "<sup>", s, "</sup>"));
}
-JSValue JSC_HOST_CALL stringProtoFuncFontcolor(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncFontcolor(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
UString s = thisValue.toThisString(exec);
JSValue a0 = exec->argument(0);
- return jsMakeNontrivialString(exec, "<font color=\"", a0.toString(exec), "\">", s, "</font>");
+ return JSValue::encode(jsMakeNontrivialString(exec, "<font color=\"", a0.toString(exec), "\">", s, "</font>"));
}
-JSValue JSC_HOST_CALL stringProtoFuncFontsize(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncFontsize(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
UString s = thisValue.toThisString(exec);
@@ -960,7 +960,7 @@
UChar* buffer;
PassRefPtr<UStringImpl> impl = UStringImpl::tryCreateUninitialized(bufferSize, buffer);
if (!impl)
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
buffer[0] = '<';
buffer[1] = 'f';
buffer[2] = 'o';
@@ -984,21 +984,21 @@
buffer[19 + stringSize] = 'n';
buffer[20 + stringSize] = 't';
buffer[21 + stringSize] = '>';
- return jsNontrivialString(exec, impl);
+ return JSValue::encode(jsNontrivialString(exec, impl));
}
- return jsMakeNontrivialString(exec, "<font size=\"", a0.toString(exec), "\">", s, "</font>");
+ return JSValue::encode(jsMakeNontrivialString(exec, "<font size=\"", a0.toString(exec), "\">", s, "</font>"));
}
-JSValue JSC_HOST_CALL stringProtoFuncAnchor(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncAnchor(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
UString s = thisValue.toThisString(exec);
JSValue a0 = exec->argument(0);
- return jsMakeNontrivialString(exec, "<a name=\"", a0.toString(exec), "\">", s, "</a>");
+ return JSValue::encode(jsMakeNontrivialString(exec, "<a name=\"", a0.toString(exec), "\">", s, "</a>"));
}
-JSValue JSC_HOST_CALL stringProtoFuncLink(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncLink(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
UString s = thisValue.toThisString(exec);
@@ -1011,7 +1011,7 @@
UChar* buffer;
PassRefPtr<UStringImpl> impl = UStringImpl::tryCreateUninitialized(bufferSize, buffer);
if (!impl)
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
buffer[0] = '<';
buffer[1] = 'a';
buffer[2] = ' ';
@@ -1029,7 +1029,7 @@
buffer[12 + linkTextSize + stringSize] = '/';
buffer[13 + linkTextSize + stringSize] = 'a';
buffer[14 + linkTextSize + stringSize] = '>';
- return jsNontrivialString(exec, impl);
+ return JSValue::encode(jsNontrivialString(exec, impl));
}
enum {
@@ -1063,22 +1063,22 @@
return jsString(exec, str.substr(left, right - left));
}
-JSValue JSC_HOST_CALL stringProtoFuncTrim(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncTrim(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
- return trimString(exec, thisValue, TrimLeft | TrimRight);
+ return JSValue::encode(trimString(exec, thisValue, TrimLeft | TrimRight));
}
-JSValue JSC_HOST_CALL stringProtoFuncTrimLeft(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncTrimLeft(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
- return trimString(exec, thisValue, TrimLeft);
+ return JSValue::encode(trimString(exec, thisValue, TrimLeft));
}
-JSValue JSC_HOST_CALL stringProtoFuncTrimRight(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL stringProtoFuncTrimRight(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
- return trimString(exec, thisValue, TrimRight);
+ return JSValue::encode(trimString(exec, thisValue, TrimRight));
}