Changeset 35016 in webkit for trunk/JavaScriptCore/kjs/JSGlobalObjectFunctions.h
- Timestamp:
- Jul 5, 2008, 4:19:36 PM (17 years ago)
- File:
-
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/JSGlobalObjectFunctions.h
r35006 r35016 22 22 */ 23 23 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 32 26 33 27 namespace KJS { 34 28 35 class FunctionBodyNode;36 class FunctionPrototype;37 class JSActivation;38 class JSGlobalObject;29 class ArgList; 30 class ExecState; 31 class JSObject; 32 class JSValue; 39 33 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. 43 36 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 set52 // 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 Functions129 37 JSValue* globalFuncEval(ExecState*, JSObject*, JSValue*, const ArgList&); 130 38 JSValue* globalFuncParseInt(ExecState*, JSObject*, JSValue*, const ArgList&); … … 145 53 double parseIntOverflow(const char*, int length, int radix); 146 54 147 } // namespace 55 } // namespace KJS 148 56 149 #endif 57 #endif // JSGlobalObjectFunctions_h
Note:
See TracChangeset
for help on using the changeset viewer.