Changeset 43372 in webkit for trunk/JavaScriptCore/jit/JIT.cpp
- Timestamp:
- May 7, 2009, 3:52:19 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/jit/JIT.cpp
r43363 r43372 1823 1823 emitGetFromCallFrameHeader(RegisterFile::ArgumentCount, regT0); 1824 1824 1825 struct NativeFunctionSignature { 1826 CallFrame* callFrame; 1825 /* We have two structs that we use to describe the stackframe we set up for our 1826 * call to native code. NativeCallFrameStructure describes the how we set up the stack 1827 * in advance of the call. NativeFunctionCalleeSignature describes the callframe 1828 * as the native code expects it. We do this as we are using the fastcall calling 1829 * convention which results in the callee popping its arguments off the stack, but 1830 * not the rest of the callframe so we need a nice way to ensure we increment the 1831 * stack pointer by the right amount after the call. 1832 */ 1833 #if COMPILER(MSVC) 1834 struct NativeCallFrameStructure { 1835 // CallFrame* callFrame; // passed in EDX 1827 1836 JSObject* callee; 1828 1837 JSValue thisValue; 1829 1838 ArgList* argPointer; 1830 1839 ArgList args; 1840 JSValue result; 1831 1841 }; 1832 const int NativeCallFrameSize = (sizeof(NativeFunctionSignature) + 15) & ~15; 1842 struct NativeFunctionCalleeSignature { 1843 JSObject* callee; 1844 JSValue thisValue; 1845 ArgList* argPointer; 1846 }; 1847 #else 1848 struct NativeCallFrameStructure { 1849 // CallFrame* callFrame; // passed in ECX 1850 // JSObject* callee; // passed in EDX 1851 JSValue thisValue; 1852 ArgList* argPointer; 1853 ArgList args; 1854 }; 1855 struct NativeFunctionCalleeSignature { 1856 JSValue thisValue; 1857 ArgList* argPointer; 1858 }; 1859 #endif 1860 const int NativeCallFrameSize = (sizeof(NativeCallFrameStructure) + 15) & ~15; 1833 1861 // Allocate system stack frame 1834 1862 subPtr(Imm32(NativeCallFrameSize), stackPointerRegister); … … 1838 1866 1839 1867 // push argcount 1840 storePtr(regT0, Address(stackPointerRegister, FIELD_OFFSET(Native FunctionSignature, args) + FIELD_OFFSET(ArgList, m_argCount)));1868 storePtr(regT0, Address(stackPointerRegister, FIELD_OFFSET(NativeCallFrameStructure, args) + FIELD_OFFSET(ArgList, m_argCount))); 1841 1869 1842 1870 // Calculate the start of the callframe header, and store in regT1 … … 1846 1874 mul32(Imm32(sizeof(Register)), regT0, regT0); 1847 1875 subPtr(regT0, regT1); 1848 storePtr(regT1, Address(stackPointerRegister, FIELD_OFFSET(Native FunctionSignature, args) + FIELD_OFFSET(ArgList, m_args)));1876 storePtr(regT1, Address(stackPointerRegister, FIELD_OFFSET(NativeCallFrameStructure, args) + FIELD_OFFSET(ArgList, m_args))); 1849 1877 1850 1878 // ArgList is passed by reference so is stackPointerRegister + 4 * sizeof(Register) 1851 addPtr(Imm32(FIELD_OFFSET(Native FunctionSignature, args)), stackPointerRegister, regT0);1852 storePtr(regT0, Address(stackPointerRegister, FIELD_OFFSET(Native FunctionSignature, argPointer)));1879 addPtr(Imm32(FIELD_OFFSET(NativeCallFrameStructure, args)), stackPointerRegister, regT0); 1880 storePtr(regT0, Address(stackPointerRegister, FIELD_OFFSET(NativeCallFrameStructure, argPointer))); 1853 1881 1854 1882 // regT1 currently points to the first argument, regT1 - sizeof(Register) points to 'this' 1855 1883 loadPtr(Address(regT1, -(int)sizeof(Register)), regT1); 1856 poke(regT1, 2); 1857 storePtr(regT1, Address(stackPointerRegister, FIELD_OFFSET(NativeFunctionSignature, thisValue))); 1884 storePtr(regT1, Address(stackPointerRegister, FIELD_OFFSET(NativeCallFrameStructure, thisValue))); 1885 1886 #if COMPILER(MSVC) 1887 // ArgList is passed by reference so is stackPointerRegister + 4 * sizeof(Register) 1888 addPtr(Imm32(FIELD_OFFSET(NativeCallFrameStructure, result)), stackPointerRegister, X86::ecx); 1858 1889 1859 1890 // Plant callee 1860 emitGetFromCallFrameHeader(RegisterFile::Callee, regT2);1861 storePtr( regT2, Address(stackPointerRegister, FIELD_OFFSET(NativeFunctionSignature, callee)));1891 emitGetFromCallFrameHeader(RegisterFile::Callee, X86::eax); 1892 storePtr(X86::eax, Address(stackPointerRegister, FIELD_OFFSET(NativeCallFrameStructure, callee))); 1862 1893 1863 1894 // Plant callframe 1864 storePtr(callFrameRegister, Address(stackPointerRegister, FIELD_OFFSET(NativeFunctionSignature, callFrame))); 1865 1866 call(Address(regT2, FIELD_OFFSET(JSFunction, m_data))); 1867 addPtr(Imm32(NativeCallFrameSize), stackPointerRegister); 1895 move(callFrameRegister, X86::edx); 1896 1897 call(Address(X86::eax, FIELD_OFFSET(JSFunction, m_data))); 1898 1899 // JSValue is a non-POD type 1900 loadPtr(Address(X86::eax), X86::eax); 1901 #else 1902 // Plant callee 1903 emitGetFromCallFrameHeader(RegisterFile::Callee, X86::edx); 1904 1905 // Plant callframe 1906 move(callFrameRegister, X86::ecx); 1907 call(Address(X86::edx, FIELD_OFFSET(JSFunction, m_data))); 1908 #endif 1909 1910 // We've put a few temporaries on the stack in addition to the actual arguments 1911 // so pull them off now 1912 addPtr(Imm32(NativeCallFrameSize - sizeof(NativeFunctionCalleeSignature)), stackPointerRegister); 1913 1868 1914 #endif 1869 1915
Note:
See TracChangeset
for help on using the changeset viewer.