OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 BranchOrBacktrack(not_equal, on_not_equal); | 497 BranchOrBacktrack(not_equal, on_not_equal); |
498 } | 498 } |
499 | 499 |
500 | 500 |
501 void RegExpMacroAssemblerIA32::CheckCharacterAfterAnd(uint32_t c, | 501 void RegExpMacroAssemblerIA32::CheckCharacterAfterAnd(uint32_t c, |
502 uint32_t mask, | 502 uint32_t mask, |
503 Label* on_equal) { | 503 Label* on_equal) { |
504 if (c == 0) { | 504 if (c == 0) { |
505 __ test(current_character(), Immediate(mask)); | 505 __ test(current_character(), Immediate(mask)); |
506 } else { | 506 } else { |
507 __ mov(eax, current_character()); | 507 __ mov(eax, mask); |
508 __ and_(eax, mask); | 508 __ and_(eax, current_character()); |
509 __ cmp(eax, c); | 509 __ cmp(eax, c); |
510 } | 510 } |
511 BranchOrBacktrack(equal, on_equal); | 511 BranchOrBacktrack(equal, on_equal); |
512 } | 512 } |
513 | 513 |
514 | 514 |
515 void RegExpMacroAssemblerIA32::CheckNotCharacterAfterAnd(uint32_t c, | 515 void RegExpMacroAssemblerIA32::CheckNotCharacterAfterAnd(uint32_t c, |
516 uint32_t mask, | 516 uint32_t mask, |
517 Label* on_not_equal) { | 517 Label* on_not_equal) { |
518 if (c == 0) { | 518 if (c == 0) { |
519 __ test(current_character(), Immediate(mask)); | 519 __ test(current_character(), Immediate(mask)); |
520 } else { | 520 } else { |
521 __ mov(eax, current_character()); | 521 __ mov(eax, mask); |
522 __ and_(eax, mask); | 522 __ and_(eax, current_character()); |
523 __ cmp(eax, c); | 523 __ cmp(eax, c); |
524 } | 524 } |
525 BranchOrBacktrack(not_equal, on_not_equal); | 525 BranchOrBacktrack(not_equal, on_not_equal); |
526 } | 526 } |
527 | 527 |
528 | 528 |
529 void RegExpMacroAssemblerIA32::CheckNotCharacterAfterMinusAnd( | 529 void RegExpMacroAssemblerIA32::CheckNotCharacterAfterMinusAnd( |
530 uc16 c, | 530 uc16 c, |
531 uc16 minus, | 531 uc16 minus, |
532 uc16 mask, | 532 uc16 mask, |
(...skipping 29 matching lines...) Expand all Loading... |
562 BranchOrBacktrack(above, on_not_in_range); | 562 BranchOrBacktrack(above, on_not_in_range); |
563 } | 563 } |
564 | 564 |
565 | 565 |
566 void RegExpMacroAssemblerIA32::CheckBitInTable( | 566 void RegExpMacroAssemblerIA32::CheckBitInTable( |
567 Handle<ByteArray> table, | 567 Handle<ByteArray> table, |
568 Label* on_bit_set) { | 568 Label* on_bit_set) { |
569 __ mov(eax, Immediate(table)); | 569 __ mov(eax, Immediate(table)); |
570 Register index = current_character(); | 570 Register index = current_character(); |
571 if (mode_ != ASCII || kTableMask != String::kMaxAsciiCharCode) { | 571 if (mode_ != ASCII || kTableMask != String::kMaxAsciiCharCode) { |
572 __ mov(ebx, current_character()); | 572 __ mov(ebx, kTableSize - 1); |
573 __ and_(ebx, kTableSize - 1); | 573 __ and_(ebx, current_character()); |
574 index = ebx; | 574 index = ebx; |
575 } | 575 } |
576 __ cmpb(FieldOperand(eax, index, times_1, ByteArray::kHeaderSize), 0); | 576 __ cmpb(FieldOperand(eax, index, times_1, ByteArray::kHeaderSize), 0); |
577 BranchOrBacktrack(not_equal, on_bit_set); | 577 BranchOrBacktrack(not_equal, on_bit_set); |
578 } | 578 } |
579 | 579 |
580 | 580 |
581 bool RegExpMacroAssemblerIA32::CheckSpecialCharacterClass(uc16 type, | 581 bool RegExpMacroAssemblerIA32::CheckSpecialCharacterClass(uc16 type, |
582 Label* on_no_match) { | 582 Label* on_no_match) { |
583 // Range checks (c in min..max) are generally implemented by an unsigned | 583 // Range checks (c in min..max) are generally implemented by an unsigned |
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1328 } | 1328 } |
1329 | 1329 |
1330 | 1330 |
1331 #undef __ | 1331 #undef __ |
1332 | 1332 |
1333 #endif // V8_INTERPRETED_REGEXP | 1333 #endif // V8_INTERPRETED_REGEXP |
1334 | 1334 |
1335 }} // namespace v8::internal | 1335 }} // namespace v8::internal |
1336 | 1336 |
1337 #endif // V8_TARGET_ARCH_IA32 | 1337 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |