Changeset 34901 in webkit for trunk/JavaScriptCore/kjs/InternalFunction.h
- Timestamp:
- Jun 30, 2008, 6:11:22 PM (17 years ago)
- File:
-
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/InternalFunction.h
r34892 r34901 1 // -*- c-basic-offset: 2 -*-2 1 /* 3 2 * Copyright (C) 1999-2000 Harri Porten ([email protected]) … … 23 22 */ 24 23 25 #ifndef JSFunction_h26 #define JSFunction_h24 #ifndef InternalFunction_h 25 #define InternalFunction_h 27 26 28 #include "JSVariableObject.h" 29 #include "SymbolTable.h" 30 #include "nodes.h" 27 #include "identifier.h" 31 28 #include "JSObject.h" 32 29 33 30 namespace KJS { 34 31 35 class FunctionBodyNode;36 32 class FunctionPrototype; 37 class JSActivation;38 class JSGlobalObject;39 33 40 34 class InternalFunction : public JSObject { … … 55 49 }; 56 50 57 class JSFunction : public InternalFunction { 58 public: 59 JSFunction(ExecState*, const Identifier&, FunctionBodyNode*, ScopeChainNode*); 51 } // namespace KJS 60 52 61 virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&); 62 virtual void put(ExecState*, const Identifier& propertyName, JSValue*); 63 virtual bool deleteProperty(ExecState*, const Identifier& propertyName); 64 65 JSObject* construct(ExecState*, const ArgList&); 66 JSValue* call(ExecState*, JSValue* thisValue, const ArgList&); 67 68 // Note: Returns a null identifier for any parameters that will never get set 69 // due to a later parameter with the same name. 70 const Identifier& getParameterName(int index); 71 72 static const ClassInfo info; 73 74 RefPtr<FunctionBodyNode> body; 75 76 void setScope(const ScopeChain& s) { _scope = s; } 77 ScopeChain& scope() { return _scope; } 78 79 virtual void mark(); 80 81 private: 82 virtual const ClassInfo* classInfo() const { return &info; } 83 virtual ConstructType getConstructData(ConstructData&); 84 virtual CallType getCallData(CallData&); 85 86 ScopeChain _scope; 87 88 static JSValue* argumentsGetter(ExecState*, const Identifier&, const PropertySlot&); 89 static JSValue* callerGetter(ExecState*, const Identifier&, const PropertySlot&); 90 static JSValue* lengthGetter(ExecState*, const Identifier&, const PropertySlot&); 91 }; 92 93 class IndexToNameMap { 94 public: 95 IndexToNameMap(JSFunction*, const ArgList&); 96 ~IndexToNameMap(); 97 98 Identifier& operator[](const Identifier& index); 99 bool isMapped(const Identifier& index) const; 100 void unMap(ExecState* exec, const Identifier& index); 101 102 private: 103 unsigned size; 104 Identifier* _map; 105 }; 106 107 class Arguments : public JSObject { 108 public: 109 Arguments(ExecState*, JSFunction* func, const ArgList& args, JSActivation* act); 110 virtual void mark(); 111 virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&); 112 virtual void put(ExecState*, const Identifier& propertyName, JSValue*); 113 virtual bool deleteProperty(ExecState*, const Identifier& propertyName); 114 virtual const ClassInfo* classInfo() const { return &info; } 115 static const ClassInfo info; 116 private: 117 static JSValue* mappedIndexGetter(ExecState*, const Identifier&, const PropertySlot& slot); 118 119 JSActivation* _activationObject; 120 mutable IndexToNameMap indexToNameMap; 121 }; 122 123 class PrototypeFunction : public InternalFunction { 124 public: 125 PrototypeFunction(ExecState*, int len, const Identifier&, NativeFunction); 126 PrototypeFunction(ExecState*, FunctionPrototype*, int len, const Identifier&, NativeFunction); 127 128 private: 129 virtual CallType getCallData(CallData&); 130 131 const NativeFunction m_function; 132 }; 133 134 class GlobalEvalFunction : public PrototypeFunction { 135 public: 136 GlobalEvalFunction(ExecState*, FunctionPrototype*, int len, const Identifier&, NativeFunction, JSGlobalObject* expectedThisObject); 137 JSGlobalObject* cachedGlobalObject() const { return m_cachedGlobalObject; } 138 139 private: 140 virtual void mark(); 141 142 JSGlobalObject* m_cachedGlobalObject; 143 }; 144 145 // Global Functions 146 JSValue* globalFuncEval(ExecState*, JSObject*, JSValue*, const ArgList&); 147 JSValue* globalFuncParseInt(ExecState*, JSObject*, JSValue*, const ArgList&); 148 JSValue* globalFuncParseFloat(ExecState*, JSObject*, JSValue*, const ArgList&); 149 JSValue* globalFuncIsNaN(ExecState*, JSObject*, JSValue*, const ArgList&); 150 JSValue* globalFuncIsFinite(ExecState*, JSObject*, JSValue*, const ArgList&); 151 JSValue* globalFuncDecodeURI(ExecState*, JSObject*, JSValue*, const ArgList&); 152 JSValue* globalFuncDecodeURIComponent(ExecState*, JSObject*, JSValue*, const ArgList&); 153 JSValue* globalFuncEncodeURI(ExecState*, JSObject*, JSValue*, const ArgList&); 154 JSValue* globalFuncEncodeURIComponent(ExecState*, JSObject*, JSValue*, const ArgList&); 155 JSValue* globalFuncEscape(ExecState*, JSObject*, JSValue*, const ArgList&); 156 JSValue* globalFuncUnescape(ExecState*, JSObject*, JSValue*, const ArgList&); 157 #ifndef NDEBUG 158 JSValue* globalFuncKJSPrint(ExecState*, JSObject*, JSValue*, const ArgList&); 159 #endif 160 161 static const double mantissaOverflowLowerBound = 9007199254740992.0; 162 double parseIntOverflow(const char*, int length, int radix); 163 164 } // namespace 165 166 #endif 53 #endif // InternalFunction_h
Note:
See TracChangeset
for help on using the changeset viewer.