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/JSGlobalObjectFunctions.cpp

    r60392 r60631  
    273273}
    274274
    275 JSValue JSC_HOST_CALL globalFuncEval(ExecState* exec)
     275EncodedJSValue JSC_HOST_CALL globalFuncEval(ExecState* exec)
    276276{
    277277    JSObject* thisObject = exec->hostThisValue().toThisObject(exec);
    278278    JSObject* unwrappedObject = thisObject->unwrappedObject();
    279279    if (!unwrappedObject->isGlobalObject() || static_cast<JSGlobalObject*>(unwrappedObject)->evalFunction() != exec->callee())
    280         return throwError(exec, EvalError, "The \"this\" value passed to eval must be the global object from which eval originated");
     280        return JSValue::encode(throwError(exec, EvalError, "The \"this\" value passed to eval must be the global object from which eval originated"));
    281281
    282282    JSValue x = exec->argument(0);
    283283    if (!x.isString())
    284         return x;
     284        return JSValue::encode(x);
    285285
    286286    UString s = x.toString(exec);
     
    288288    LiteralParser preparser(exec, s, LiteralParser::NonStrictJSON);
    289289    if (JSValue parsedObject = preparser.tryLiteralParse())
    290         return parsedObject;
     290        return JSValue::encode(parsedObject);
    291291
    292292    RefPtr<EvalExecutable> eval = EvalExecutable::create(exec, makeSource(s));
    293293    JSObject* error = eval->compile(exec, static_cast<JSGlobalObject*>(unwrappedObject)->globalScopeChain().node());
    294294    if (error)
    295         return throwError(exec, error);
    296 
    297     return exec->interpreter()->execute(eval.get(), exec, thisObject, static_cast<JSGlobalObject*>(unwrappedObject)->globalScopeChain().node(), exec->exceptionSlot());
    298 }
    299 
    300 JSValue JSC_HOST_CALL globalFuncParseInt(ExecState* exec)
     295        return JSValue::encode(throwError(exec, error));
     296
     297    return JSValue::encode(exec->interpreter()->execute(eval.get(), exec, thisObject, static_cast<JSGlobalObject*>(unwrappedObject)->globalScopeChain().node(), exec->exceptionSlot()));
     298}
     299
     300EncodedJSValue JSC_HOST_CALL globalFuncParseInt(ExecState* exec)
    301301{
    302302    JSValue value = exec->argument(0);
     
    304304
    305305    if (radix != 0 && radix != 10)
    306         return jsNumber(exec, parseInt(value.toString(exec), radix));
     306        return JSValue::encode(jsNumber(exec, parseInt(value.toString(exec), radix)));
    307307
    308308    if (value.isInt32())
    309         return value;
     309        return JSValue::encode(value);
    310310
    311311    if (value.isDouble()) {
    312312        double d = value.asDouble();
    313313        if (isfinite(d))
    314             return jsNumber(exec, (d > 0) ? floor(d) : ceil(d));
     314            return JSValue::encode(jsNumber(exec, (d > 0) ? floor(d) : ceil(d)));
    315315        if (isnan(d) || isinf(d))
    316             return jsNaN(exec);
    317         return jsNumber(exec, 0);
    318     }
    319 
    320     return jsNumber(exec, parseInt(value.toString(exec), radix));
    321 }
    322 
    323 JSValue JSC_HOST_CALL globalFuncParseFloat(ExecState* exec)
    324 {
    325     return jsNumber(exec, parseFloat(exec->argument(0).toString(exec)));
    326 }
    327 
    328 JSValue JSC_HOST_CALL globalFuncIsNaN(ExecState* exec)
    329 {
    330     return jsBoolean(isnan(exec->argument(0).toNumber(exec)));
    331 }
    332 
    333 JSValue JSC_HOST_CALL globalFuncIsFinite(ExecState* exec)
     316            return JSValue::encode(jsNaN(exec));
     317        return JSValue::encode(jsNumber(exec, 0));
     318    }
     319
     320    return JSValue::encode(jsNumber(exec, parseInt(value.toString(exec), radix)));
     321}
     322
     323EncodedJSValue JSC_HOST_CALL globalFuncParseFloat(ExecState* exec)
     324{
     325    return JSValue::encode(jsNumber(exec, parseFloat(exec->argument(0).toString(exec))));
     326}
     327
     328EncodedJSValue JSC_HOST_CALL globalFuncIsNaN(ExecState* exec)
     329{
     330    return JSValue::encode(jsBoolean(isnan(exec->argument(0).toNumber(exec))));
     331}
     332
     333EncodedJSValue JSC_HOST_CALL globalFuncIsFinite(ExecState* exec)
    334334{
    335335    double n = exec->argument(0).toNumber(exec);
    336     return jsBoolean(!isnan(n) && !isinf(n));
    337 }
    338 
    339 JSValue JSC_HOST_CALL globalFuncDecodeURI(ExecState* exec)
     336    return JSValue::encode(jsBoolean(!isnan(n) && !isinf(n)));
     337}
     338
     339EncodedJSValue JSC_HOST_CALL globalFuncDecodeURI(ExecState* exec)
    340340{
    341341    static const char do_not_unescape_when_decoding_URI[] =
    342342        "#$&+,/:;=?@";
    343343
    344     return decode(exec, do_not_unescape_when_decoding_URI, true);
    345 }
    346 
    347 JSValue JSC_HOST_CALL globalFuncDecodeURIComponent(ExecState* exec)
    348 {
    349     return decode(exec, "", true);
    350 }
    351 
    352 JSValue JSC_HOST_CALL globalFuncEncodeURI(ExecState* exec)
     344    return JSValue::encode(decode(exec, do_not_unescape_when_decoding_URI, true));
     345}
     346
     347EncodedJSValue JSC_HOST_CALL globalFuncDecodeURIComponent(ExecState* exec)
     348{
     349    return JSValue::encode(decode(exec, "", true));
     350}
     351
     352EncodedJSValue JSC_HOST_CALL globalFuncEncodeURI(ExecState* exec)
    353353{
    354354    static const char do_not_escape_when_encoding_URI[] =
     
    358358        "!#$&'()*+,-./:;=?@_~";
    359359
    360     return encode(exec, do_not_escape_when_encoding_URI);
    361 }
    362 
    363 JSValue JSC_HOST_CALL globalFuncEncodeURIComponent(ExecState* exec)
     360    return JSValue::encode(encode(exec, do_not_escape_when_encoding_URI));
     361}
     362
     363EncodedJSValue JSC_HOST_CALL globalFuncEncodeURIComponent(ExecState* exec)
    364364{
    365365    static const char do_not_escape_when_encoding_URI_component[] =
     
    369369        "!'()*-._~";
    370370
    371     return encode(exec, do_not_escape_when_encoding_URI_component);
    372 }
    373 
    374 JSValue JSC_HOST_CALL globalFuncEscape(ExecState* exec)
     371    return JSValue::encode(encode(exec, do_not_escape_when_encoding_URI_component));
     372}
     373
     374EncodedJSValue JSC_HOST_CALL globalFuncEscape(ExecState* exec)
    375375{
    376376    static const char do_not_escape[] =
     
    398398    }
    399399
    400     return builder.build(exec);
    401 }
    402 
    403 JSValue JSC_HOST_CALL globalFuncUnescape(ExecState* exec)
     400    return JSValue::encode(builder.build(exec));
     401}
     402
     403EncodedJSValue JSC_HOST_CALL globalFuncUnescape(ExecState* exec)
    404404{
    405405    StringBuilder builder;
     
    425425    }
    426426
    427     return jsString(exec, builder.build());
     427    return JSValue::encode(jsString(exec, builder.build()));
    428428}
    429429
    430430#ifndef NDEBUG
    431 JSValue JSC_HOST_CALL globalFuncJSCPrint(ExecState* exec)
     431EncodedJSValue JSC_HOST_CALL globalFuncJSCPrint(ExecState* exec)
    432432{
    433433    CString string = exec->argument(0).toString(exec).UTF8String();
    434434    puts(string.data());
    435     return jsUndefined();
     435    return JSValue::encode(jsUndefined());
    436436}
    437437#endif
Note: See TracChangeset for help on using the changeset viewer.