Chromium Code Reviews| Index: src/regexp-macro-assembler-ia32.cc |
| diff --git a/src/regexp-macro-assembler-ia32.cc b/src/regexp-macro-assembler-ia32.cc |
| index 516006dfaafc794cacaf4cd76a8f9f4d18617c18..72291082c5b3958e093afa929122b454d6a1b74d 100644 |
| --- a/src/regexp-macro-assembler-ia32.cc |
| +++ b/src/regexp-macro-assembler-ia32.cc |
| @@ -192,12 +192,13 @@ void RegExpMacroAssemblerIA32::CheckCharacters(Vector<const uc16> str, |
| __ mov(ebx, esi); |
| __ lea(edi, Operand(esi, edi, times_1, byte_offset)); |
| LoadConstantBufferAddress(esi, &constant_buffer); |
| - __ mov(ecx, str.length()); |
| - if (mode_ == ASCII) { |
| - __ rep_cmpsb(); |
| + if ((str.length() * char_size()) & 0x03 == 0) { |
| + // String content is a multiple of sizoef(uint32_t). |
| + __ mov(ecx, str.length() * char_size() >> 2); |
| + __ rep_cmpsl(); |
|
Erik Corry
2008/11/27 13:04:36
Premature optimization!
Did you get rid of ASCII m
|
| } else { |
| - ASSERT(mode_ == UC16); |
| - __ rep_cmpsw(); |
| + __ mov(ecx, str.length() * char_size()); |
| + __ rep_cmpsb(); |
| } |
| __ mov(esi, ebx); |
| __ mov(edi, eax); |
| @@ -232,7 +233,8 @@ void RegExpMacroAssemblerIA32::CheckNotBackReference( |
| if (mode_ == ASCII) { |
| __ rep_cmpsb(); |
|
Erik Corry
2008/11/27 13:04:36
One of the if bodies is a suffix of the other. Th
|
| } else { |
| - __ rep_cmpsw(); |
| + __ add(ecx, Operand(ecx)); |
| + __ rep_cmpsb(); |
| } |
| __ pop(esi); |
| __ mov(edi, Operand(ebx)); |