Ignore:
Timestamp:
Aug 14, 2009, 11:12:49 AM (16 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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.