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

    r28110 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
     
    2827namespace KJS {
    2928
    30   class BooleanInstance : public JSWrapperObject {
    31   public:
    32     BooleanInstance(JSObject *proto);
     29    class BooleanInstance : public JSWrapperObject {
     30    public:
     31        BooleanInstance(JSObject* proto);
    3332
    34     virtual const ClassInfo *classInfo() const { return &info; }
    35     static const ClassInfo info;
    36   };
     33        virtual const ClassInfo* classInfo() const { return &info; }
     34        static const ClassInfo info;
     35    };
    3736
    38   /**
    39    * @internal
    40    *
    41    * The initial value of Boolean.prototype (and thus all objects created
    42    * with the Boolean constructor
    43    */
    44   class BooleanPrototype : public BooleanInstance {
    45   public:
    46     BooleanPrototype(ExecState *exec,
    47                         ObjectPrototype *objectProto,
    48                         FunctionPrototype *funcProto);
    49   };
     37    /**
     38     * @internal
     39     *
     40     * The initial value of Boolean.prototype (and thus all objects created
     41     * with the Boolean constructor
     42     */
     43    class BooleanPrototype : public BooleanInstance {
     44    public:
     45        BooleanPrototype(ExecState*, ObjectPrototype*, FunctionPrototype*);
     46    };
    5047
    51   /**
    52    * @internal
    53    *
    54    * Class to implement all methods that are properties of the
    55    * Boolean.prototype object
    56    */
    57   class BooleanProtoFunc : public InternalFunctionImp {
    58   public:
    59     BooleanProtoFunc(ExecState*, FunctionPrototype*, int i, int len, const Identifier&);
     48    /**
     49     * @internal
     50     *
     51     * The initial value of the the global variable's "Boolean" property
     52     */
     53    class BooleanObjectImp : public InternalFunctionImp {
     54    public:
     55        BooleanObjectImp(ExecState*, FunctionPrototype*, BooleanPrototype*);
    6056
    61     virtual JSValue *callAsFunction(ExecState *exec, JSObject *thisObj, const List &args);
     57        virtual bool implementsConstruct() const;
     58        virtual JSObject* construct(ExecState*, const List&);
    6259
    63     enum { ToString, ValueOf };
    64   private:
    65     int id;
    66   };
     60        virtual JSValue* callAsFunction(ExecState*, JSObject*, const List&);
     61    };
    6762
    68   /**
    69    * @internal
    70    *
    71    * The initial value of the the global variable's "Boolean" property
    72    */
    73   class BooleanObjectImp : public InternalFunctionImp {
    74     friend class BooleanProtoFunc;
    75   public:
    76     BooleanObjectImp(ExecState *exec, FunctionPrototype *funcProto,
    77                      BooleanPrototype *booleanProto);
     63} // namespace KJS
    7864
    79     virtual bool implementsConstruct() const;
    80     virtual JSObject *construct(ExecState *exec, const List &args);
    81 
    82     virtual JSValue *callAsFunction(ExecState *exec, JSObject *thisObj, const List &args);
    83   };
    84 
    85 } // namespace
    86 
    87 #endif
     65#endif // BOOL_OBJECT_H_
Note: See TracChangeset for help on using the changeset viewer.