Changeset 47236 in webkit for trunk/JavaScriptCore/runtime/JSFunction.h
- Timestamp:
- Aug 13, 2009, 2:51:50 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/runtime/JSFunction.h
r47089 r47236 26 26 27 27 #include "InternalFunction.h" 28 #include "JSVariableObject.h"29 #include "SymbolTable.h"30 #include "Nodes.h"31 #include "JSObject.h"32 28 33 29 namespace JSC { … … 44 40 typedef InternalFunction Base; 45 41 46 JSFunction(PassRefPtr<Structure> structure)47 : InternalFunction(structure)48 {49 clearScopeChain();50 }51 52 42 public: 53 43 JSFunction(ExecState*, PassRefPtr<Structure>, int length, const Identifier&, NativeFunction); 54 JSFunction(ExecState*, const Identifier&, FunctionBodyNode*, ScopeChainNode*); 55 ~JSFunction(); 56 57 virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&); 58 virtual void put(ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&); 59 virtual bool deleteProperty(ExecState*, const Identifier& propertyName); 44 JSFunction(ExecState*, const Identifier&, PassRefPtr<FunctionBodyNode>, ScopeChainNode*); 45 virtual ~JSFunction(); 60 46 61 47 JSObject* construct(ExecState*, const ArgList&); … … 65 51 ScopeChain& scope() { return scopeChain(); } 66 52 67 void setBody(FunctionBodyNode* body) { m_body = body; } 68 void setBody(PassRefPtr<FunctionBodyNode> body) { m_body = body; } 53 void setBody(PassRefPtr<FunctionBodyNode>); 69 54 FunctionBodyNode* body() const { return m_body.get(); } 70 71 virtual void markChildren(MarkStack&);72 55 73 56 static JS_EXPORTDATA const ClassInfo info; … … 78 61 } 79 62 80 #if ENABLE(JIT)81 bool isHostFunction() const { return m_body && m_body->isHostFunction(); }82 #else83 bool isHostFunction() const { return false; }84 #endif85 63 NativeFunction nativeFunction() 86 64 { … … 92 70 93 71 private: 72 JSFunction(PassRefPtr<Structure>); 73 74 bool isHostFunction() const; 75 bool isHostFunctionNonInline() const; 76 77 virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&); 78 virtual void put(ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&); 79 virtual bool deleteProperty(ExecState*, const Identifier& propertyName); 80 81 virtual void markChildren(MarkStack&); 82 94 83 virtual const ClassInfo* classInfo() const { return &info; } 95 84 … … 101 90 ScopeChain& scopeChain() 102 91 { 103 ASSERT(!isHostFunction ());92 ASSERT(!isHostFunctionNonInline()); 104 93 return *reinterpret_cast<ScopeChain*>(m_data); 105 94 } 106 95 void clearScopeChain() 107 96 { 108 ASSERT(!isHostFunction ());97 ASSERT(!isHostFunctionNonInline()); 109 98 new (m_data) ScopeChain(NoScopeChain()); 110 99 } 111 100 void setScopeChain(ScopeChainNode* sc) 112 101 { 113 ASSERT(!isHostFunction ());102 ASSERT(!isHostFunctionNonInline()); 114 103 new (m_data) ScopeChain(sc); 115 104 } 116 105 void setScopeChain(const ScopeChain& sc) 117 106 { 118 ASSERT(!isHostFunction ());107 ASSERT(!isHostFunctionNonInline()); 119 108 *reinterpret_cast<ScopeChain*>(m_data) = sc; 120 109 } … … 134 123 } 135 124 136 inline JSFunction* FunctionBodyNode::make(ExecState* exec, ScopeChainNode* scopeChain)137 {138 return new (exec) JSFunction(exec, m_ident, this, scopeChain);139 }140 141 125 } // namespace JSC 142 126
Note:
See TracChangeset
for help on using the changeset viewer.