Changeset 43220 in webkit for trunk/JavaScriptCore/runtime/JSFunction.h
- Timestamp:
- May 5, 2009, 4:34:23 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/runtime/JSFunction.h
r43122 r43220 47 47 JSFunction(PassRefPtr<Structure> structure) 48 48 : InternalFunction(structure) 49 , m_scopeChain(NoScopeChain())50 49 { 50 clearScopeChain(); 51 51 } 52 52 53 53 public: 54 JSFunction(ExecState*, PassRefPtr<Structure>, int length, const Identifier&, NativeFunction); 54 55 JSFunction(ExecState*, const Identifier&, FunctionBodyNode*, ScopeChainNode*); 55 56 ~JSFunction(); … … 62 63 JSValue call(ExecState*, JSValue thisValue, const ArgList&); 63 64 64 void setScope(const ScopeChain& scopeChain) { m_scopeChain = scopeChain; }65 ScopeChain& scope() { return m_scopeChain; }65 void setScope(const ScopeChain& scopeChain) { setScopeChain(scopeChain); } 66 ScopeChain& scope() { return scopeChain(); } 66 67 67 68 void setBody(FunctionBodyNode* body) { m_body = body; } … … 78 79 } 79 80 81 #if ENABLE(JIT) 82 bool isHostFunction() const { return m_body && m_body->isHostFunction(); } 83 #else 84 bool isHostFunction() const { return false; } 85 #endif 80 86 private: 81 87 virtual const ClassInfo* classInfo() const { return &info; } … … 89 95 90 96 RefPtr<FunctionBodyNode> m_body; 91 ScopeChain m_scopeChain; 97 ScopeChain& scopeChain() 98 { 99 ASSERT(!isHostFunction()); 100 return *reinterpret_cast<ScopeChain*>(m_data); 101 } 102 void clearScopeChain() 103 { 104 ASSERT(!isHostFunction()); 105 new (m_data) ScopeChain(NoScopeChain()); 106 } 107 void setScopeChain(ScopeChainNode* sc) 108 { 109 ASSERT(!isHostFunction()); 110 new (m_data) ScopeChain(sc); 111 } 112 void setScopeChain(const ScopeChain& sc) 113 { 114 ASSERT(!isHostFunction()); 115 *reinterpret_cast<ScopeChain*>(m_data) = sc; 116 } 117 NativeFunction nativeFunction() 118 { 119 return *reinterpret_cast<NativeFunction*>(m_data); 120 } 121 void setNativeFunction(NativeFunction func) 122 { 123 *reinterpret_cast<NativeFunction*>(m_data) = func; 124 } 125 unsigned char m_data[sizeof(void*)]; 92 126 }; 93 127
Note:
See TracChangeset
for help on using the changeset viewer.