Changeset 37427 in webkit for trunk/JavaScriptCore/VM/Machine.h
- Timestamp:
- Oct 8, 2008, 10:03:10 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/VM/Machine.h
r37406 r37427 45 45 class CodeBlock; 46 46 class EvalNode; 47 class ExecState;48 47 class FunctionBodyNode; 49 48 class Instruction; … … 96 95 bool isOpcode(Opcode opcode); 97 96 98 JSValue* execute(ProgramNode*, ExecState*, ScopeChainNode*, JSObject* thisObj, JSValue** exception); 99 JSValue* execute(FunctionBodyNode*, ExecState*, JSFunction*, JSObject* thisObj, const ArgList& args, ScopeChainNode*, JSValue** exception); 100 JSValue* execute(EvalNode* evalNode, ExecState* exec, JSObject* thisObj, ScopeChainNode* scopeChain, JSValue** exception); 101 102 JSValue* retrieveArguments(ExecState*, JSFunction*) const; 103 JSValue* retrieveCaller(ExecState*, InternalFunction*) const; 104 void retrieveLastCaller(ExecState* exec, int& lineNumber, intptr_t& sourceID, UString& sourceURL, JSValue*& function) const; 105 106 static ScopeChainNode* scopeChain(const Register* r) { return r[RegisterFile::ScopeChain].scopeChain(); } 107 static CodeBlock* codeBlock(const Register* r) { return r[RegisterFile::CodeBlock].codeBlock(); } 108 109 void getArgumentsData(Register* callFrame, JSFunction*&, ptrdiff_t& firstParameterIndex, Register*& argv, int& argc); 97 JSValue* execute(ProgramNode*, CallFrame*, ScopeChainNode*, JSObject* thisObj, JSValue** exception); 98 JSValue* execute(FunctionBodyNode*, CallFrame*, JSFunction*, JSObject* thisObj, const ArgList& args, ScopeChainNode*, JSValue** exception); 99 JSValue* execute(EvalNode* evalNode, CallFrame* exec, JSObject* thisObj, ScopeChainNode* scopeChain, JSValue** exception); 100 101 JSValue* retrieveArguments(CallFrame*, JSFunction*) const; 102 JSValue* retrieveCaller(CallFrame*, InternalFunction*) const; 103 void retrieveLastCaller(CallFrame*, int& lineNumber, intptr_t& sourceID, UString& sourceURL, JSValue*& function) const; 104 105 void getArgumentsData(CallFrame*, JSFunction*&, ptrdiff_t& firstParameterIndex, Register*& argv, int& argc); 110 106 void setTimeoutTime(unsigned timeoutTime) { m_timeoutTime = timeoutTime; } 111 107 … … 240 236 bool isJSArray(JSValue* v) { return !JSImmediate::isImmediate(v) && v->asCell()->vptr() == m_jsArrayVptr; } 241 237 bool isJSString(JSValue* v) { return !JSImmediate::isImmediate(v) && v->asCell()->vptr() == m_jsStringVptr; } 242 243 ALWAYS_INLINE static void initializeCallFrame(Register* callFrame, CodeBlock*, Instruction*, ScopeChainNode*, Register* r, int returnValueRegister, int argc, JSValue* function);244 238 245 239 private: 246 240 enum ExecutionFlag { Normal, InitializeAndReturn }; 247 241 248 NEVER_INLINE JSValue* callEval(ExecState* exec, JSObject* thisObj, ScopeChainNode* scopeChain, RegisterFile*, Register* r, int argv, int argc, JSValue*& exceptionValue); 249 JSValue* execute(EvalNode*, ExecState*, JSObject* thisObj, int registerOffset, ScopeChainNode*, JSValue** exception); 250 251 NEVER_INLINE void debug(ExecState*, Register*, DebugHookID, int firstLine, int lastLine); 252 253 NEVER_INLINE bool resolve(ExecState* exec, Instruction* vPC, Register* r, JSValue*& exceptionValue); 254 NEVER_INLINE bool resolveSkip(ExecState* exec, Instruction* vPC, Register* r, JSValue*& exceptionValue); 255 NEVER_INLINE bool resolveGlobal(ExecState* exec, Instruction* vPC, Register* r, JSValue*& exceptionValue); 256 NEVER_INLINE void resolveBase(ExecState* exec, Instruction* vPC, Register* r); 257 NEVER_INLINE bool resolveBaseAndProperty(ExecState* exec, Instruction* vPC, Register* r, JSValue*& exceptionValue); 258 NEVER_INLINE ScopeChainNode* createExceptionScope(ExecState* exec, const Instruction* vPC, Register* r); 259 260 NEVER_INLINE bool unwindCallFrame(ExecState*&, JSValue*, const Instruction*&, CodeBlock*&, Register*&); 261 NEVER_INLINE Instruction* throwException(ExecState*, JSValue*&, const Instruction*, Register*&, bool); 262 NEVER_INLINE bool resolveBaseAndFunc(ExecState* exec, Instruction* vPC, Register* r, JSValue*& exceptionValue); 263 264 Register* callFrame(ExecState*, InternalFunction*) const; 265 266 JSValue* privateExecute(ExecutionFlag, RegisterFile*, Register*, JSValue** exception); 267 268 void dumpCallFrame(const RegisterFile*, const Register*); 269 void dumpRegisters(const RegisterFile*, const Register*); 242 NEVER_INLINE JSValue* callEval(CallFrame*, JSObject* thisObject, ScopeChainNode*, RegisterFile*, int argv, int argc, JSValue*& exceptionValue); 243 JSValue* execute(EvalNode*, CallFrame*, JSObject* thisObject, int registerOffset, ScopeChainNode*, JSValue** exception); 244 245 NEVER_INLINE void debug(CallFrame*, DebugHookID, int firstLine, int lastLine); 246 247 NEVER_INLINE bool resolve(CallFrame*, Instruction*, JSValue*& exceptionValue); 248 NEVER_INLINE bool resolveSkip(CallFrame*, Instruction*, JSValue*& exceptionValue); 249 NEVER_INLINE bool resolveGlobal(CallFrame*, Instruction*, JSValue*& exceptionValue); 250 NEVER_INLINE void resolveBase(CallFrame*, Instruction* vPC); 251 NEVER_INLINE bool resolveBaseAndProperty(CallFrame*, Instruction*, JSValue*& exceptionValue); 252 NEVER_INLINE ScopeChainNode* createExceptionScope(CallFrame*, const Instruction* vPC); 253 254 NEVER_INLINE bool unwindCallFrame(CallFrame*&, JSValue*, const Instruction*&, CodeBlock*&); 255 NEVER_INLINE Instruction* throwException(CallFrame*&, JSValue*&, const Instruction*, bool); 256 NEVER_INLINE bool resolveBaseAndFunc(CallFrame*, Instruction*, JSValue*& exceptionValue); 257 258 static ALWAYS_INLINE CallFrame* slideRegisterWindowForCall(CodeBlock*, RegisterFile*, CallFrame*, size_t registerOffset, int argc); 259 260 static CallFrame* findFunctionCallFrame(CallFrame*, InternalFunction*); 261 262 JSValue* privateExecute(ExecutionFlag, RegisterFile*, CallFrame*, JSValue** exception); 263 264 void dumpCallFrame(const RegisterFile*, CallFrame*); 265 void dumpRegisters(const RegisterFile*, CallFrame*); 270 266 271 267 JSValue* checkTimeout(JSGlobalObject*); 272 268 void resetTimeoutCheck(); 273 269 274 void tryCacheGetByID( ExecState*, CodeBlock*, Instruction* vPC, JSValue* baseValue, const Identifier& propertyName, const PropertySlot&);270 void tryCacheGetByID(CallFrame*, CodeBlock*, Instruction*, JSValue* baseValue, const Identifier& propertyName, const PropertySlot&); 275 271 void uncacheGetByID(CodeBlock*, Instruction* vPC); 276 void tryCachePutByID( ExecState* exec, CodeBlock*, Instruction* vPC, JSValue* baseValue, const PutPropertySlot&);272 void tryCachePutByID(CallFrame*, CodeBlock*, Instruction*, JSValue* baseValue, const PutPropertySlot&); 277 273 void uncachePutByID(CodeBlock*, Instruction* vPC); 278 274 279 275 #if ENABLE(CTI) 280 void tryCTICacheGetByID( ExecState*, CodeBlock*, void* returnAddress, JSValue* baseValue, const Identifier& propertyName, const PropertySlot&);281 void tryCTICachePutByID( ExecState*, CodeBlock*, void* returnAddress, JSValue* baseValue, const PutPropertySlot&);282 283 void* getCTIArrayLengthTrampoline( ExecState*, CodeBlock*);284 void* getCTIStringLengthTrampoline( ExecState*, CodeBlock*);276 void tryCTICacheGetByID(CallFrame*, CodeBlock*, void* returnAddress, JSValue* baseValue, const Identifier& propertyName, const PropertySlot&); 277 void tryCTICachePutByID(CallFrame*, CodeBlock*, void* returnAddress, JSValue* baseValue, const PutPropertySlot&); 278 279 void* getCTIArrayLengthTrampoline(CallFrame*, CodeBlock*); 280 void* getCTIStringLengthTrampoline(CallFrame*, CodeBlock*); 285 281 286 282 void* m_ctiArrayLengthTrampoline; … … 310 306 }; 311 307 312 ALWAYS_INLINE void Machine::initializeCallFrame(Register* callFrame, CodeBlock* codeBlock, Instruction* vPC, ScopeChainNode* scopeChain, Register* r, int returnValueRegister, int argc, JSValue* function)313 {314 ASSERT(r); // use makeHostCallFramePointer(0) to create a host call frame sentinel.315 callFrame[RegisterFile::CodeBlock] = codeBlock;316 callFrame[RegisterFile::ScopeChain] = scopeChain;317 callFrame[RegisterFile::CallerRegisters] = r;318 callFrame[RegisterFile::ReturnPC] = vPC;319 callFrame[RegisterFile::ReturnValueRegister] = returnValueRegister;320 callFrame[RegisterFile::ArgumentCount] = argc; // original argument count (for the sake of the "arguments" object)321 callFrame[RegisterFile::Callee] = function;322 callFrame[RegisterFile::OptionalCalleeArguments] = nullJSValue;323 }324 325 const intptr_t HostCallFrameMask = 1;326 327 inline Register* makeHostCallFramePointer(Register* callFrame)328 {329 return reinterpret_cast<Register*>(reinterpret_cast<intptr_t>(callFrame) | HostCallFrameMask);330 }331 332 inline bool isHostCallFrame(Register* callFrame)333 {334 return reinterpret_cast<intptr_t>(callFrame) & HostCallFrameMask;335 }336 337 inline Register* stripHostCallFrameBit(Register* callFrame)338 {339 return reinterpret_cast<Register*>(reinterpret_cast<intptr_t>(callFrame) & ~HostCallFrameMask);340 }341 342 308 } // namespace JSC 343 309
Note:
See TracChangeset
for help on using the changeset viewer.