Created
October 24, 2012 23:53
-
-
Save ehsan/3949677 to your computer and use it in GitHub Desktop.
With MOZ_ALWAYS_INLINE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void | |
AppendUTF8toUTF16( const nsACString& aSource, nsAString& aDest ) | |
{ | |
... | |
copy_string(aSource.BeginReading(source_start), | |
aSource.EndReading(source_end), converter); | |
5DE86EEB 8B 4E 04 mov ecx,dword ptr [esi+4] | |
5DE86EEE 8D 04 78 lea eax,[eax+edi*2] | |
5DE86EF1 89 45 F4 mov dword ptr [converter],eax | |
5DE86EF4 89 45 F8 mov dword ptr [calculator],eax | |
5DE86EF7 8B 06 mov eax,dword ptr [esi] | |
5DE86EF9 03 C8 add ecx,eax | |
5DE86EFB 89 45 E8 mov dword ptr [source_end],eax | |
5DE86EFE 89 45 DC mov dword ptr [source_start],eax | |
5DE86F01 89 45 E4 mov dword ptr [ebp-1Ch],eax | |
5DE86F04 8D 45 F4 lea eax,[converter] | |
5DE86F07 50 push eax | |
5DE86F08 8D 45 E8 lea eax,[source_end] | |
5DE86F0B 50 push eax | |
5DE86F0C 8D 45 DC lea eax,[source_start] | |
5DE86F0F 50 push eax | |
5DE86F10 C6 45 FC 00 mov byte ptr [ebp-4],0 | |
5DE86F14 89 4D EC mov dword ptr [ebp-14h],ecx | |
5DE86F17 89 4D F0 mov dword ptr [ebp-10h],ecx | |
5DE86F1A 89 4D E0 mov dword ptr [ebp-20h],ecx | |
5DE86F1D E8 7A FE FF FF call copy_string<nsReadingIterator<char>,ConvertUTF8toUTF16> (5DE86D9Ch) | |
5DE86F22 83 C4 0C add esp,0Ch | |
Which then calls: | |
template <class InputIterator, class OutputIterator> | |
inline | |
OutputIterator& | |
copy_string( const InputIterator& first, const InputIterator& last, OutputIterator& result ) | |
{ | |
typedef nsCharSourceTraits<InputIterator> source_traits; | |
typedef nsCharSinkTraits<OutputIterator> sink_traits; | |
sink_traits::write(result, source_traits::read(first), source_traits::readable_distance(first, last)); | |
5DE86D9C 8B 44 24 04 mov eax,dword ptr [esp+4] | |
5DE86DA0 8B 40 08 mov eax,dword ptr [eax+8] | |
5DE86DA3 8B 4C 24 08 mov ecx,dword ptr [esp+8] | |
5DE86DA7 8B 49 08 mov ecx,dword ptr [ecx+8] | |
5DE86DAA 2B C8 sub ecx,eax | |
5DE86DAC 51 push ecx | |
5DE86DAD 50 push eax | |
5DE86DAE FF 74 24 14 push dword ptr [esp+14h] | |
5DE86DB2 E8 38 4F FE FF call nsCharSinkTraits<ConvertUTF8toUTF16>::write (5DE6BCEFh) | |
return result; | |
5DE86DB7 8B 44 24 18 mov eax,dword ptr [esp+18h] | |
5DE86DBB 83 C4 0C add esp,0Ch | |
} | |
Which ends up calling: | |
template <class OutputIterator> | |
struct nsCharSinkTraits | |
{ | |
static | |
void | |
write( OutputIterator& iter, const typename OutputIterator::value_type* s, uint32_t n ) | |
{ | |
5DE6BCEF 55 push ebp | |
5DE6BCF0 8B EC mov ebp,esp | |
5DE6BCF2 51 push ecx | |
5DE6BCF3 57 push edi | |
iter.write(s, n); | |
5DE6BCF4 8B 7D 08 mov edi,dword ptr [iter] | |
5DE6BCF7 80 7F 08 00 cmp byte ptr [edi+8],0 | |
5DE6BCFB 75 6A jne nsCharSinkTraits<ConvertUTF8toUTF16>::write+78h (5DE6BD67h) | |
5DE6BCFD 8B 45 0C mov eax,dword ptr [s] | |
5DE6BD00 8B 4D 10 mov ecx,dword ptr [n] | |
5DE6BD03 53 push ebx | |
5DE6BD04 8D 1C 08 lea ebx,[eax+ecx] | |
5DE6BD07 56 push esi | |
5DE6BD08 8B 77 04 mov esi,dword ptr [edi+4] | |
5DE6BD0B 89 45 FC mov dword ptr [ebp-4],eax | |
5DE6BD0E 3B C3 cmp eax,ebx | |
5DE6BD10 74 50 je nsCharSinkTraits<ConvertUTF8toUTF16>::write+73h (5DE6BD62h) | |
5DE6BD12 8D 45 0B lea eax,[ebp+0Bh] | |
5DE6BD15 50 push eax | |
5DE6BD16 8D 45 FC lea eax,[ebp-4] | |
5DE6BD19 53 push ebx | |
5DE6BD1A 50 push eax | |
5DE6BD1B E8 14 5A 6F FF call UTF8CharEnumerator::NextChar (5D561734h) | |
5DE6BD20 83 C4 0C add esp,0Ch | |
5DE6BD23 80 7D 0B 00 cmp byte ptr [ebp+0Bh],0 | |
5DE6BD27 75 35 jne nsCharSinkTraits<ConvertUTF8toUTF16>::write+6Fh (5DE6BD5Eh) | |
5DE6BD29 3D 00 00 01 00 cmp eax,10000h | |
5DE6BD2E 72 21 jb nsCharSinkTraits<ConvertUTF8toUTF16>::write+62h (5DE6BD51h) | |
5DE6BD30 8B C8 mov ecx,eax | |
5DE6BD32 C1 E9 0A shr ecx,0Ah | |
5DE6BD35 25 FF 03 00 00 and eax,3FFh | |
5DE6BD3A 81 E9 40 28 00 00 sub ecx,2840h | |
5DE6BD40 0D 00 DC 00 00 or eax,0DC00h | |
5DE6BD45 66 89 0E mov word ptr [esi],cx | |
5DE6BD48 66 89 46 02 mov word ptr [esi+2],ax | |
5DE6BD4C 83 C6 04 add esi,4 | |
5DE6BD4F EB 06 jmp nsCharSinkTraits<ConvertUTF8toUTF16>::write+68h (5DE6BD57h) | |
5DE6BD51 66 89 06 mov word ptr [esi],ax | |
5DE6BD54 83 C6 02 add esi,2 | |
5DE6BD57 39 5D FC cmp dword ptr [ebp-4],ebx | |
5DE6BD5A 75 B6 jne nsCharSinkTraits<ConvertUTF8toUTF16>::write+23h (5DE6BD12h) | |
5DE6BD5C EB 04 jmp nsCharSinkTraits<ConvertUTF8toUTF16>::write+73h (5DE6BD62h) | |
5DE6BD5E C6 47 08 01 mov byte ptr [edi+8],1 | |
5DE6BD62 89 77 04 mov dword ptr [edi+4],esi | |
5DE6BD65 5E pop esi | |
5DE6BD66 5B pop ebx | |
5DE6BD67 5F pop edi | |
} | |
5DE6BD68 C9 leave | |
5DE6BD69 C3 ret |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment