Ignore:
Timestamp:
Jun 3, 2010, 1:00:18 PM (15 years ago)
Author:
[email protected]
Message:

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):

(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):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/ObjectConstructor.cpp

    r60392 r60631  
    3535ASSERT_CLASS_FITS_IN_CELL(ObjectConstructor);
    3636
    37 static JSValue JSC_HOST_CALL objectConstructorGetPrototypeOf(ExecState*);
    38 static JSValue JSC_HOST_CALL objectConstructorGetOwnPropertyDescriptor(ExecState*);
    39 static JSValue JSC_HOST_CALL objectConstructorGetOwnPropertyNames(ExecState*);
    40 static JSValue JSC_HOST_CALL objectConstructorKeys(ExecState*);
    41 static JSValue JSC_HOST_CALL objectConstructorDefineProperty(ExecState*);
    42 static JSValue JSC_HOST_CALL objectConstructorDefineProperties(ExecState*);
    43 static JSValue JSC_HOST_CALL objectConstructorCreate(ExecState*);
     37static EncodedJSValue JSC_HOST_CALL objectConstructorGetPrototypeOf(ExecState*);
     38static EncodedJSValue JSC_HOST_CALL objectConstructorGetOwnPropertyDescriptor(ExecState*);
     39static EncodedJSValue JSC_HOST_CALL objectConstructorGetOwnPropertyNames(ExecState*);
     40static EncodedJSValue JSC_HOST_CALL objectConstructorKeys(ExecState*);
     41static EncodedJSValue JSC_HOST_CALL objectConstructorDefineProperty(ExecState*);
     42static EncodedJSValue JSC_HOST_CALL objectConstructorDefineProperties(ExecState*);
     43static EncodedJSValue JSC_HOST_CALL objectConstructorCreate(ExecState*);
    4444
    4545ObjectConstructor::ObjectConstructor(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, ObjectPrototype* objectPrototype, Structure* prototypeFunctionStructure)
     
    8181}
    8282
    83 static JSValue JSC_HOST_CALL callObjectConstructor(ExecState* exec)
     83static EncodedJSValue JSC_HOST_CALL callObjectConstructor(ExecState* exec)
    8484{
    8585    ArgList args(exec);
    86     return constructObject(exec, args);
     86    return JSValue::encode(constructObject(exec, args));
    8787}
    8888
     
    9393}
    9494
    95 JSValue JSC_HOST_CALL objectConstructorGetPrototypeOf(ExecState* exec)
    96 {
    97     if (!exec->argument(0).isObject())
    98         return throwError(exec, TypeError, "Requested prototype of a value that is not an object.");
    99     return asObject(exec->argument(0))->prototype();
    100 }
    101 
    102 JSValue JSC_HOST_CALL objectConstructorGetOwnPropertyDescriptor(ExecState* exec)
    103 {
    104     if (!exec->argument(0).isObject())
    105         return throwError(exec, TypeError, "Requested property descriptor of a value that is not an object.");
     95EncodedJSValue JSC_HOST_CALL objectConstructorGetPrototypeOf(ExecState* exec)
     96{
     97    if (!exec->argument(0).isObject())
     98        return JSValue::encode(throwError(exec, TypeError, "Requested prototype of a value that is not an object."));
     99    return JSValue::encode(asObject(exec->argument(0))->prototype());
     100}
     101
     102EncodedJSValue JSC_HOST_CALL objectConstructorGetOwnPropertyDescriptor(ExecState* exec)
     103{
     104    if (!exec->argument(0).isObject())
     105        return JSValue::encode(throwError(exec, TypeError, "Requested property descriptor of a value that is not an object."));
    106106    UString propertyName = exec->argument(1).toString(exec);
    107107    if (exec->hadException())
    108         return jsNull();
     108        return JSValue::encode(jsNull());
    109109    JSObject* object = asObject(exec->argument(0));
    110110    PropertyDescriptor descriptor;
    111111    if (!object->getOwnPropertyDescriptor(exec, Identifier(exec, propertyName), descriptor))
    112         return jsUndefined();
     112        return JSValue::encode(jsUndefined());
    113113    if (exec->hadException())
    114         return jsUndefined();
     114        return JSValue::encode(jsUndefined());
    115115
    116116    JSObject* description = constructEmptyObject(exec);
     
    126126    description->putDirect(exec->propertyNames().configurable, jsBoolean(descriptor.configurable()), 0);
    127127
    128     return description;
     128    return JSValue::encode(description);
    129129}
    130130
    131131// FIXME: Use the enumeration cache.
    132 JSValue JSC_HOST_CALL objectConstructorGetOwnPropertyNames(ExecState* exec)
    133 {
    134     if (!exec->argument(0).isObject())
    135         return throwError(exec, TypeError, "Requested property names of a value that is not an object.");
     132EncodedJSValue JSC_HOST_CALL objectConstructorGetOwnPropertyNames(ExecState* exec)
     133{
     134    if (!exec->argument(0).isObject())
     135        return JSValue::encode(throwError(exec, TypeError, "Requested property names of a value that is not an object."));
    136136    PropertyNameArray properties(exec);
    137137    asObject(exec->argument(0))->getOwnPropertyNames(exec, properties, IncludeDontEnumProperties);
     
    140140    for (size_t i = 0; i < numProperties; i++)
    141141        names->push(exec, jsOwnedString(exec, properties[i].ustring()));
    142     return names;
     142    return JSValue::encode(names);
    143143}
    144144
    145145// FIXME: Use the enumeration cache.
    146 JSValue JSC_HOST_CALL objectConstructorKeys(ExecState* exec)
    147 {
    148     if (!exec->argument(0).isObject())
    149         return throwError(exec, TypeError, "Requested keys of a value that is not an object.");
     146EncodedJSValue JSC_HOST_CALL objectConstructorKeys(ExecState* exec)
     147{
     148    if (!exec->argument(0).isObject())
     149        return JSValue::encode(throwError(exec, TypeError, "Requested keys of a value that is not an object."));
    150150    PropertyNameArray properties(exec);
    151151    asObject(exec->argument(0))->getOwnPropertyNames(exec, properties);
     
    154154    for (size_t i = 0; i < numProperties; i++)
    155155        keys->push(exec, jsOwnedString(exec, properties[i].ustring()));
    156     return keys;
     156    return JSValue::encode(keys);
    157157}
    158158
     
    202202        if (!get.isUndefined()) {
    203203            CallData callData;
    204             if (get.getCallData(callData) == CallTypeNone) {
     204            if (getCallData(get, callData) == CallTypeNone) {
    205205                throwError(exec, TypeError, "Getter must be a function.");
    206206                return false;
     
    218218        if (!set.isUndefined()) {
    219219            CallData callData;
    220             if (set.getCallData(callData) == CallTypeNone) {
     220            if (getCallData(set, callData) == CallTypeNone) {
    221221                throwError(exec, TypeError, "Setter must be a function.");
    222222                return false;
     
    243243}
    244244
    245 JSValue JSC_HOST_CALL objectConstructorDefineProperty(ExecState* exec)
    246 {
    247     if (!exec->argument(0).isObject())
    248         return throwError(exec, TypeError, "Properties can only be defined on Objects.");
     245EncodedJSValue JSC_HOST_CALL objectConstructorDefineProperty(ExecState* exec)
     246{
     247    if (!exec->argument(0).isObject())
     248        return JSValue::encode(throwError(exec, TypeError, "Properties can only be defined on Objects."));
    249249    JSObject* O = asObject(exec->argument(0));
    250250    UString propertyName = exec->argument(1).toString(exec);
    251251    if (exec->hadException())
    252         return jsNull();
     252        return JSValue::encode(jsNull());
    253253    PropertyDescriptor descriptor;
    254254    if (!toPropertyDescriptor(exec, exec->argument(2), descriptor))
    255         return jsNull();
     255        return JSValue::encode(jsNull());
    256256    ASSERT((descriptor.attributes() & (Getter | Setter)) || (!descriptor.isAccessorDescriptor()));
    257257    ASSERT(!exec->hadException());
    258258    O->defineOwnProperty(exec, Identifier(exec, propertyName), descriptor, true);
    259     return O;
     259    return JSValue::encode(O);
    260260}
    261261
     
    294294}
    295295
    296 JSValue JSC_HOST_CALL objectConstructorDefineProperties(ExecState* exec)
    297 {
    298     if (!exec->argument(0).isObject())
    299         return throwError(exec, TypeError, "Properties can only be defined on Objects.");
     296EncodedJSValue JSC_HOST_CALL objectConstructorDefineProperties(ExecState* exec)
     297{
     298    if (!exec->argument(0).isObject())
     299        return JSValue::encode(throwError(exec, TypeError, "Properties can only be defined on Objects."));
    300300    if (!exec->argument(1).isObject())
    301         return throwError(exec, TypeError, "Property descriptor list must be an Object.");
    302     return defineProperties(exec, asObject(exec->argument(0)), asObject(exec->argument(1)));
    303 }
    304 
    305 JSValue JSC_HOST_CALL objectConstructorCreate(ExecState* exec)
     301        return JSValue::encode(throwError(exec, TypeError, "Property descriptor list must be an Object."));
     302    return JSValue::encode(defineProperties(exec, asObject(exec->argument(0)), asObject(exec->argument(1))));
     303}
     304
     305EncodedJSValue JSC_HOST_CALL objectConstructorCreate(ExecState* exec)
    306306{
    307307    if (!exec->argument(0).isObject() && !exec->argument(0).isNull())
    308         return throwError(exec, TypeError, "Object prototype may only be an Object or null.");
     308        return JSValue::encode(throwError(exec, TypeError, "Object prototype may only be an Object or null."));
    309309    JSObject* newObject = constructEmptyObject(exec);
    310310    newObject->setPrototype(exec->argument(0));
    311311    if (exec->argument(1).isUndefined())
    312         return newObject;
     312        return JSValue::encode(newObject);
    313313    if (!exec->argument(1).isObject())
    314         return throwError(exec, TypeError, "Property descriptor list must be an Object.");
    315     return defineProperties(exec, newObject, asObject(exec->argument(1)));
     314        return JSValue::encode(throwError(exec, TypeError, "Property descriptor list must be an Object."));
     315    return JSValue::encode(defineProperties(exec, newObject, asObject(exec->argument(1))));
    316316}
    317317
Note: See TracChangeset for help on using the changeset viewer.