Changeset 60631 in webkit for trunk/JavaScriptCore/jsc.cpp


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

    r60392 r60631  
    7272static bool fillBufferWithContentsOfFile(const UString& fileName, Vector<char>& buffer);
    7373
    74 static JSValue JSC_HOST_CALL functionPrint(ExecState*);
    75 static JSValue JSC_HOST_CALL functionDebug(ExecState*);
    76 static JSValue JSC_HOST_CALL functionGC(ExecState*);
    77 static JSValue JSC_HOST_CALL functionVersion(ExecState*);
    78 static JSValue JSC_HOST_CALL functionRun(ExecState*);
    79 static JSValue JSC_HOST_CALL functionLoad(ExecState*);
    80 static JSValue JSC_HOST_CALL functionCheckSyntax(ExecState*);
    81 static JSValue JSC_HOST_CALL functionReadline(ExecState*);
    82 static NO_RETURN_WITH_VALUE JSValue JSC_HOST_CALL functionQuit(ExecState*);
     74static EncodedJSValue JSC_HOST_CALL functionPrint(ExecState*);
     75static EncodedJSValue JSC_HOST_CALL functionDebug(ExecState*);
     76static EncodedJSValue JSC_HOST_CALL functionGC(ExecState*);
     77static EncodedJSValue JSC_HOST_CALL functionVersion(ExecState*);
     78static EncodedJSValue JSC_HOST_CALL functionRun(ExecState*);
     79static EncodedJSValue JSC_HOST_CALL functionLoad(ExecState*);
     80static EncodedJSValue JSC_HOST_CALL functionCheckSyntax(ExecState*);
     81static EncodedJSValue JSC_HOST_CALL functionReadline(ExecState*);
     82static NO_RETURN_WITH_VALUE EncodedJSValue JSC_HOST_CALL functionQuit(ExecState*);
    8383
    8484#if ENABLE(SAMPLING_FLAGS)
    85 static JSValue JSC_HOST_CALL functionSetSamplingFlags(ExecState*);
    86 static JSValue JSC_HOST_CALL functionClearSamplingFlags(ExecState*);
     85static EncodedJSValue JSC_HOST_CALL functionSetSamplingFlags(ExecState*);
     86static EncodedJSValue JSC_HOST_CALL functionClearSamplingFlags(ExecState*);
    8787#endif
    8888
     
    172172}
    173173
    174 JSValue JSC_HOST_CALL functionPrint(ExecState* exec)
     174EncodedJSValue JSC_HOST_CALL functionPrint(ExecState* exec)
    175175{
    176176    for (unsigned i = 0; i < exec->argumentCount(); ++i) {
     
    183183    putchar('\n');
    184184    fflush(stdout);
    185     return jsUndefined();
    186 }
    187 
    188 JSValue JSC_HOST_CALL functionDebug(ExecState* exec)
     185    return JSValue::encode(jsUndefined());
     186}
     187
     188EncodedJSValue JSC_HOST_CALL functionDebug(ExecState* exec)
    189189{
    190190    fprintf(stderr, "--> %s\n", exec->argument(0).toString(exec).UTF8String().data());
    191     return jsUndefined();
    192 }
    193 
    194 JSValue JSC_HOST_CALL functionGC(ExecState* exec)
     191    return JSValue::encode(jsUndefined());
     192}
     193
     194EncodedJSValue JSC_HOST_CALL functionGC(ExecState* exec)
    195195{
    196196    JSLock lock(SilenceAssertionsOnly);
    197197    exec->heap()->collectAllGarbage();
    198     return jsUndefined();
    199 }
    200 
    201 JSValue JSC_HOST_CALL functionVersion(ExecState*)
     198    return JSValue::encode(jsUndefined());
     199}
     200
     201EncodedJSValue JSC_HOST_CALL functionVersion(ExecState*)
    202202{
    203203    // We need this function for compatibility with the Mozilla JS tests but for now
    204204    // we don't actually do any version-specific handling
    205     return jsUndefined();
    206 }
    207 
    208 JSValue JSC_HOST_CALL functionRun(ExecState* exec)
     205    return JSValue::encode(jsUndefined());
     206}
     207
     208EncodedJSValue JSC_HOST_CALL functionRun(ExecState* exec)
    209209{
    210210    StopWatch stopWatch;
     
    212212    Vector<char> script;
    213213    if (!fillBufferWithContentsOfFile(fileName, script))
    214         return throwError(exec, GeneralError, "Could not open file.");
     214        return JSValue::encode(throwError(exec, GeneralError, "Could not open file."));
    215215
    216216    JSGlobalObject* globalObject = exec->lexicalGlobalObject();
     
    220220    stopWatch.stop();
    221221
    222     return jsNumber(globalObject->globalExec(), stopWatch.getElapsedMS());
    223 }
    224 
    225 JSValue JSC_HOST_CALL functionLoad(ExecState* exec)
     222    return JSValue::encode(jsNumber(globalObject->globalExec(), stopWatch.getElapsedMS()));
     223}
     224
     225EncodedJSValue JSC_HOST_CALL functionLoad(ExecState* exec)
    226226{
    227227    UString fileName = exec->argument(0).toString(exec);
    228228    Vector<char> script;
    229229    if (!fillBufferWithContentsOfFile(fileName, script))
    230         return throwError(exec, GeneralError, "Could not open file.");
     230        return JSValue::encode(throwError(exec, GeneralError, "Could not open file."));
    231231
    232232    JSGlobalObject* globalObject = exec->lexicalGlobalObject();
     
    234234    if (result.complType() == Throw)
    235235        exec->setException(result.value());
    236     return result.value();
    237 }
    238 
    239 JSValue JSC_HOST_CALL functionCheckSyntax(ExecState* exec)
     236    return JSValue::encode(result.value());
     237}
     238
     239EncodedJSValue JSC_HOST_CALL functionCheckSyntax(ExecState* exec)
    240240{
    241241    UString fileName = exec->argument(0).toString(exec);
    242242    Vector<char> script;
    243243    if (!fillBufferWithContentsOfFile(fileName, script))
    244         return throwError(exec, GeneralError, "Could not open file.");
     244        return JSValue::encode(throwError(exec, GeneralError, "Could not open file."));
    245245
    246246    JSGlobalObject* globalObject = exec->lexicalGlobalObject();
     
    248248    if (result.complType() == Throw)
    249249        exec->setException(result.value());
    250     return result.value();
     250    return JSValue::encode(result.value());
    251251}
    252252
    253253#if ENABLE(SAMPLING_FLAGS)
    254 JSValue JSC_HOST_CALL functionSetSamplingFlags(ExecState* exec)
     254EncodedJSValue JSC_HOST_CALL functionSetSamplingFlags(ExecState* exec)
    255255{
    256256    for (unsigned i = 0; i < exec->argumentCount(); ++i) {
     
    259259            SamplingFlags::setFlag(flag);
    260260    }
    261     return jsNull();
    262 }
    263 
    264 JSValue JSC_HOST_CALL functionClearSamplingFlags(ExecState* exec)
     261    return JSValue::encode(jsNull());
     262}
     263
     264EncodedJSValue JSC_HOST_CALL functionClearSamplingFlags(ExecState* exec)
    265265{
    266266    for (unsigned i = 0; i < exec->argumentCount(); ++i) {
     
    269269            SamplingFlags::clearFlag(flag);
    270270    }
    271     return jsNull();
    272 }
    273 #endif
    274 
    275 JSValue JSC_HOST_CALL functionReadline(ExecState* exec)
     271    return JSValue::encode(jsNull());
     272}
     273#endif
     274
     275EncodedJSValue JSC_HOST_CALL functionReadline(ExecState* exec)
    276276{
    277277    Vector<char, 256> line;
     
    284284    }
    285285    line.append('\0');
    286     return jsString(exec, line.data());
    287 }
    288 
    289 JSValue JSC_HOST_CALL functionQuit(ExecState* exec)
     286    return JSValue::encode(jsString(exec, line.data()));
     287}
     288
     289EncodedJSValue JSC_HOST_CALL functionQuit(ExecState* exec)
    290290{
    291291    // Technically, destroying the heap in the middle of JS execution is a no-no,
     
    299299#if COMPILER(MSVC) && OS(WINCE)
    300300    // Without this, Visual Studio will complain that this method does not return a value.
    301     return jsUndefined();
     301    return JSValue::encode(jsUndefined());
    302302#endif
    303303}
Note: See TracChangeset for help on using the changeset viewer.