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

    r21889 r29588  
    1 // -*- c-basic-offset: 2 -*-
    21/*
    3  *  This file is part of the KDE libraries
    42 *  Copyright (C) 1999-2000 Harri Porten ([email protected])
     3 *  Copyright (C) 2008 Apple Inc. All rights reserved.
    54 *
    65 *  This library is free software; you can redistribute it and/or
     
    2726namespace KJS {
    2827
    29   class FunctionPrototype;
     28    /**
     29     * @internal
     30     *
     31     * The initial value of Object.prototype (and thus all objects created
     32     * with the Object constructor
     33     */
     34    class ObjectPrototype : public JSObject {
     35    public:
     36        ObjectPrototype(ExecState*, FunctionPrototype*);
     37    };
    3038
    31   /**
    32    * @internal
    33    *
    34    * The initial value of Object.prototype (and thus all objects created
    35    * with the Object constructor
    36    */
    37   class ObjectPrototype : public JSObject {
    38   public:
    39     ObjectPrototype(ExecState *exec, FunctionPrototype *funcProto);
    40   };
     39    /**
     40     * @internal
     41     *
     42     * The initial value of the the global variable's "Object" property
     43     */
     44    class ObjectObjectImp : public InternalFunctionImp {
     45    public:
     46        ObjectObjectImp(ExecState*, ObjectPrototype*, FunctionPrototype*);
    4147
    42   /**
    43    * @internal
    44    *
    45    * Class to implement all methods that are properties of the
    46    * Object.prototype object
    47    */
    48   class ObjectProtoFunc : public InternalFunctionImp {
    49   public:
    50     ObjectProtoFunc(ExecState* exec, FunctionPrototype* funcProto, int i, int len, const Identifier&);
     48        virtual bool implementsConstruct() const;
     49        virtual JSObject* construct(ExecState*, const List&);
     50        virtual JSValue* callAsFunction(ExecState*, JSObject*, const List&);
     51    };
    5152
    52     virtual JSValue *callAsFunction(ExecState *, JSObject *, const List &args);
     53} // namespace KJS
    5354
    54     enum { ToString, ToLocaleString, ValueOf, HasOwnProperty, IsPrototypeOf, PropertyIsEnumerable,
    55            DefineGetter, DefineSetter, LookupGetter, LookupSetter };
    56   private:
    57     int id;
    58   };
    59 
    60   /**
    61    * @internal
    62    *
    63    * The initial value of the the global variable's "Object" property
    64    */
    65   class ObjectObjectImp : public InternalFunctionImp {
    66   public:
    67 
    68     ObjectObjectImp(ExecState *exec,
    69                     ObjectPrototype *objProto,
    70                     FunctionPrototype *funcProto);
    71 
    72     virtual bool implementsConstruct() const;
    73     virtual JSObject *construct(ExecState *, const List &args);
    74     virtual JSValue *callAsFunction(ExecState *, JSObject *, const List &args);
    75   };
    76 
    77 } // namespace
    78 
    79 #endif
     55#endif // _OBJECT_OBJECT_H_
Note: See TracChangeset for help on using the changeset viewer.