Ignore:
Timestamp:
Jan 17, 2008, 11:27:33 AM (17 years ago)
Author:
[email protected]
Message:

Reviewed by Darin.

Fix for http://bugs.webkit.org/show_bug.cgi?id=16901
Convert remaining JS function objects to use the new PrototypeFunction class

  • Moves Boolean, Function, RegExp, Number, Object and Global functions to their own static function implementations so that they can be used with the PrototypeFunction class. SunSpider says this is 1.003x as fast.
  • kjs/JSGlobalObject.cpp: (KJS::JSGlobalObject::reset):
  • kjs/array_object.h:
  • kjs/bool_object.cpp: (KJS::BooleanInstance::BooleanInstance): (KJS::BooleanPrototype::BooleanPrototype): (KJS::booleanProtoFuncToString): (KJS::booleanProtoFuncValueOf): (KJS::BooleanObjectImp::BooleanObjectImp): (KJS::BooleanObjectImp::implementsConstruct): (KJS::BooleanObjectImp::construct): (KJS::BooleanObjectImp::callAsFunction):
  • kjs/bool_object.h: (KJS::BooleanInstance::classInfo):
  • kjs/error_object.cpp: (KJS::ErrorPrototype::ErrorPrototype): (KJS::errorProtoFuncToString):
  • kjs/error_object.h:
  • kjs/function.cpp: (KJS::globalFuncEval): (KJS::globalFuncParseInt): (KJS::globalFuncParseFloat): (KJS::globalFuncIsNaN): (KJS::globalFuncIsFinite): (KJS::globalFuncDecodeURI): (KJS::globalFuncDecodeURIComponent): (KJS::globalFuncEncodeURI): (KJS::globalFuncEncodeURIComponent): (KJS::globalFuncEscape): (KJS::globalFuncUnEscape): (KJS::globalFuncKJSPrint): (KJS::PrototypeFunction::PrototypeFunction):
  • kjs/function.h:
  • kjs/function_object.cpp: (KJS::FunctionPrototype::FunctionPrototype): (KJS::functionProtoFuncToString): (KJS::functionProtoFuncApply): (KJS::functionProtoFuncCall):
  • kjs/function_object.h:
  • kjs/number_object.cpp: (KJS::NumberPrototype::NumberPrototype): (KJS::numberProtoFuncToString): (KJS::numberProtoFuncToLocaleString): (KJS::numberProtoFuncValueOf): (KJS::numberProtoFuncToFixed): (KJS::numberProtoFuncToExponential): (KJS::numberProtoFuncToPrecision):
  • kjs/number_object.h: (KJS::NumberInstance::classInfo): (KJS::NumberObjectImp::classInfo): (KJS::NumberObjectImp::):
  • kjs/object_object.cpp: (KJS::ObjectPrototype::ObjectPrototype): (KJS::objectProtoFuncValueOf): (KJS::objectProtoFuncHasOwnProperty): (KJS::objectProtoFuncIsPrototypeOf): (KJS::objectProtoFuncDefineGetter): (KJS::objectProtoFuncDefineSetter): (KJS::objectProtoFuncLookupGetter): (KJS::objectProtoFuncLookupSetter): (KJS::objectProtoFuncPropertyIsEnumerable): (KJS::objectProtoFuncToLocaleString): (KJS::objectProtoFuncToString):
  • kjs/object_object.h:
  • kjs/regexp_object.cpp: (KJS::RegExpPrototype::RegExpPrototype): (KJS::regExpProtoFuncTest): (KJS::regExpProtoFuncExec): (KJS::regExpProtoFuncCompile): (KJS::regExpProtoFuncToString):
  • kjs/regexp_object.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/function_object.h

    r21889 r29588  
    2929namespace KJS {
    3030
    31   /**
    32    * @internal
    33    *
    34    * Class to implement all methods that are properties of the
    35    * Function.prototype object
    36    */
    37   class FunctionProtoFunc : public InternalFunctionImp {
    38   public:
    39     FunctionProtoFunc(ExecState*, FunctionPrototype*, int i, int len, const Identifier&);
     31    /**
     32     * @internal
     33     *
     34     * The initial value of Function.prototype (and thus all objects created
     35     * with the Function constructor)
     36     */
     37    class FunctionPrototype : public InternalFunctionImp {
     38    public:
     39        FunctionPrototype(ExecState*);
    4040
    41     virtual JSValue *callAsFunction(ExecState *exec, JSObject *thisObj, const List &args);
     41        virtual JSValue* callAsFunction(ExecState*, JSObject*, const List&);
     42    };
    4243
    43     enum { ToString, Apply, Call };
    44   private:
    45     int id;
    46   };
     44    /**
     45     * @internal
     46     *
     47     * The initial value of the the global variable's "Function" property
     48     */
     49    class FunctionObjectImp : public InternalFunctionImp {
     50    public:
     51        FunctionObjectImp(ExecState*, FunctionPrototype*);
    4752
    48   /**
    49    * @internal
    50    *
    51    * The initial value of the the global variable's "Function" property
    52    */
    53   class FunctionObjectImp : public InternalFunctionImp {
    54   public:
    55     FunctionObjectImp(ExecState*, FunctionPrototype*);
    56     virtual ~FunctionObjectImp();
     53        virtual bool implementsConstruct() const;
     54        virtual JSObject* construct(ExecState*, const List&);
     55        virtual JSObject* construct(ExecState*, const List&, const Identifier& functionName, const UString& sourceURL, int lineNumber);
     56        virtual JSValue* callAsFunction(ExecState*, JSObject*, const List&);
     57    };
    5758
    58     virtual bool implementsConstruct() const;
    59     virtual JSObject* construct(ExecState*, const List& args);
    60     virtual JSObject* construct(ExecState*, const List& args, const Identifier& functionName, const UString& sourceURL, int lineNumber);
    61     virtual JSValue* callAsFunction(ExecState*, JSObject* thisObj, const List& args);
    62   };
    63 
    64 } // namespace
     59} // namespace KJS
    6560
    6661#endif // _FUNCTION_OBJECT_H_
Note: See TracChangeset for help on using the changeset viewer.