OLD | NEW |
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 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 | 534 |
535 | 535 |
536 bool RegExpMacroAssemblerMIPS::CheckSpecialCharacterClass(uc16 type, | 536 bool RegExpMacroAssemblerMIPS::CheckSpecialCharacterClass(uc16 type, |
537 Label* on_no_match) { | 537 Label* on_no_match) { |
538 // Range checks (c in min..max) are generally implemented by an unsigned | 538 // Range checks (c in min..max) are generally implemented by an unsigned |
539 // (c - min) <= (max - min) check. | 539 // (c - min) <= (max - min) check. |
540 switch (type) { | 540 switch (type) { |
541 case 's': | 541 case 's': |
542 // Match space-characters. | 542 // Match space-characters. |
543 if (mode_ == ASCII) { | 543 if (mode_ == ASCII) { |
544 // ASCII space characters are '\t'..'\r' and ' '. | 544 // One byte space characters are '\t'..'\r', ' ' and \u00a0. |
545 Label success; | 545 Label success; |
546 __ Branch(&success, eq, current_character(), Operand(' ')); | 546 __ Branch(&success, eq, current_character(), Operand(' ')); |
547 // Check range 0x09..0x0d. | 547 // Check range 0x09..0x0d. |
548 __ Subu(a0, current_character(), Operand('\t')); | 548 __ Subu(a0, current_character(), Operand('\t')); |
549 BranchOrBacktrack(on_no_match, hi, a0, Operand('\r' - '\t')); | 549 __ Branch(&success, ls, a0, Operand('\r' - '\t')); |
| 550 // \u00a0 (NBSP). |
| 551 BranchOrBacktrack(on_no_match, ne, a0, Operand(0x00a0 - '\t')); |
550 __ bind(&success); | 552 __ bind(&success); |
551 return true; | 553 return true; |
552 } | 554 } |
553 return false; | 555 return false; |
554 case 'S': | 556 case 'S': |
555 // Match non-space characters. | 557 // The emitted code for generic character classes is good enough. |
556 if (mode_ == ASCII) { | |
557 // ASCII space characters are '\t'..'\r' and ' '. | |
558 BranchOrBacktrack(on_no_match, eq, current_character(), Operand(' ')); | |
559 __ Subu(a0, current_character(), Operand('\t')); | |
560 BranchOrBacktrack(on_no_match, ls, a0, Operand('\r' - '\t')); | |
561 return true; | |
562 } | |
563 return false; | 558 return false; |
564 case 'd': | 559 case 'd': |
565 // Match ASCII digits ('0'..'9'). | 560 // Match ASCII digits ('0'..'9'). |
566 __ Subu(a0, current_character(), Operand('0')); | 561 __ Subu(a0, current_character(), Operand('0')); |
567 BranchOrBacktrack(on_no_match, hi, a0, Operand('9' - '0')); | 562 BranchOrBacktrack(on_no_match, hi, a0, Operand('9' - '0')); |
568 return true; | 563 return true; |
569 case 'D': | 564 case 'D': |
570 // Match non ASCII-digits. | 565 // Match non ASCII-digits. |
571 __ Subu(a0, current_character(), Operand('0')); | 566 __ Subu(a0, current_character(), Operand('0')); |
572 BranchOrBacktrack(on_no_match, ls, a0, Operand('9' - '0')); | 567 BranchOrBacktrack(on_no_match, ls, a0, Operand('9' - '0')); |
(...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1388 } | 1383 } |
1389 | 1384 |
1390 | 1385 |
1391 #undef __ | 1386 #undef __ |
1392 | 1387 |
1393 #endif // V8_INTERPRETED_REGEXP | 1388 #endif // V8_INTERPRETED_REGEXP |
1394 | 1389 |
1395 }} // namespace v8::internal | 1390 }} // namespace v8::internal |
1396 | 1391 |
1397 #endif // V8_TARGET_ARCH_MIPS | 1392 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |