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

Side by Side Diff: src/arm/regexp-macro-assembler-arm.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 | « no previous file | src/ia32/regexp-macro-assembler-ia32.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 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 532
533 533
534 bool RegExpMacroAssemblerARM::CheckSpecialCharacterClass(uc16 type, 534 bool RegExpMacroAssemblerARM::CheckSpecialCharacterClass(uc16 type,
535 Label* on_no_match) { 535 Label* on_no_match) {
536 // Range checks (c in min..max) are generally implemented by an unsigned 536 // Range checks (c in min..max) are generally implemented by an unsigned
537 // (c - min) <= (max - min) check 537 // (c - min) <= (max - min) check
538 switch (type) { 538 switch (type) {
539 case 's': 539 case 's':
540 // Match space-characters 540 // Match space-characters
541 if (mode_ == ASCII) { 541 if (mode_ == ASCII) {
542 // ASCII space characters are '\t'..'\r' and ' '. 542 // One byte space characters are '\t'..'\r', ' ' and \u00a0.
543 Label success; 543 Label success;
544 __ cmp(current_character(), Operand(' ')); 544 __ cmp(current_character(), Operand(' '));
545 __ b(eq, &success); 545 __ b(eq, &success);
546 // Check range 0x09..0x0d 546 // Check range 0x09..0x0d
547 __ sub(r0, current_character(), Operand('\t')); 547 __ sub(r0, current_character(), Operand('\t'));
548 __ cmp(r0, Operand('\r' - '\t')); 548 __ cmp(r0, Operand('\r' - '\t'));
549 BranchOrBacktrack(hi, on_no_match); 549 __ b(ls, &success);
550 // \u00a0 (NBSP).
551 __ cmp(r0, Operand(0x00a0 - '\t'));
552 BranchOrBacktrack(ne, on_no_match);
550 __ bind(&success); 553 __ bind(&success);
551 return true; 554 return true;
552 } 555 }
553 return false; 556 return false;
554 case 'S': 557 case 'S':
555 // Match non-space characters. 558 // The emitted code for generic character classes is good enough.
556 if (mode_ == ASCII) {
557 // ASCII space characters are '\t'..'\r' and ' '.
558 __ cmp(current_character(), Operand(' '));
559 BranchOrBacktrack(eq, on_no_match);
560 __ sub(r0, current_character(), Operand('\t'));
561 __ cmp(r0, Operand('\r' - '\t'));
562 BranchOrBacktrack(ls, on_no_match);
563 return true;
564 }
565 return false; 559 return false;
566 case 'd': 560 case 'd':
567 // Match ASCII digits ('0'..'9') 561 // Match ASCII digits ('0'..'9')
568 __ sub(r0, current_character(), Operand('0')); 562 __ sub(r0, current_character(), Operand('0'));
569 __ cmp(current_character(), Operand('9' - '0')); 563 __ cmp(current_character(), Operand('9' - '0'));
570 BranchOrBacktrack(hi, on_no_match); 564 BranchOrBacktrack(hi, on_no_match);
571 return true; 565 return true;
572 case 'D': 566 case 'D':
573 // Match non ASCII-digits 567 // Match non ASCII-digits
574 __ sub(r0, current_character(), Operand('0')); 568 __ sub(r0, current_character(), Operand('0'));
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after
1420 __ ldr(pc, MemOperand(sp, stack_alignment, PostIndex)); 1414 __ ldr(pc, MemOperand(sp, stack_alignment, PostIndex));
1421 } 1415 }
1422 1416
1423 #undef __ 1417 #undef __
1424 1418
1425 #endif // V8_INTERPRETED_REGEXP 1419 #endif // V8_INTERPRETED_REGEXP
1426 1420
1427 }} // namespace v8::internal 1421 }} // namespace v8::internal
1428 1422
1429 #endif // V8_TARGET_ARCH_ARM 1423 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/ia32/regexp-macro-assembler-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698