Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(135)

Side by Side Diff: src/regexp-macro-assembler-ia32.cc

Issue 10795: Fixes to RegExp-IA32. (Closed)
Patch Set: Created 12 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2008 the V8 project authors. All rights reserved. 1 // Copyright 2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 } else { 185 } else {
186 memcpy(constant_buffer.location(), 186 memcpy(constant_buffer.location(),
187 str.start(), 187 str.start(),
188 str.length() * sizeof(uc16)); 188 str.length() * sizeof(uc16));
189 } 189 }
190 190
191 __ mov(eax, edi); 191 __ mov(eax, edi);
192 __ mov(ebx, esi); 192 __ mov(ebx, esi);
193 __ lea(edi, Operand(esi, edi, times_1, byte_offset)); 193 __ lea(edi, Operand(esi, edi, times_1, byte_offset));
194 LoadConstantBufferAddress(esi, &constant_buffer); 194 LoadConstantBufferAddress(esi, &constant_buffer);
195 __ mov(ecx, str.length()); 195 if ((str.length() * char_size()) & 0x03 == 0) {
196 if (mode_ == ASCII) { 196 // String content is a multiple of sizoef(uint32_t).
197 __ mov(ecx, str.length() * char_size() >> 2);
198 __ rep_cmpsl();
Erik Corry 2008/11/27 13:04:36 Premature optimization! Did you get rid of ASCII m
199 } else {
200 __ mov(ecx, str.length() * char_size());
197 __ rep_cmpsb(); 201 __ rep_cmpsb();
198 } else {
199 ASSERT(mode_ == UC16);
200 __ rep_cmpsw();
201 } 202 }
202 __ mov(esi, ebx); 203 __ mov(esi, ebx);
203 __ mov(edi, eax); 204 __ mov(edi, eax);
204 BranchOrBacktrack(not_equal, on_failure); 205 BranchOrBacktrack(not_equal, on_failure);
205 } 206 }
206 207
207 208
208 void RegExpMacroAssemblerIA32::CheckCurrentPosition(int register_index, 209 void RegExpMacroAssemblerIA32::CheckCurrentPosition(int register_index,
209 Label* on_equal) { 210 Label* on_equal) {
210 __ cmp(edi, register_location(register_index)); 211 __ cmp(edi, register_location(register_index));
(...skipping 12 matching lines...) Expand all
223 Label fallthrough; 224 Label fallthrough;
224 __ mov(eax, register_location(start_reg)); 225 __ mov(eax, register_location(start_reg));
225 __ mov(ecx, register_location(start_reg + 1)); 226 __ mov(ecx, register_location(start_reg + 1));
226 __ sub(ecx, Operand(eax)); // Length to check. 227 __ sub(ecx, Operand(eax)); // Length to check.
227 __ j(equal, &fallthrough); // Covers the case where it's not bound (-1,-1). 228 __ j(equal, &fallthrough); // Covers the case where it's not bound (-1,-1).
228 __ mov(ebx, Operand(edi)); 229 __ mov(ebx, Operand(edi));
229 __ push(esi); 230 __ push(esi);
230 __ add(edi, Operand(esi)); 231 __ add(edi, Operand(esi));
231 __ add(esi, Operand(eax)); 232 __ add(esi, Operand(eax));
232 if (mode_ == ASCII) { 233 if (mode_ == ASCII) {
233 __ rep_cmpsb(); 234 __ rep_cmpsb();
Erik Corry 2008/11/27 13:04:36 One of the if bodies is a suffix of the other. Th
234 } else { 235 } else {
235 __ rep_cmpsw(); 236 __ add(ecx, Operand(ecx));
237 __ rep_cmpsb();
236 } 238 }
237 __ pop(esi); 239 __ pop(esi);
238 __ mov(edi, Operand(ebx)); 240 __ mov(edi, Operand(ebx));
239 BranchOrBacktrack(not_equal, on_no_match); 241 BranchOrBacktrack(not_equal, on_no_match);
240 __ bind(&fallthrough); 242 __ bind(&fallthrough);
241 } 243 }
242 244
243 245
244 void RegExpMacroAssemblerIA32::CheckNotCharacter(uc16 c, Label* on_not_equal) { 246 void RegExpMacroAssemblerIA32::CheckNotCharacter(uc16 c, Label* on_not_equal) {
245 __ cmp(edx, c); 247 __ cmp(edx, c);
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 628
627 629
628 void RegExpMacroAssemblerIA32::LoadConstantBufferAddress(Register reg, 630 void RegExpMacroAssemblerIA32::LoadConstantBufferAddress(Register reg,
629 ArraySlice* buffer) { 631 ArraySlice* buffer) {
630 __ mov(reg, buffer->array()); 632 __ mov(reg, buffer->array());
631 __ add(Operand(reg), Immediate(buffer->base_offset())); 633 __ add(Operand(reg), Immediate(buffer->base_offset()));
632 } 634 }
633 635
634 #undef __ 636 #undef __
635 }} // namespace v8::internal 637 }} // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698