Changeset 47288 in webkit


Ignore:
Timestamp:
Aug 14, 2009 11:12:49 AM (15 years ago)
Author:
Darin Adler
Message:

JavaScriptCore: Rename the confusing isObject(<class>) to inherits(<class>).
It still works on non-objects, returning false.

Patch by Darin Adler <Darin Adler> on 2009-08-14
Reviewed by Sam Weinig.

  • runtime/ArrayConstructor.cpp:

(JSC::arrayConstructorIsArray): Removed unneeded isObject call
and updated remaining isObject call to new name, inherits.

  • runtime/JSCell.h: Renamed isObject(<class>) to inherits(<class>)

but more importantly, made it non-virtual (it was already inline)
so it is now as fast as JSObject::inherits was.

  • runtime/JSObject.h: Removed inherits function since the one

in the base class is fine as-is. Also made various JSCell functions
that should not be called on JSObject uncallable by making them
both private and not implemented.
(JSC::JSCell::inherits): Updated name.
(JSC::JSValue::inherits): Ditto.

  • debugger/Debugger.cpp:

(JSC::Debugger::recompileAllJSFunctions):

  • interpreter/Interpreter.cpp:

(JSC::Interpreter::unwindCallFrame):

  • runtime/ArrayPrototype.cpp:

(JSC::arrayProtoFuncToString):
(JSC::arrayProtoFuncToLocaleString):
(JSC::arrayProtoFuncConcat):

  • runtime/BooleanPrototype.cpp:

(JSC::booleanProtoFuncToString):
(JSC::booleanProtoFuncValueOf):

  • runtime/DateConstructor.cpp:

(JSC::constructDate):

  • 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::setNewValueFromTimeArgs):
(JSC::setNewValueFromDateArgs):
(JSC::dateProtoFuncSetYear):
(JSC::dateProtoFuncGetYear):

  • runtime/FunctionPrototype.cpp:

(JSC::functionProtoFuncToString):

  • runtime/JSActivation.cpp:

(JSC::JSActivation::argumentsGetter):

  • runtime/JSValue.h:
  • runtime/RegExpConstructor.cpp:

(JSC::constructRegExp):

  • runtime/RegExpPrototype.cpp:

(JSC::regExpProtoFuncTest):
(JSC::regExpProtoFuncExec):
(JSC::regExpProtoFuncCompile):
(JSC::regExpProtoFuncToString):

  • runtime/ScopeChain.cpp:

(JSC::ScopeChain::localDepth):

  • runtime/StringPrototype.cpp:

(JSC::stringProtoFuncReplace):
(JSC::stringProtoFuncToString):
(JSC::stringProtoFuncMatch):
(JSC::stringProtoFuncSearch):
(JSC::stringProtoFuncSplit):
Updated to new name, inherits, from old name, isObject.

WebCore: Rename the confusing isObject(<class>) to inherits(<class>).
It still works on non-objects, returning false.

Patch by Darin Adler <Darin Adler> on 2009-08-14
Reviewed by Sam Weinig.

  • bindings/js/JSEventTarget.cpp:

(WebCore::toEventTarget):

  • bindings/js/JSGeolocationCustom.cpp:

(WebCore::createPositionCallback):
(WebCore::createPositionErrorCallback):

  • bindings/js/JSNodeFilterCustom.cpp:

(WebCore::toNodeFilter):

  • bindings/js/JSXMLHttpRequestCustom.cpp:

(WebCore::JSXMLHttpRequest::send):

  • bindings/js/JSXSLTProcessorCustom.cpp:

(WebCore::JSXSLTProcessor::importStylesheet):
(WebCore::JSXSLTProcessor::transformToFragment):
(WebCore::JSXSLTProcessor::transformToDocument):

  • bindings/scripts/CodeGeneratorJS.pm:
  • bridge/objc/objc_runtime.mm:

(JSC::Bindings::callObjCFallbackObject):

  • bridge/runtime_method.cpp:

(JSC::callRuntimeMethod):
Updated to new name, inherits, from old name, isObject.

Location:
trunk
Files:
26 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r47284 r47288  
     12009-08-14  Darin Adler  <darin@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        Rename the confusing isObject(<class>) to inherits(<class>).
     6        It still works on non-objects, returning false.
     7
     8        * runtime/ArrayConstructor.cpp:
     9        (JSC::arrayConstructorIsArray): Removed unneeded isObject call
     10        and updated remaining isObject call to new name, inherits.
     11
     12        * runtime/JSCell.h: Renamed isObject(<class>) to inherits(<class>)
     13        but more importantly, made it non-virtual (it was already inline)
     14        so it is now as fast as JSObject::inherits was.
     15
     16        * runtime/JSObject.h: Removed inherits function since the one
     17        in the base class is fine as-is. Also made various JSCell functions
     18        that should not be called on JSObject uncallable by making them
     19        both private and not implemented.
     20        (JSC::JSCell::inherits): Updated name.
     21        (JSC::JSValue::inherits): Ditto.
     22
     23        * debugger/Debugger.cpp:
     24        (JSC::Debugger::recompileAllJSFunctions):
     25        * interpreter/Interpreter.cpp:
     26        (JSC::Interpreter::unwindCallFrame):
     27        * runtime/ArrayPrototype.cpp:
     28        (JSC::arrayProtoFuncToString):
     29        (JSC::arrayProtoFuncToLocaleString):
     30        (JSC::arrayProtoFuncConcat):
     31        * runtime/BooleanPrototype.cpp:
     32        (JSC::booleanProtoFuncToString):
     33        (JSC::booleanProtoFuncValueOf):
     34        * runtime/DateConstructor.cpp:
     35        (JSC::constructDate):
     36        * runtime/DatePrototype.cpp:
     37        (JSC::dateProtoFuncToString):
     38        (JSC::dateProtoFuncToUTCString):
     39        (JSC::dateProtoFuncToISOString):
     40        (JSC::dateProtoFuncToDateString):
     41        (JSC::dateProtoFuncToTimeString):
     42        (JSC::dateProtoFuncToLocaleString):
     43        (JSC::dateProtoFuncToLocaleDateString):
     44        (JSC::dateProtoFuncToLocaleTimeString):
     45        (JSC::dateProtoFuncGetTime):
     46        (JSC::dateProtoFuncGetFullYear):
     47        (JSC::dateProtoFuncGetUTCFullYear):
     48        (JSC::dateProtoFuncToGMTString):
     49        (JSC::dateProtoFuncGetMonth):
     50        (JSC::dateProtoFuncGetUTCMonth):
     51        (JSC::dateProtoFuncGetDate):
     52        (JSC::dateProtoFuncGetUTCDate):
     53        (JSC::dateProtoFuncGetDay):
     54        (JSC::dateProtoFuncGetUTCDay):
     55        (JSC::dateProtoFuncGetHours):
     56        (JSC::dateProtoFuncGetUTCHours):
     57        (JSC::dateProtoFuncGetMinutes):
     58        (JSC::dateProtoFuncGetUTCMinutes):
     59        (JSC::dateProtoFuncGetSeconds):
     60        (JSC::dateProtoFuncGetUTCSeconds):
     61        (JSC::dateProtoFuncGetMilliSeconds):
     62        (JSC::dateProtoFuncGetUTCMilliseconds):
     63        (JSC::dateProtoFuncGetTimezoneOffset):
     64        (JSC::dateProtoFuncSetTime):
     65        (JSC::setNewValueFromTimeArgs):
     66        (JSC::setNewValueFromDateArgs):
     67        (JSC::dateProtoFuncSetYear):
     68        (JSC::dateProtoFuncGetYear):
     69        * runtime/FunctionPrototype.cpp:
     70        (JSC::functionProtoFuncToString):
     71        * runtime/JSActivation.cpp:
     72        (JSC::JSActivation::argumentsGetter):
     73        * runtime/JSValue.h:
     74        * runtime/RegExpConstructor.cpp:
     75        (JSC::constructRegExp):
     76        * runtime/RegExpPrototype.cpp:
     77        (JSC::regExpProtoFuncTest):
     78        (JSC::regExpProtoFuncExec):
     79        (JSC::regExpProtoFuncCompile):
     80        (JSC::regExpProtoFuncToString):
     81        * runtime/ScopeChain.cpp:
     82        (JSC::ScopeChain::localDepth):
     83        * runtime/StringPrototype.cpp:
     84        (JSC::stringProtoFuncReplace):
     85        (JSC::stringProtoFuncToString):
     86        (JSC::stringProtoFuncMatch):
     87        (JSC::stringProtoFuncSearch):
     88        (JSC::stringProtoFuncSplit):
     89        Updated to new name, inherits, from old name, isObject.
     90
    1912009-07-31  Harald Fernengel  <harald.fernengel@nokia.com>
    292
  • trunk/JavaScriptCore/debugger/Debugger.cpp

    r47239 r47288  
    6565    Heap::iterator heapEnd = globalData->heap.primaryHeapEnd();
    6666    for (Heap::iterator it = globalData->heap.primaryHeapBegin(); it != heapEnd; ++it) {
    67         if ((*it)->isObject(&JSFunction::info)) {
     67        if ((*it)->inherits(&JSFunction::info)) {
    6868            JSFunction* function = asFunction(*it);
    6969            if (!function->body()->isHostFunction())
  • trunk/JavaScriptCore/interpreter/Interpreter.cpp

    r47183 r47288  
    505505    // If this call frame created an activation or an 'arguments' object, tear it off.
    506506    if (oldCodeBlock->codeType() == FunctionCode && oldCodeBlock->needsFullScopeChain()) {
    507         while (!scopeChain->object->isObject(&JSActivation::info))
     507        while (!scopeChain->object->inherits(&JSActivation::info))
    508508            scopeChain = scopeChain->pop();
    509509        static_cast<JSActivation*>(scopeChain->object)->copyRegisters(callFrame->optionalCalleeArguments());
  • trunk/JavaScriptCore/runtime/ArrayConstructor.cpp

    r47276 r47288  
    9292JSValue JSC_HOST_CALL arrayConstructorIsArray(ExecState*, JSObject*, JSValue, const ArgList& args)
    9393{
    94     if (!args.at(0).isObject())
    95         return jsBoolean(false);
    96     return jsBoolean(asObject(args.at(0))->isObject(&JSArray::info));
     94    return jsBoolean(args.at(0).inherits(&JSArray::info));
    9795}
    9896
  • trunk/JavaScriptCore/runtime/ArrayPrototype.cpp

    r44286 r47288  
    145145JSValue JSC_HOST_CALL arrayProtoFuncToString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
    146146{
    147     if (!thisValue.isObject(&JSArray::info))
     147    if (!thisValue.inherits(&JSArray::info))
    148148        return throwError(exec, TypeError);
    149149    JSObject* thisObj = asArray(thisValue);
     
    191191JSValue JSC_HOST_CALL arrayProtoFuncToLocaleString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
    192192{
    193     if (!thisValue.isObject(&JSArray::info))
     193    if (!thisValue.inherits(&JSArray::info))
    194194        return throwError(exec, TypeError);
    195195    JSObject* thisObj = asArray(thisValue);
     
    299299    ArgList::const_iterator end = args.end();
    300300    while (1) {
    301         if (curArg.isObject(&JSArray::info)) {
     301        if (curArg.inherits(&JSArray::info)) {
    302302            unsigned length = curArg.get(exec, exec->propertyNames().length).toUInt32(exec);
    303303            JSObject* curObject = curArg.toObject(exec);
  • trunk/JavaScriptCore/runtime/BooleanPrototype.cpp

    r43372 r47288  
    6060        return jsNontrivialString(exec, "true");
    6161
    62     if (!thisValue.isObject(&BooleanObject::info))
     62    if (!thisValue.inherits(&BooleanObject::info))
    6363        return throwError(exec, TypeError);
    6464
     
    7575        return thisValue;
    7676
    77     if (!thisValue.isObject(&BooleanObject::info))
     77    if (!thisValue.inherits(&BooleanObject::info))
    7878        return throwError(exec, TypeError);
    7979
  • trunk/JavaScriptCore/runtime/DateConstructor.cpp

    r46992 r47288  
    8080        value = getCurrentUTCTime();
    8181    else if (numArgs == 1) {
    82         if (args.at(0).isObject(&DateInstance::info))
     82        if (args.at(0).inherits(&DateInstance::info))
    8383            value = asDateInstance(args.at(0))->internalNumber();
    8484        else {
  • trunk/JavaScriptCore/runtime/DatePrototype.cpp

    r44931 r47288  
    412412JSValue JSC_HOST_CALL dateProtoFuncToString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
    413413{
    414     if (!thisValue.isObject(&DateInstance::info))
     414    if (!thisValue.inherits(&DateInstance::info))
    415415        return throwError(exec, TypeError);
    416416
     
    429429JSValue JSC_HOST_CALL dateProtoFuncToUTCString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
    430430{
    431     if (!thisValue.isObject(&DateInstance::info))
     431    if (!thisValue.inherits(&DateInstance::info))
    432432        return throwError(exec, TypeError);
    433433
     
    446446JSValue JSC_HOST_CALL dateProtoFuncToISOString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
    447447{
    448     if (!thisValue.isObject(&DateInstance::info))
     448    if (!thisValue.inherits(&DateInstance::info))
    449449        return throwError(exec, TypeError);
    450450   
     
    468468JSValue JSC_HOST_CALL dateProtoFuncToDateString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
    469469{
    470     if (!thisValue.isObject(&DateInstance::info))
     470    if (!thisValue.inherits(&DateInstance::info))
    471471        return throwError(exec, TypeError);
    472472
     
    485485JSValue JSC_HOST_CALL dateProtoFuncToTimeString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
    486486{
    487     if (!thisValue.isObject(&DateInstance::info))
     487    if (!thisValue.inherits(&DateInstance::info))
    488488        return throwError(exec, TypeError);
    489489
     
    502502JSValue JSC_HOST_CALL dateProtoFuncToLocaleString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
    503503{
    504     if (!thisValue.isObject(&DateInstance::info))
     504    if (!thisValue.inherits(&DateInstance::info))
    505505        return throwError(exec, TypeError);
    506506
     
    515515JSValue JSC_HOST_CALL dateProtoFuncToLocaleDateString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
    516516{
    517     if (!thisValue.isObject(&DateInstance::info))
     517    if (!thisValue.inherits(&DateInstance::info))
    518518        return throwError(exec, TypeError);
    519519
     
    528528JSValue JSC_HOST_CALL dateProtoFuncToLocaleTimeString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
    529529{
    530     if (!thisValue.isObject(&DateInstance::info))
     530    if (!thisValue.inherits(&DateInstance::info))
    531531        return throwError(exec, TypeError);
    532532
     
    541541JSValue JSC_HOST_CALL dateProtoFuncGetTime(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
    542542{
    543     if (!thisValue.isObject(&DateInstance::info))
     543    if (!thisValue.inherits(&DateInstance::info))
    544544        return throwError(exec, TypeError);
    545545
     
    554554JSValue JSC_HOST_CALL dateProtoFuncGetFullYear(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
    555555{
    556     if (!thisValue.isObject(&DateInstance::info))
     556    if (!thisValue.inherits(&DateInstance::info))
    557557        return throwError(exec, TypeError);
    558558
     
    571571JSValue JSC_HOST_CALL dateProtoFuncGetUTCFullYear(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
    572572{
    573     if (!thisValue.isObject(&DateInstance::info))
     573    if (!thisValue.inherits(&DateInstance::info))
    574574        return throwError(exec, TypeError);
    575575
     
    588588JSValue JSC_HOST_CALL dateProtoFuncToGMTString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
    589589{
    590     if (!thisValue.isObject(&DateInstance::info))
     590    if (!thisValue.inherits(&DateInstance::info))
    591591        return throwError(exec, TypeError);
    592592
     
    605605JSValue JSC_HOST_CALL dateProtoFuncGetMonth(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
    606606{
    607     if (!thisValue.isObject(&DateInstance::info))
     607    if (!thisValue.inherits(&DateInstance::info))
    608608        return throwError(exec, TypeError);
    609609
     
    622622JSValue JSC_HOST_CALL dateProtoFuncGetUTCMonth(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
    623623{
    624     if (!thisValue.isObject(&DateInstance::info))
     624    if (!thisValue.inherits(&DateInstance::info))
    625625        return throwError(exec, TypeError);
    626626
     
    639639JSValue JSC_HOST_CALL dateProtoFuncGetDate(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
    640640{
    641     if (!thisValue.isObject(&DateInstance::info))
     641    if (!thisValue.inherits(&DateInstance::info))
    642642        return throwError(exec, TypeError);
    643643
     
    656656JSValue JSC_HOST_CALL dateProtoFuncGetUTCDate(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
    657657{
    658     if (!thisValue.isObject(&DateInstance::info))
     658    if (!thisValue.inherits(&DateInstance::info))
    659659        return throwError(exec, TypeError);
    660660
     
    673673JSValue JSC_HOST_CALL dateProtoFuncGetDay(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
    674674{
    675     if (!thisValue.isObject(&DateInstance::info))
     675    if (!thisValue.inherits(&DateInstance::info))
    676676        return throwError(exec, TypeError);
    677677
     
    690690JSValue JSC_HOST_CALL dateProtoFuncGetUTCDay(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
    691691{
    692     if (!thisValue.isObject(&DateInstance::info))
     692    if (!thisValue.inherits(&DateInstance::info))
    693693        return throwError(exec, TypeError);
    694694
     
    707707JSValue JSC_HOST_CALL dateProtoFuncGetHours(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
    708708{
    709     if (!thisValue.isObject(&DateInstance::info))
     709    if (!thisValue.inherits(&DateInstance::info))
    710710        return throwError(exec, TypeError);
    711711
     
    724724JSValue JSC_HOST_CALL dateProtoFuncGetUTCHours(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
    725725{
    726     if (!thisValue.isObject(&DateInstance::info))
     726    if (!thisValue.inherits(&DateInstance::info))
    727727        return throwError(exec, TypeError);
    728728
     
    741741JSValue JSC_HOST_CALL dateProtoFuncGetMinutes(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
    742742{
    743     if (!thisValue.isObject(&DateInstance::info))
     743    if (!thisValue.inherits(&DateInstance::info))
    744744        return throwError(exec, TypeError);
    745745
     
    758758JSValue JSC_HOST_CALL dateProtoFuncGetUTCMinutes(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
    759759{
    760     if (!thisValue.isObject(&DateInstance::info))
     760    if (!thisValue.inherits(&DateInstance::info))
    761761        return throwError(exec, TypeError);
    762762
     
    775775JSValue JSC_HOST_CALL dateProtoFuncGetSeconds(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
    776776{
    777     if (!thisValue.isObject(&DateInstance::info))
     777    if (!thisValue.inherits(&DateInstance::info))
    778778        return throwError(exec, TypeError);
    779779
     
    792792JSValue JSC_HOST_CALL dateProtoFuncGetUTCSeconds(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
    793793{
    794     if (!thisValue.isObject(&DateInstance::info))
     794    if (!thisValue.inherits(&DateInstance::info))
    795795        return throwError(exec, TypeError);
    796796
     
    809809JSValue JSC_HOST_CALL dateProtoFuncGetMilliSeconds(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
    810810{
    811     if (!thisValue.isObject(&DateInstance::info))
     811    if (!thisValue.inherits(&DateInstance::info))
    812812        return throwError(exec, TypeError);
    813813
     
    824824JSValue JSC_HOST_CALL dateProtoFuncGetUTCMilliseconds(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
    825825{
    826     if (!thisValue.isObject(&DateInstance::info))
     826    if (!thisValue.inherits(&DateInstance::info))
    827827        return throwError(exec, TypeError);
    828828
     
    839839JSValue JSC_HOST_CALL dateProtoFuncGetTimezoneOffset(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
    840840{
    841     if (!thisValue.isObject(&DateInstance::info))
     841    if (!thisValue.inherits(&DateInstance::info))
    842842        return throwError(exec, TypeError);
    843843
     
    856856JSValue JSC_HOST_CALL dateProtoFuncSetTime(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
    857857{
    858     if (!thisValue.isObject(&DateInstance::info))
     858    if (!thisValue.inherits(&DateInstance::info))
    859859        return throwError(exec, TypeError);
    860860
     
    869869static JSValue setNewValueFromTimeArgs(ExecState* exec, JSValue thisValue, const ArgList& args, int numArgsToUse, bool inputIsUTC)
    870870{
    871     if (!thisValue.isObject(&DateInstance::info))
     871    if (!thisValue.inherits(&DateInstance::info))
    872872        return throwError(exec, TypeError);
    873873
     
    900900static JSValue setNewValueFromDateArgs(ExecState* exec, JSValue thisValue, const ArgList& args, int numArgsToUse, bool inputIsUTC)
    901901{
    902     if (!thisValue.isObject(&DateInstance::info))
     902    if (!thisValue.inherits(&DateInstance::info))
    903903        return throwError(exec, TypeError);
    904904
     
    10211021JSValue JSC_HOST_CALL dateProtoFuncSetYear(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
    10221022{
    1023     if (!thisValue.isObject(&DateInstance::info))
     1023    if (!thisValue.inherits(&DateInstance::info))
    10241024        return throwError(exec, TypeError);
    10251025
     
    10631063JSValue JSC_HOST_CALL dateProtoFuncGetYear(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
    10641064{
    1065     if (!thisValue.isObject(&DateInstance::info))
     1065    if (!thisValue.inherits(&DateInstance::info))
    10661066        return throwError(exec, TypeError);
    10671067
  • trunk/JavaScriptCore/runtime/FunctionPrototype.cpp

    r47236 r47288  
    8585JSValue JSC_HOST_CALL functionProtoFuncToString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
    8686{
    87     if (thisValue.isObject(&JSFunction::info)) {
     87    if (thisValue.inherits(&JSFunction::info)) {
    8888        JSFunction* function = asFunction(thisValue);
    8989        FunctionBodyNode* body = function->body();
     
    9595    }
    9696
    97     if (thisValue.isObject(&InternalFunction::info)) {
     97    if (thisValue.inherits(&InternalFunction::info)) {
    9898        InternalFunction* function = asInternalFunction(thisValue);
    9999        return jsString(exec, "function " + function->name(&exec->globalData()) + "() {\n    [native code]\n}");
  • trunk/JavaScriptCore/runtime/JSActivation.cpp

    r47022 r47288  
    157157        callFrame->setCalleeArguments(arguments);
    158158    }
    159     ASSERT(arguments->isObject(&Arguments::info));
     159    ASSERT(arguments->inherits(&Arguments::info));
    160160
    161161    return arguments;
  • trunk/JavaScriptCore/runtime/JSCell.h

    r47267 r47288  
    5656        bool isObject() const;
    5757        virtual bool isGetterSetter() const;
    58         virtual bool isObject(const ClassInfo*) const;
     58        bool inherits(const ClassInfo*) const;
    5959        virtual bool isAPIValueWrapper() const { return false; }
    6060
  • trunk/JavaScriptCore/runtime/JSObject.h

    r47267 r47288  
    8383        virtual ~JSObject();
    8484
    85         bool inherits(const ClassInfo* classInfo) const { return JSCell::isObject(classInfo); }
    86 
    8785        JSValue prototype() const;
    8886        void setPrototype(JSValue prototype);
     
    209207
    210208    private:
     209        // Nobody should ever ask any of these questions on something already known to be a JSObject.
     210        using JSCell::isAPIValueWrapper;
     211        using JSCell::isGetterSetter;
     212        using JSCell::toObject;
     213        void getObject();
     214        void getString();
     215        void isObject();
     216        void isString();
     217#if USE(JSVALUE32)
     218        void isNumber();
     219#endif
     220
    211221        ConstPropertyStorage propertyStorage() const { return (isUsingInlineStorage() ? m_inlineStorage : m_externalStorage); }
    212222        PropertyStorage propertyStorage() { return (isUsingInlineStorage() ? m_inlineStorage : m_externalStorage); }
     
    297307}
    298308
    299 inline bool JSCell::isObject(const ClassInfo* info) const
     309inline bool JSCell::inherits(const ClassInfo* info) const
    300310{
    301311    for (const ClassInfo* ci = classInfo(); ci; ci = ci->parentClass) {
     
    306316}
    307317
    308 // this method is here to be after the inline declaration of JSCell::isObject
    309 inline bool JSValue::isObject(const ClassInfo* classInfo) const
    310 {
    311     return isCell() && asCell()->isObject(classInfo);
     318// this method is here to be after the inline declaration of JSCell::inherits
     319inline bool JSValue::inherits(const ClassInfo* classInfo) const
     320{
     321    return isCell() && asCell()->inherits(classInfo);
    312322}
    313323
  • trunk/JavaScriptCore/runtime/JSValue.h

    r47022 r47288  
    131131        bool isGetterSetter() const;
    132132        bool isObject() const;
    133         bool isObject(const ClassInfo*) const;
     133        bool inherits(const ClassInfo*) const;
    134134       
    135135        // Extracting the value.
  • trunk/JavaScriptCore/runtime/RegExpConstructor.cpp

    r47239 r47288  
    331331    JSValue arg1 = args.at(1);
    332332
    333     if (arg0.isObject(&RegExpObject::info)) {
     333    if (arg0.inherits(&RegExpObject::info)) {
    334334        if (!arg1.isUndefined())
    335335            return throwError(exec, TypeError, "Cannot supply flags when constructing one RegExp from another.");
  • trunk/JavaScriptCore/runtime/RegExpPrototype.cpp

    r47239 r47288  
    6060JSValue JSC_HOST_CALL regExpProtoFuncTest(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
    6161{
    62     if (!thisValue.isObject(&RegExpObject::info))
     62    if (!thisValue.inherits(&RegExpObject::info))
    6363        return throwError(exec, TypeError);
    6464    return asRegExpObject(thisValue)->test(exec, args);
     
    6767JSValue JSC_HOST_CALL regExpProtoFuncExec(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
    6868{
    69     if (!thisValue.isObject(&RegExpObject::info))
     69    if (!thisValue.inherits(&RegExpObject::info))
    7070        return throwError(exec, TypeError);
    7171    return asRegExpObject(thisValue)->exec(exec, args);
     
    7474JSValue JSC_HOST_CALL regExpProtoFuncCompile(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
    7575{
    76     if (!thisValue.isObject(&RegExpObject::info))
     76    if (!thisValue.inherits(&RegExpObject::info))
    7777        return throwError(exec, TypeError);
    7878
     
    8181    JSValue arg1 = args.at(1);
    8282   
    83     if (arg0.isObject(&RegExpObject::info)) {
     83    if (arg0.inherits(&RegExpObject::info)) {
    8484        if (!arg1.isUndefined())
    8585            return throwError(exec, TypeError, "Cannot supply flags when constructing one RegExp from another.");
     
    101101JSValue JSC_HOST_CALL regExpProtoFuncToString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&)
    102102{
    103     if (!thisValue.isObject(&RegExpObject::info)) {
    104         if (thisValue.isObject(&RegExpPrototype::info))
     103    if (!thisValue.inherits(&RegExpObject::info)) {
     104        if (thisValue.inherits(&RegExpPrototype::info))
    105105            return jsNontrivialString(exec, "//");
    106106        return throwError(exec, TypeError);
  • trunk/JavaScriptCore/runtime/ScopeChain.cpp

    r44224 r47288  
    5757    ScopeChainIterator iter = this->begin();
    5858    ScopeChainIterator end = this->end();
    59     while (!(*iter)->isObject(&JSActivation::info)) {
     59    while (!(*iter)->inherits(&JSActivation::info)) {
    6060        ++iter;
    6161        if (iter == end)
  • trunk/JavaScriptCore/runtime/StringPrototype.cpp

    r47239 r47288  
    222222        replacementString = replacement.toString(exec);
    223223
    224     if (pattern.isObject(&RegExpObject::info)) {
     224    if (pattern.inherits(&RegExpObject::info)) {
    225225        RegExp* reg = asRegExpObject(pattern)->regExp();
    226226        bool global = reg->global();
     
    367367        return thisValue;
    368368
    369     if (thisValue.isObject(&StringObject::info))
     369    if (thisValue.inherits(&StringObject::info))
    370370        return asStringObject(thisValue)->internalValue();
    371371
     
    468468    RefPtr<RegExp> reg;
    469469    RegExpObject* imp = 0;
    470     if (a0.isObject(&RegExpObject::info))
     470    if (a0.inherits(&RegExpObject::info))
    471471        reg = asRegExpObject(a0)->regExp();
    472472    else {
     
    518518    UString u = s;
    519519    RefPtr<RegExp> reg;
    520     if (a0.isObject(&RegExpObject::info))
     520    if (a0.inherits(&RegExpObject::info))
    521521        reg = asRegExpObject(a0)->regExp();
    522522    else {
     
    570570    int p0 = 0;
    571571    unsigned limit = a1.isUndefined() ? 0xFFFFFFFFU : a1.toUInt32(exec);
    572     if (a0.isObject(&RegExpObject::info)) {
     572    if (a0.inherits(&RegExpObject::info)) {
    573573        RegExp* reg = asRegExpObject(a0)->regExp();
    574574        if (s.isEmpty() && reg->match(s, 0) >= 0) {
  • trunk/WebCore/ChangeLog

    r47282 r47288  
     12009-08-14  Darin Adler  <darin@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        Rename the confusing isObject(<class>) to inherits(<class>).
     6        It still works on non-objects, returning false.
     7
     8        * bindings/js/JSEventTarget.cpp:
     9        (WebCore::toEventTarget):
     10        * bindings/js/JSGeolocationCustom.cpp:
     11        (WebCore::createPositionCallback):
     12        (WebCore::createPositionErrorCallback):
     13        * bindings/js/JSNodeFilterCustom.cpp:
     14        (WebCore::toNodeFilter):
     15        * bindings/js/JSXMLHttpRequestCustom.cpp:
     16        (WebCore::JSXMLHttpRequest::send):
     17        * bindings/js/JSXSLTProcessorCustom.cpp:
     18        (WebCore::JSXSLTProcessor::importStylesheet):
     19        (WebCore::JSXSLTProcessor::transformToFragment):
     20        (WebCore::JSXSLTProcessor::transformToDocument):
     21        * bindings/scripts/CodeGeneratorJS.pm:
     22        * bridge/objc/objc_runtime.mm:
     23        (JSC::Bindings::callObjCFallbackObject):
     24        * bridge/runtime_method.cpp:
     25        (JSC::callRuntimeMethod):
     26        Updated to new name, inherits, from old name, isObject.
     27
    1282009-08-14  Yael Aharon  <yael.aharon@nokia.com>
    229
  • trunk/WebCore/bindings/js/JSEventTarget.cpp

    r47056 r47288  
    129129{
    130130    #define CONVERT_TO_EVENT_TARGET(type) \
    131         if (value.isObject(&JS##type::s_info)) \
     131        if (value.inherits(&JS##type::s_info)) \
    132132            return static_cast<JS##type*>(asObject(value))->impl();
    133133
     
    137137    CONVERT_TO_EVENT_TARGET(MessagePort)
    138138
    139     if (value.isObject(&JSDOMWindowShell::s_info))
     139    if (value.inherits(&JSDOMWindowShell::s_info))
    140140        return static_cast<JSDOMWindowShell*>(asObject(value))->impl();
    141141
  • trunk/WebCore/bindings/js/JSGeolocationCustom.cpp

    r47252 r47288  
    4545{
    4646    // The spec specifies 'FunctionOnly' for this object.
    47     if (!value.isObject(&InternalFunction::info)) {
     47    if (!value.inherits(&InternalFunction::info)) {
    4848        setDOMException(exec, TYPE_MISMATCH_ERR);
    4949        return 0;
     
    6262
    6363    // The spec specifies 'FunctionOnly' for this object.
    64     if (!value.isObject(&InternalFunction::info)) {
     64    if (!value.inherits(&InternalFunction::info)) {
    6565        setDOMException(exec, TYPE_MISMATCH_ERR);
    6666        return 0;
  • trunk/WebCore/bindings/js/JSNodeFilterCustom.cpp

    r47022 r47288  
    4949PassRefPtr<NodeFilter> toNodeFilter(JSValue value)
    5050{
    51     if (value.isObject(&JSNodeFilter::s_info))
     51    if (value.inherits(&JSNodeFilter::s_info))
    5252        return static_cast<JSNodeFilter*>(asObject(value))->impl();
    5353
  • trunk/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp

    r47022 r47288  
    124124        if (val.isUndefinedOrNull())
    125125            impl()->send(ec);
    126         else if (val.isObject(&JSDocument::s_info))
     126        else if (val.inherits(&JSDocument::s_info))
    127127            impl()->send(toDocument(val), ec);
    128         else if (val.isObject(&JSFile::s_info))
     128        else if (val.inherits(&JSFile::s_info))
    129129            impl()->send(toFile(val), ec);
    130130        else
  • trunk/WebCore/bindings/js/JSXSLTProcessorCustom.cpp

    r43122 r47288  
    5050{
    5151    JSValue nodeVal = args.at(0);
    52     if (nodeVal.isObject(&JSNode::s_info)) {
     52    if (nodeVal.inherits(&JSNode::s_info)) {
    5353        JSNode* node = static_cast<JSNode*>(asObject(nodeVal));
    5454        impl()->importStylesheet(node->impl());
     
    6363    JSValue nodeVal = args.at(0);
    6464    JSValue docVal = args.at(1);
    65     if (nodeVal.isObject(&JSNode::s_info) && docVal.isObject(&JSDocument::s_info)) {
     65    if (nodeVal.inherits(&JSNode::s_info) && docVal.inherits(&JSDocument::s_info)) {
    6666        WebCore::Node* node = static_cast<JSNode*>(asObject(nodeVal))->impl();
    6767        Document* doc = static_cast<Document*>(static_cast<JSDocument*>(asObject(docVal))->impl());
     
    7575{
    7676    JSValue nodeVal = args.at(0);
    77     if (nodeVal.isObject(&JSNode::s_info)) {
     77    if (nodeVal.inherits(&JSNode::s_info)) {
    7878        JSNode* node = static_cast<JSNode*>(asObject(nodeVal));
    7979        RefPtr<Document> resultDocument = impl()->transformToDocument(node->impl());
  • trunk/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r47267 r47288  
    13801380                push(@implContent, "        return throwError(exec, TypeError);\n");
    13811381            } else {
    1382                 push(@implContent, "    if (!thisValue.isObject(&${className}::s_info))\n");
     1382                push(@implContent, "    if (!thisValue.inherits(&${className}::s_info))\n");
    13831383                push(@implContent, "        return throwError(exec, TypeError);\n");
    13841384                push(@implContent, "    $className* castedThisObj = static_cast<$className*>(asObject(thisValue));\n");
     
    15441544        push(@implContent, "{\n");
    15451545
    1546         push(@implContent, "    return value.isObject(&${className}::s_info) ? " . ($podType ? "($podType) *" : "") . "static_cast<$className*>(asObject(value))->impl() : ");
     1546        push(@implContent, "    return value.inherits(&${className}::s_info) ? " . ($podType ? "($podType) *" : "") . "static_cast<$className*>(asObject(value))->impl() : ");
    15471547        if ($podType and $podType ne "float") {
    15481548            push(@implContent, "$podType();\n}\n");
  • trunk/WebCore/bridge/objc/objc_runtime.mm

    r46431 r47288  
    210210static JSValue JSC_HOST_CALL callObjCFallbackObject(ExecState* exec, JSObject* function, JSValue thisValue, const ArgList& args)
    211211{
    212     if (!thisValue.isObject(&RuntimeObjectImp::s_info))
     212    if (!thisValue.inherits(&RuntimeObjectImp::s_info))
    213213        return throwError(exec, TypeError);
    214214
  • trunk/WebCore/bridge/runtime_method.cpp

    r45724 r47288  
    8383    RuntimeObjectImp* imp;
    8484
    85     if (thisValue.isObject(&RuntimeObjectImp::s_info)) {
     85    if (thisValue.inherits(&RuntimeObjectImp::s_info)) {
    8686        imp = static_cast<RuntimeObjectImp*>(asObject(thisValue));
    8787    } else {
     
    8989        // runtime object from the DOM object.
    9090        JSValue value = thisValue.get(exec, Identifier(exec, "__apple_runtime_object"));
    91         if (value.isObject(&RuntimeObjectImp::s_info))   
     91        if (value.inherits(&RuntimeObjectImp::s_info))   
    9292            imp = static_cast<RuntimeObjectImp*>(asObject(value));
    9393        else
Note: See TracChangeset for help on using the changeset viewer.