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/number_object.h

    r28907 r29588  
    2828namespace KJS {
    2929
    30   class NumberInstance : public JSWrapperObject {
    31   public:
    32     NumberInstance(JSObject *proto);
     30    class NumberInstance : public JSWrapperObject {
     31    public:
     32        NumberInstance(JSObject* prototype);
    3333
    34     virtual const ClassInfo *classInfo() const { return &info; }
    35     static const ClassInfo info;
    36   };
     34        virtual const ClassInfo* classInfo() const { return &info; }
     35        static const ClassInfo info;
     36    };
    3737
    38   /**
    39    * @internal
    40    *
    41    * The initial value of Number.prototype (and thus all objects created
    42    * with the Number constructor
    43    */
    44   class NumberPrototype : public NumberInstance {
    45   public:
    46     NumberPrototype(ExecState *exec,
    47                        ObjectPrototype *objProto,
    48                        FunctionPrototype *funcProto);
    49   };
     38    /**
     39     * @internal
     40     *
     41     * The initial value of Number.prototype (and thus all objects created
     42     * with the Number constructor
     43     */
     44    class NumberPrototype : public NumberInstance {
     45    public:
     46        NumberPrototype(ExecState*, ObjectPrototype*, FunctionPrototype*);
     47    };
    5048
    51   /**
    52    * @internal
    53    *
    54    * Class to implement all methods that are properties of the
    55    * Number.prototype object
    56    */
    57   class NumberProtoFunc : public InternalFunctionImp {
    58   public:
    59     NumberProtoFunc(ExecState*, FunctionPrototype*, int i, int len, const Identifier&);
     49    /**
     50     * @internal
     51     *
     52     * The initial value of the the global variable's "Number" property
     53     */
     54    class NumberObjectImp : public InternalFunctionImp {
     55    public:
     56        NumberObjectImp(ExecState*, FunctionPrototype*, NumberPrototype*);
    6057
    61     virtual JSValue *callAsFunction(ExecState *exec, JSObject *thisObj, const List &args);
     58        virtual bool implementsConstruct() const;
     59        virtual JSObject* construct(ExecState*, const List&);
    6260
    63     enum { ToString, ToLocaleString, ValueOf, ToFixed, ToExponential, ToPrecision };
    64   private:
    65     int id;
    66   };
     61        virtual JSValue* callAsFunction(ExecState*, JSObject*, const List&);
    6762
    68   /**
    69    * @internal
    70    *
    71    * The initial value of the the global variable's "Number" property
    72    */
    73   class NumberObjectImp : public InternalFunctionImp {
    74   public:
    75     NumberObjectImp(ExecState *exec,
    76                     FunctionPrototype *funcProto,
    77                     NumberPrototype *numberProto);
     63        bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
     64        JSValue* getValueProperty(ExecState*, int token) const;
    7865
    79     virtual bool implementsConstruct() const;
    80     virtual JSObject *construct(ExecState *exec, const List &args);
     66        virtual const ClassInfo* classInfo() const { return &info; }
     67        static const ClassInfo info;
    8168
    82     virtual JSValue *callAsFunction(ExecState *exec, JSObject *thisObj, const List &args);
     69        enum { NaNValue, NegInfinity, PosInfinity, MaxValue, MinValue };
    8370
    84     bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
    85     JSValue *getValueProperty(ExecState *exec, int token) const;
     71        JSObject* construct(const List&);
     72    };
    8673
    87     virtual const ClassInfo *classInfo() const { return &info; }
    88     static const ClassInfo info;
    89     enum { NaNValue, NegInfinity, PosInfinity, MaxValue, MinValue };
     74} // namespace KJS
    9075
    91     JSObject *construct(const List &);
    92   };
    93 
    94 } // namespace
    95 
    96 #endif
     76#endif // NUMBER_OBJECT_H_
Note: See TracChangeset for help on using the changeset viewer.