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

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

Issue 13090: Irregexp-ia32: Fixed backref-matching (works, and advances current position). (Closed)
Patch Set: git diff master 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
« no previous file with comments | « src/jsregexp.cc ('k') | test/cctest/test-regexp.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 __ bind(&fallthrough); 253 __ bind(&fallthrough);
254 } 254 }
255 255
256 256
257 void RegExpMacroAssemblerIA32::CheckNotBackReference( 257 void RegExpMacroAssemblerIA32::CheckNotBackReference(
258 int start_reg, Label* on_no_match) { 258 int start_reg, Label* on_no_match) {
259 Label fallthrough; 259 Label fallthrough;
260 __ mov(eax, register_location(start_reg)); 260 __ mov(eax, register_location(start_reg));
261 __ mov(ecx, register_location(start_reg + 1)); 261 __ mov(ecx, register_location(start_reg + 1));
262 __ sub(ecx, Operand(eax)); // Length to check. 262 __ sub(ecx, Operand(eax)); // Length to check.
263 __ j(less, on_no_match); 263 BranchOrBacktrack(less, on_no_match);
264 __ j(equal, &fallthrough); 264 __ j(equal, &fallthrough);
265 // check that there are sufficient characters left in the input 265 // Check that there are sufficient characters left in the input.
266 __ mov(ebx, edi); 266 __ mov(ebx, edi);
267 __ add(ebx, Operand(ecx)); 267 __ add(ebx, Operand(ecx));
268 __ j(greater, on_no_match); 268 BranchOrBacktrack(greater, on_no_match);
269 __ mov(ebx, Operand(edi)); 269
270 __ push(esi); 270 __ mov(ebx, edi);
271 __ mov(edx, esi);
271 __ add(edi, Operand(esi)); 272 __ add(edi, Operand(esi));
272 __ add(esi, Operand(eax)); 273 __ add(esi, Operand(eax));
273 __ rep_cmpsb(); 274 __ rep_cmpsb();
274 __ pop(esi); 275 __ mov(esi, edx);
275 __ mov(edi, Operand(ebx)); 276 Label success;
276 BranchOrBacktrack(not_equal, on_no_match); 277 __ j(equal, &success);
278 __ mov(edi, ebx);
279 BranchOrBacktrack(no_condition, on_no_match);
280
281 __ bind(&success);
282 __ sub(edi, Operand(esi));
283
277 __ bind(&fallthrough); 284 __ bind(&fallthrough);
278 } 285 }
279 286
280 287
281 void RegExpMacroAssemblerIA32::CheckNotRegistersEqual(int reg1, 288 void RegExpMacroAssemblerIA32::CheckNotRegistersEqual(int reg1,
282 int reg2, 289 int reg2,
283 Label* on_not_equal) { 290 Label* on_not_equal) {
284 __ mov(eax, register_location(reg1)); 291 __ mov(eax, register_location(reg1));
285 __ cmp(eax, register_location(reg2)); 292 __ cmp(eax, register_location(reg2));
286 BranchOrBacktrack(not_equal, on_not_equal); 293 BranchOrBacktrack(not_equal, on_not_equal);
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 void RegExpMacroAssemblerIA32::CheckStackLimit() { 629 void RegExpMacroAssemblerIA32::CheckStackLimit() {
623 if (FLAG_check_stack) { 630 if (FLAG_check_stack) {
624 // Check for preemption first. 631 // Check for preemption first.
625 Label no_preempt; 632 Label no_preempt;
626 Label retry_preempt; 633 Label retry_preempt;
627 // Check for preemption. 634 // Check for preemption.
628 ExternalReference stack_guard_limit = 635 ExternalReference stack_guard_limit =
629 ExternalReference::address_of_stack_guard_limit(); 636 ExternalReference::address_of_stack_guard_limit();
630 __ cmp(esp, Operand::StaticVariable(stack_guard_limit)); 637 __ cmp(esp, Operand::StaticVariable(stack_guard_limit));
631 __ j(above, &no_preempt, taken); 638 __ j(above, &no_preempt, taken);
632
633 __ push(edi); // Current position. 639 __ push(edi); // Current position.
634 __ push(edx); // Current character. 640 __ push(edx); // Current character.
635 // Restore original edi, esi. 641 // Restore original edi, esi.
636 __ mov(edi, Operand(ebp, kBackup_edi)); 642 __ mov(edi, Operand(ebp, kBackup_edi));
637 __ mov(esi, Operand(ebp, kBackup_esi)); 643 __ mov(esi, Operand(ebp, kBackup_esi));
638 644
639 __ bind(&retry_preempt); 645 __ bind(&retry_preempt);
640 // simulate stack for Runtime call. 646 // simulate stack for Runtime call.
641 __ push(eax); 647 __ push(eax);
642 __ push(Immediate(Smi::FromInt(0))); // Dummy receiver 648 __ push(Immediate(Smi::FromInt(0))); // Dummy receiver
(...skipping 26 matching lines...) Expand all
669 675
670 676
671 void RegExpMacroAssemblerIA32::LoadConstantBufferAddress(Register reg, 677 void RegExpMacroAssemblerIA32::LoadConstantBufferAddress(Register reg,
672 ArraySlice* buffer) { 678 ArraySlice* buffer) {
673 __ mov(reg, buffer->array()); 679 __ mov(reg, buffer->array());
674 __ add(Operand(reg), Immediate(buffer->base_offset())); 680 __ add(Operand(reg), Immediate(buffer->base_offset()));
675 } 681 }
676 682
677 #undef __ 683 #undef __
678 }} // namespace v8::internal 684 }} // namespace v8::internal
OLDNEW
« no previous file with comments | « src/jsregexp.cc ('k') | test/cctest/test-regexp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698