Changeset 37125 in webkit for trunk/JavaScriptCore/VM/Machine.cpp
- Timestamp:
- Sep 30, 2008, 4:46:29 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/VM/Machine.cpp
r37089 r37125 106 106 #endif // #ENABLE(CTI) 107 107 108 static const intptr_t HostCallFrameMask = 1; 109 110 static inline Register* makeHostCallFramePointer(Register* callFrame) 111 { 112 return reinterpret_cast<Register*>(reinterpret_cast<intptr_t>(callFrame) | HostCallFrameMask); 113 } 114 115 static inline bool isHostCallFrame(Register* callFrame) 116 { 117 return reinterpret_cast<intptr_t>(callFrame) & HostCallFrameMask; 118 } 119 120 static inline Register* stripHostCallFrameBit(Register* callFrame) 121 { 122 return reinterpret_cast<Register*>(reinterpret_cast<intptr_t>(callFrame) & ~HostCallFrameMask); 123 } 124 108 125 // Returns the depth of the scope chain within a given call frame. 109 126 static int depth(CodeBlock* codeBlock, ScopeChain& sc) … … 793 810 void* returnPC = r[RegisterFile::ReturnPC].v(); 794 811 r = r[RegisterFile::CallerRegisters].r(); 795 if ( !r)812 if (isHostCallFrame(r)) 796 813 return false; 797 814 … … 897 914 Register* r = m_registerFile.base() + oldSize + codeBlock->numParameters + RegisterFile::CallFrameHeaderSize; 898 915 r[codeBlock->thisRegister] = thisObj; 899 initializeCallFrame(r, codeBlock, 0, scopeChain, 0, 0, 0, 0);916 initializeCallFrame(r, codeBlock, 0, scopeChain, makeHostCallFramePointer(0), 0, 0, 0); 900 917 901 918 if (codeBlock->needsFullScopeChain) … … 962 979 } 963 980 // a 0 codeBlock indicates a built-in caller 964 initializeCallFrame(r, codeBlock, 0, scopeChain, 0, 0, argc, function);981 initializeCallFrame(r, codeBlock, 0, scopeChain, makeHostCallFramePointer(exec->m_callFrame), 0, argc, function); 965 982 966 983 ExecState newExec(exec, r); … … 1045 1062 // a 0 codeBlock indicates a built-in caller 1046 1063 r[codeBlock->thisRegister] = thisObj; 1047 initializeCallFrame(r, codeBlock, 0, scopeChain, 0, 0, 0, 0);1064 initializeCallFrame(r, codeBlock, 0, scopeChain, makeHostCallFramePointer(exec->m_callFrame), 0, 0, 0); 1048 1065 1049 1066 if (codeBlock->needsFullScopeChain) … … 3363 3380 exec->m_callFrame = r; 3364 3381 3365 if ( !r)3382 if (isHostCallFrame(r)) 3366 3383 return returnValue; 3367 3384 … … 3854 3871 3855 3872 Register* callerR = r[RegisterFile::CallerRegisters].r(); 3856 if ( !callerR)3873 if (isHostCallFrame(callerR)) 3857 3874 return jsNull(); 3858 3875 … … 3872 3889 Register* r = exec->m_callFrame; 3873 3890 Register* callerR = r[RegisterFile::CallerRegisters].r(); 3874 if ( !callerR)3891 if (isHostCallFrame(callerR)) 3875 3892 return; 3876 3893 … … 3893 3910 Register* Machine::callFrame(ExecState* exec, InternalFunction* function) const 3894 3911 { 3895 for (; exec; exec = exec->m_prev) 3896 for (Register* r = exec->m_callFrame; r; r = r[RegisterFile::CallerRegisters].r()) 3897 if (r[RegisterFile::Callee].jsValue(exec) == function) 3898 return r; 3899 3912 for (Register* r = exec->m_callFrame; r; r = stripHostCallFrameBit(r[RegisterFile::CallerRegisters].r())) 3913 if (r[RegisterFile::Callee].getJSValue() == function) 3914 return r; 3900 3915 return 0; 3901 3916 }
Note:
See TracChangeset
for help on using the changeset viewer.