Changeset 37428 in webkit for trunk/JavaScriptCore/VM/Machine.h
- Timestamp:
- Oct 8, 2008, 10:50:42 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/VM/Machine.h
r37427 r37428 45 45 class CodeBlock; 46 46 class EvalNode; 47 class ExecState; 47 48 class FunctionBodyNode; 48 49 class Instruction; … … 95 96 bool isOpcode(Opcode opcode); 96 97 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); 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); 106 110 void setTimeoutTime(unsigned timeoutTime) { m_timeoutTime = timeoutTime; } 107 111 … … 236 240 bool isJSArray(JSValue* v) { return !JSImmediate::isImmediate(v) && v->asCell()->vptr() == m_jsArrayVptr; } 237 241 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); 238 244 239 245 private: 240 246 enum ExecutionFlag { Normal, InitializeAndReturn }; 241 247 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*); 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*); 266 270 267 271 JSValue* checkTimeout(JSGlobalObject*); 268 272 void resetTimeoutCheck(); 269 273 270 void tryCacheGetByID( CallFrame*, CodeBlock*, Instruction*, JSValue* baseValue, const Identifier& propertyName, const PropertySlot&);274 void tryCacheGetByID(ExecState*, CodeBlock*, Instruction* vPC, JSValue* baseValue, const Identifier& propertyName, const PropertySlot&); 271 275 void uncacheGetByID(CodeBlock*, Instruction* vPC); 272 void tryCachePutByID( CallFrame*, CodeBlock*, Instruction*, JSValue* baseValue, const PutPropertySlot&);276 void tryCachePutByID(ExecState* exec, CodeBlock*, Instruction* vPC, JSValue* baseValue, const PutPropertySlot&); 273 277 void uncachePutByID(CodeBlock*, Instruction* vPC); 274 278 275 279 #if ENABLE(CTI) 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*);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*); 281 285 282 286 void* m_ctiArrayLengthTrampoline; … … 306 310 }; 307 311 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 308 342 } // namespace JSC 309 343
Note:
See TracChangeset
for help on using the changeset viewer.