Bug 118823 - better assembler for win32 xptcinvoke. r=dbradley sr=shaver

This commit is contained in:
dbradley%netscape.com 2003-01-09 15:57:10 +00:00
Родитель 626345f855
Коммит 38f69c7cc8
1 изменённых файлов: 7 добавлений и 11 удалений

Просмотреть файл

@ -43,7 +43,7 @@
#error "This code is for Win32 only"
#endif
static void __stdcall
static void __fastcall
invoke_copy_to_stack(PRUint32* d, PRUint32 paramCount, nsXPTCVariant* s)
{
for(; paramCount > 0; paramCount--, d++, s++)
@ -84,25 +84,21 @@ XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex,
__asm {
push ebp
mov ebp,esp
mov eax,paramCount
cmp eax,0 // maybe we don't have any params to copy
mov edx,paramCount // Save paramCount for later
test edx,edx // maybe we don't have any params to copy
jz noparams
mov ecx,eax // save paramCount for later
mov eax,edx
shl eax,3 // *= 8 (max possible param size)
sub esp,eax // make space for params
mov edx,esp
mov ecx,esp
push params
push ecx // paramCount
push edx
call invoke_copy_to_stack // stdcall
call invoke_copy_to_stack // fastcall, ecx = d, edx = paramCount, params is on the stack
noparams:
mov ecx,that // instance in ecx
push ecx // push this
mov edx,[ecx] // vtable in edx
mov eax,methodIndex
shl eax,2 // *= 4
add edx,eax
call [edx] // stdcall, i.e. callee cleans up stack.
call [edx][eax*4] // stdcall, i.e. callee cleans up stack.
mov esp,ebp
pop ebp
ret