Ignore:
Timestamp:
Jul 5, 2008, 4:19:36 PM (17 years ago)
Author:
[email protected]
Message:

JavaScriptCore:

2008-07-05 Sam Weinig <[email protected]>

Rubber-stamped by Cameron Zwarich.

Split Arguments, IndexToNameMap, PrototypeFunction, GlobalEvalFunction and
the functions on the global object out of JSFunction.h/cpp.

  • GNUmakefile.am:
  • JavaScriptCore.pri:
  • JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
  • JavaScriptCore.xcodeproj/project.pbxproj:
  • JavaScriptCoreSources.bkl:
  • VM/Machine.cpp:
  • kjs/AllInOneFile.cpp:
  • kjs/Arguments.cpp: Copied from JavaScriptCore/kjs/JSFunction.cpp.
  • kjs/Arguments.h: Copied from JavaScriptCore/kjs/JSFunction.h.
  • kjs/GlobalEvalFunction.cpp: Copied from JavaScriptCore/kjs/JSFunction.cpp.
  • kjs/GlobalEvalFunction.h: Copied from JavaScriptCore/kjs/JSFunction.h.
  • kjs/IndexToNameMap.cpp: Copied from JavaScriptCore/kjs/JSFunction.cpp.
  • kjs/IndexToNameMap.h: Copied from JavaScriptCore/kjs/JSFunction.h.
  • kjs/JSActivation.cpp:
  • kjs/JSFunction.cpp:
  • kjs/JSFunction.h:
  • kjs/JSGlobalObject.cpp:
  • kjs/JSGlobalObjectFunctions.cpp: Copied from JavaScriptCore/kjs/JSFunction.cpp.
  • kjs/JSGlobalObjectFunctions.h: Copied from JavaScriptCore/kjs/JSFunction.h. The functions on the global object should be in JSGlobalObject.cpp, but putting them there was a 0.5% regression.
  • kjs/PrototypeFunction.cpp: Copied from JavaScriptCore/kjs/JSFunction.cpp.
  • kjs/PrototypeFunction.h: Copied from JavaScriptCore/kjs/JSFunction.h.
  • kjs/Shell.cpp:
  • kjs/lexer.cpp:
  • kjs/ustring.cpp:

WebCore:

2008-07-05 Sam Weinig <[email protected]>

Rubber-stamped by Cameron Zwarich.

Split Arguments, IndexToNameMap, PrototypeFunction, GlobalEvalFunction and
the functions on the global object out of JSFunction.h/cpp.

  • ForwardingHeaders/kjs/PrototypeFunction.h: Added.
  • bindings/js/JSDOMBinding.cpp:
File:
1 copied

Legend:

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

    r35006 r35016  
    2222 */
    2323
    24 #ifndef JSFunction_h
    25 #define JSFunction_h
    26 
    27 #include "InternalFunction.h"
    28 #include "JSVariableObject.h"
    29 #include "SymbolTable.h"
    30 #include "nodes.h"
    31 #include "JSObject.h"
     24#ifndef JSGlobalObjectFunctions_h
     25#define JSGlobalObjectFunctions_h
    3226
    3327namespace KJS {
    3428
    35   class FunctionBodyNode;
    36   class FunctionPrototype;
    37   class JSActivation;
    38   class JSGlobalObject;
     29    class ArgList;
     30    class ExecState;
     31    class JSObject;
     32    class JSValue;
    3933
    40   class JSFunction : public InternalFunction {
    41   public:
    42     JSFunction(ExecState*, const Identifier&, FunctionBodyNode*, ScopeChainNode*);
     34    // FIXME: These functions should really be in JSGlobalObject.cpp, but putting them there
     35    // is a 0.5% reduction.
    4336
    44     virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
    45     virtual void put(ExecState*, const Identifier& propertyName, JSValue*);
    46     virtual bool deleteProperty(ExecState*, const Identifier& propertyName);
    47 
    48     JSObject* construct(ExecState*, const ArgList&);
    49     JSValue* call(ExecState*, JSValue* thisValue, const ArgList&);
    50 
    51     // Note: Returns a null identifier for any parameters that will never get set
    52     // due to a later parameter with the same name.
    53     const Identifier& getParameterName(int index);
    54 
    55     static const ClassInfo info;
    56 
    57     RefPtr<FunctionBodyNode> body;
    58 
    59     void setScope(const ScopeChain& s) { _scope = s; }
    60     ScopeChain& scope() { return _scope; }
    61 
    62     virtual void mark();
    63 
    64   private:
    65     virtual const ClassInfo* classInfo() const { return &info; }
    66     virtual ConstructType getConstructData(ConstructData&);
    67     virtual CallType getCallData(CallData&);
    68 
    69     ScopeChain _scope;
    70 
    71     static JSValue* argumentsGetter(ExecState*, const Identifier&, const PropertySlot&);
    72     static JSValue* callerGetter(ExecState*, const Identifier&, const PropertySlot&);
    73     static JSValue* lengthGetter(ExecState*, const Identifier&, const PropertySlot&);
    74   };
    75 
    76   class IndexToNameMap {
    77   public:
    78     IndexToNameMap(JSFunction*, const ArgList&);
    79     ~IndexToNameMap();
    80    
    81     Identifier& operator[](const Identifier& index);
    82     bool isMapped(const Identifier& index) const;
    83     void unMap(ExecState* exec, const Identifier& index);
    84    
    85   private:
    86     unsigned size;
    87     Identifier* _map;
    88   };
    89  
    90   class Arguments : public JSObject {
    91   public:
    92     Arguments(ExecState*, JSFunction* func, const ArgList& args, JSActivation* act);
    93     virtual void mark();
    94     virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
    95     virtual void put(ExecState*, const Identifier& propertyName, JSValue*);
    96     virtual bool deleteProperty(ExecState*, const Identifier& propertyName);
    97     virtual const ClassInfo* classInfo() const { return &info; }
    98     static const ClassInfo info;
    99   private:
    100     static JSValue* mappedIndexGetter(ExecState*, const Identifier&, const PropertySlot& slot);
    101 
    102     JSActivation* _activationObject;
    103     mutable IndexToNameMap indexToNameMap;
    104   };
    105 
    106   class PrototypeFunction : public InternalFunction {
    107   public:
    108     PrototypeFunction(ExecState*, int len, const Identifier&, NativeFunction);
    109     PrototypeFunction(ExecState*, FunctionPrototype*, int len, const Identifier&, NativeFunction);
    110 
    111   private:
    112     virtual CallType getCallData(CallData&);
    113 
    114     const NativeFunction m_function;
    115   };
    116 
    117     class GlobalEvalFunction : public PrototypeFunction {
    118     public:
    119         GlobalEvalFunction(ExecState*, FunctionPrototype*, int len, const Identifier&, NativeFunction, JSGlobalObject* expectedThisObject);
    120         JSGlobalObject* cachedGlobalObject() const { return m_cachedGlobalObject; }
    121 
    122     private:
    123         virtual void mark();
    124 
    125         JSGlobalObject* m_cachedGlobalObject;
    126     };
    127 
    128     // Global Functions
    12937    JSValue* globalFuncEval(ExecState*, JSObject*, JSValue*, const ArgList&);
    13038    JSValue* globalFuncParseInt(ExecState*, JSObject*, JSValue*, const ArgList&);
     
    14553    double parseIntOverflow(const char*, int length, int radix);
    14654
    147 } // namespace
     55} // namespace KJS
    14856
    149 #endif
     57#endif // JSGlobalObjectFunctions_h
Note: See TracChangeset for help on using the changeset viewer.