Changeset 130726 in webkit for trunk/Source/JavaScriptCore/interpreter/CallFrame.h
- Timestamp:
- Oct 9, 2012, 12:12:56 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/interpreter/CallFrame.h
r129827 r130726 26 26 #include "AbstractPC.h" 27 27 #include "JSGlobalData.h" 28 #include "JSStack.h" 28 29 #include "MacroAssemblerCodeRef.h" 29 #include "RegisterFile.h"30 30 31 31 namespace JSC { … … 40 40 class ExecState : private Register { 41 41 public: 42 JSValue calleeAsValue() const { return this[ RegisterFile::Callee].jsValue(); }43 JSObject* callee() const { return this[ RegisterFile::Callee].function(); }44 CodeBlock* codeBlock() const { return this[ RegisterFile::CodeBlock].Register::codeBlock(); }42 JSValue calleeAsValue() const { return this[JSStack::Callee].jsValue(); } 43 JSObject* callee() const { return this[JSStack::Callee].function(); } 44 CodeBlock* codeBlock() const { return this[JSStack::CodeBlock].Register::codeBlock(); } 45 45 JSScope* scope() const 46 46 { 47 ASSERT(this[ RegisterFile::ScopeChain].Register::scope());48 return this[ RegisterFile::ScopeChain].Register::scope();47 ASSERT(this[JSStack::ScopeChain].Register::scope()); 48 return this[JSStack::ScopeChain].Register::scope(); 49 49 } 50 50 … … 103 103 CallFrame& operator=(const Register& r) { *static_cast<Register*>(this) = r; return *this; } 104 104 105 CallFrame* callerFrame() const { return this[ RegisterFile::CallerFrame].callFrame(); }105 CallFrame* callerFrame() const { return this[JSStack::CallerFrame].callFrame(); } 106 106 #if ENABLE(JIT) || ENABLE(LLINT) 107 ReturnAddressPtr returnPC() const { return ReturnAddressPtr(this[ RegisterFile::ReturnPC].vPC()); }108 bool hasReturnPC() const { return !!this[ RegisterFile::ReturnPC].vPC(); }109 void clearReturnPC() { registers()[ RegisterFile::ReturnPC] = static_cast<Instruction*>(0); }107 ReturnAddressPtr returnPC() const { return ReturnAddressPtr(this[JSStack::ReturnPC].vPC()); } 108 bool hasReturnPC() const { return !!this[JSStack::ReturnPC].vPC(); } 109 void clearReturnPC() { registers()[JSStack::ReturnPC] = static_cast<Instruction*>(0); } 110 110 #endif 111 111 AbstractPC abstractReturnPC(JSGlobalData& globalData) { return AbstractPC(globalData, this); } … … 117 117 { 118 118 ASSERT(codeBlock()); 119 return this[ RegisterFile::ArgumentCount].tag();119 return this[JSStack::ArgumentCount].tag(); 120 120 } 121 121 … … 123 123 { 124 124 ASSERT(codeBlock()); 125 this[ RegisterFile::ArgumentCount].tag() = static_cast<int32_t>(offset);125 this[JSStack::ArgumentCount].tag() = static_cast<int32_t>(offset); 126 126 } 127 127 #endif … … 137 137 138 138 #if ENABLE(DFG_JIT) 139 InlineCallFrame* inlineCallFrame() const { return this[ RegisterFile::ReturnPC].asInlineCallFrame(); }140 unsigned codeOriginIndexForDFG() const { return this[ RegisterFile::ArgumentCount].tag(); }139 InlineCallFrame* inlineCallFrame() const { return this[JSStack::ReturnPC].asInlineCallFrame(); } 140 unsigned codeOriginIndexForDFG() const { return this[JSStack::ArgumentCount].tag(); } 141 141 #else 142 142 // This will never be called if !ENABLE(DFG_JIT) since all calls should be guarded by … … 152 152 Instruction* currentVPC() const 153 153 { 154 return bitwise_cast<Instruction*>(this[ RegisterFile::ArgumentCount].tag());154 return bitwise_cast<Instruction*>(this[JSStack::ArgumentCount].tag()); 155 155 } 156 156 void setCurrentVPC(Instruction* vpc) 157 157 { 158 this[ RegisterFile::ArgumentCount].tag() = bitwise_cast<int32_t>(vpc);158 this[JSStack::ArgumentCount].tag() = bitwise_cast<int32_t>(vpc); 159 159 } 160 160 #else … … 163 163 #endif 164 164 165 void setCallerFrame(CallFrame* callerFrame) { static_cast<Register*>(this)[ RegisterFile::CallerFrame] = callerFrame; }166 void setScope(JSScope* scope) { static_cast<Register*>(this)[ RegisterFile::ScopeChain] = scope; }165 void setCallerFrame(CallFrame* callerFrame) { static_cast<Register*>(this)[JSStack::CallerFrame] = callerFrame; } 166 void setScope(JSScope* scope) { static_cast<Register*>(this)[JSStack::ScopeChain] = scope; } 167 167 168 168 ALWAYS_INLINE void init(CodeBlock* codeBlock, Instruction* vPC, JSScope* scope, … … 170 170 { 171 171 ASSERT(callerFrame); // Use noCaller() rather than 0 for the outer host call frame caller. 172 ASSERT(callerFrame == noCaller() || callerFrame->removeHostCallFrameFlag()-> registerFile()->end() >= this);172 ASSERT(callerFrame == noCaller() || callerFrame->removeHostCallFrameFlag()->stack()->end() >= this); 173 173 174 174 setCodeBlock(codeBlock); … … 187 187 // Access to arguments as passed. (After capture, arguments may move to a different location.) 188 188 size_t argumentCount() const { return argumentCountIncludingThis() - 1; } 189 size_t argumentCountIncludingThis() const { return this[ RegisterFile::ArgumentCount].payload(); }189 size_t argumentCountIncludingThis() const { return this[JSStack::ArgumentCount].payload(); } 190 190 static int argumentOffset(int argument) { return s_firstArgumentOffset - argument; } 191 191 static int argumentOffsetIncludingThis(int argument) { return s_thisArgumentOffset - argument; } … … 217 217 JSValue argumentAfterCapture(size_t argument); 218 218 219 static int offsetFor(size_t argumentCountIncludingThis) { return argumentCountIncludingThis + RegisterFile::CallFrameHeaderSize; }219 static int offsetFor(size_t argumentCountIncludingThis) { return argumentCountIncludingThis + JSStack::CallFrameHeaderSize; } 220 220 221 221 // FIXME: Remove these. … … 229 229 CallFrame* removeHostCallFrameFlag() { return reinterpret_cast<CallFrame*>(reinterpret_cast<intptr_t>(this) & ~HostCallFrameFlag); } 230 230 231 void setArgumentCountIncludingThis(int count) { static_cast<Register*>(this)[ RegisterFile::ArgumentCount].payload() = count; }232 void setCallee(JSObject* callee) { static_cast<Register*>(this)[ RegisterFile::Callee] = Register::withCallee(callee); }233 void setCodeBlock(CodeBlock* codeBlock) { static_cast<Register*>(this)[ RegisterFile::CodeBlock] = codeBlock; }234 void setReturnPC(void* value) { static_cast<Register*>(this)[ RegisterFile::ReturnPC] = (Instruction*)value; }231 void setArgumentCountIncludingThis(int count) { static_cast<Register*>(this)[JSStack::ArgumentCount].payload() = count; } 232 void setCallee(JSObject* callee) { static_cast<Register*>(this)[JSStack::Callee] = Register::withCallee(callee); } 233 void setCodeBlock(CodeBlock* codeBlock) { static_cast<Register*>(this)[JSStack::CodeBlock] = codeBlock; } 234 void setReturnPC(void* value) { static_cast<Register*>(this)[JSStack::ReturnPC] = (Instruction*)value; } 235 235 236 236 #if ENABLE(DFG_JIT) 237 237 bool isInlineCallFrame(); 238 238 239 void setInlineCallFrame(InlineCallFrame* inlineCallFrame) { static_cast<Register*>(this)[ RegisterFile::ReturnPC] = inlineCallFrame; }239 void setInlineCallFrame(InlineCallFrame* inlineCallFrame) { static_cast<Register*>(this)[JSStack::ReturnPC] = inlineCallFrame; } 240 240 241 241 // Call this to get the semantically correct JS CallFrame* for the … … 270 270 private: 271 271 static const intptr_t HostCallFrameFlag = 1; 272 static const int s_thisArgumentOffset = -1 - RegisterFile::CallFrameHeaderSize;272 static const int s_thisArgumentOffset = -1 - JSStack::CallFrameHeaderSize; 273 273 static const int s_firstArgumentOffset = s_thisArgumentOffset - 1; 274 274 275 275 #ifndef NDEBUG 276 RegisterFile* registerFile();276 JSStack* stack(); 277 277 #endif 278 278 #if ENABLE(DFG_JIT)
Note:
See TracChangeset
for help on using the changeset viewer.