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

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

Issue 12644008: Fix white space matching in latin-1 strings wrt \u00a0. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 9 months 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 | Annotate | Revision Log
« no previous file with comments | « src/arm/regexp-macro-assembler-arm.cc ('k') | src/x64/regexp-macro-assembler-x64.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 592
593 593
594 bool RegExpMacroAssemblerIA32::CheckSpecialCharacterClass(uc16 type, 594 bool RegExpMacroAssemblerIA32::CheckSpecialCharacterClass(uc16 type,
595 Label* on_no_match) { 595 Label* on_no_match) {
596 // Range checks (c in min..max) are generally implemented by an unsigned 596 // Range checks (c in min..max) are generally implemented by an unsigned
597 // (c - min) <= (max - min) check 597 // (c - min) <= (max - min) check
598 switch (type) { 598 switch (type) {
599 case 's': 599 case 's':
600 // Match space-characters 600 // Match space-characters
601 if (mode_ == ASCII) { 601 if (mode_ == ASCII) {
602 // ASCII space characters are '\t'..'\r' and ' '. 602 // One byte space characters are '\t'..'\r', ' ' and \u00a0.
603 Label success; 603 Label success;
604 __ cmp(current_character(), ' '); 604 __ cmp(current_character(), ' ');
605 __ j(equal, &success); 605 __ j(equal, &success, Label::kNear);
606 // Check range 0x09..0x0d 606 // Check range 0x09..0x0d
607 __ lea(eax, Operand(current_character(), -'\t')); 607 __ lea(eax, Operand(current_character(), -'\t'));
608 __ cmp(eax, '\r' - '\t'); 608 __ cmp(eax, '\r' - '\t');
609 BranchOrBacktrack(above, on_no_match); 609 __ j(below_equal, &success, Label::kNear);
610 // \u00a0 (NBSP).
611 __ cmp(eax, 0x00a0 - '\t');
612 BranchOrBacktrack(not_equal, on_no_match);
610 __ bind(&success); 613 __ bind(&success);
611 return true; 614 return true;
612 } 615 }
613 return false; 616 return false;
614 case 'S': 617 case 'S':
615 // Match non-space characters. 618 // The emitted code for generic character classes is good enough.
616 if (mode_ == ASCII) {
617 // ASCII space characters are '\t'..'\r' and ' '.
618 __ cmp(current_character(), ' ');
619 BranchOrBacktrack(equal, on_no_match);
620 __ lea(eax, Operand(current_character(), -'\t'));
621 __ cmp(eax, '\r' - '\t');
622 BranchOrBacktrack(below_equal, on_no_match);
623 return true;
624 }
625 return false; 619 return false;
626 case 'd': 620 case 'd':
627 // Match ASCII digits ('0'..'9') 621 // Match ASCII digits ('0'..'9')
628 __ lea(eax, Operand(current_character(), -'0')); 622 __ lea(eax, Operand(current_character(), -'0'));
629 __ cmp(eax, '9' - '0'); 623 __ cmp(eax, '9' - '0');
630 BranchOrBacktrack(above, on_no_match); 624 BranchOrBacktrack(above, on_no_match);
631 return true; 625 return true;
632 case 'D': 626 case 'D':
633 // Match non ASCII-digits 627 // Match non ASCII-digits
634 __ lea(eax, Operand(current_character(), -'0')); 628 __ lea(eax, Operand(current_character(), -'0'));
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after
1411 } 1405 }
1412 1406
1413 1407
1414 #undef __ 1408 #undef __
1415 1409
1416 #endif // V8_INTERPRETED_REGEXP 1410 #endif // V8_INTERPRETED_REGEXP
1417 1411
1418 }} // namespace v8::internal 1412 }} // namespace v8::internal
1419 1413
1420 #endif // V8_TARGET_ARCH_IA32 1414 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/arm/regexp-macro-assembler-arm.cc ('k') | src/x64/regexp-macro-assembler-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698