From 5aeba38fff5ec0f8420694f3af83ae95ee0b5508 Mon Sep 17 00:00:00 2001 From: "dbradley%netscape.com" Date: Thu, 9 Jan 2003 15:57:10 +0000 Subject: [PATCH] Bug 118823 - better assembler for win32 xptcinvoke. r=dbradley sr=shaver --- .../xptcall/src/md/win32/xptcinvoke.cpp | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/xpcom/reflect/xptcall/src/md/win32/xptcinvoke.cpp b/xpcom/reflect/xptcall/src/md/win32/xptcinvoke.cpp index 991d6ed9eae..f2b289b786c 100644 --- a/xpcom/reflect/xptcall/src/md/win32/xptcinvoke.cpp +++ b/xpcom/reflect/xptcall/src/md/win32/xptcinvoke.cpp @@ -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