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 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
565 uc16 mask, | 565 uc16 mask, |
566 Label* on_not_equal) { | 566 Label* on_not_equal) { |
567 ASSERT(minus < String::kMaxUtf16CodeUnit); | 567 ASSERT(minus < String::kMaxUtf16CodeUnit); |
568 __ lea(rax, Operand(current_character(), -minus)); | 568 __ lea(rax, Operand(current_character(), -minus)); |
569 __ and_(rax, Immediate(mask)); | 569 __ and_(rax, Immediate(mask)); |
570 __ cmpl(rax, Immediate(c)); | 570 __ cmpl(rax, Immediate(c)); |
571 BranchOrBacktrack(not_equal, on_not_equal); | 571 BranchOrBacktrack(not_equal, on_not_equal); |
572 } | 572 } |
573 | 573 |
574 | 574 |
575 void RegExpMacroAssemblerX64::CheckCharacterInRange( | |
576 uc16 from, | |
577 uc16 to, | |
578 Label* on_in_range) { | |
579 __ lea(rax, Operand(current_character(), -from)); | |
580 __ cmpl(rax, Immediate(to - from)); | |
581 BranchOrBacktrack(below_equal, on_in_range); | |
582 } | |
583 | |
584 | |
585 void RegExpMacroAssemblerX64::CheckCharacterNotInRange( | |
586 uc16 from, | |
587 uc16 to, | |
588 Label* on_not_in_range) { | |
589 __ lea(rax, Operand(current_character(), -from)); | |
590 __ cmpl(rax, Immediate(to - from)); | |
591 BranchOrBacktrack(above, on_not_in_range); | |
592 } | |
593 | |
594 | |
595 void RegExpMacroAssemblerX64::CheckBitInTable( | |
596 Handle<ByteArray> table, | |
ulan
2012/03/27 11:02:43
Can't we use a packed table here too? Like in the
Erik Corry
2012/03/28 09:40:26
That would be slower.
| |
597 Label* on_bit_set) { | |
598 __ Move(rax, table); | |
599 __ movq(rbx, current_character()); | |
600 __ and_(rbx, Immediate(kTableSize - 1)); | |
ulan
2012/03/27 11:02:43
kTableMask instead of (kTableSize - 1) would be be
Erik Corry
2012/03/28 09:40:26
Done.
| |
601 __ cmpb(FieldOperand(rax, rbx, times_1, ByteArray::kHeaderSize), | |
602 Immediate(0)); | |
603 BranchOrBacktrack(not_equal, on_bit_set); | |
604 } | |
605 | |
606 | |
575 bool RegExpMacroAssemblerX64::CheckSpecialCharacterClass(uc16 type, | 607 bool RegExpMacroAssemblerX64::CheckSpecialCharacterClass(uc16 type, |
576 Label* on_no_match) { | 608 Label* on_no_match) { |
577 // Range checks (c in min..max) are generally implemented by an unsigned | 609 // Range checks (c in min..max) are generally implemented by an unsigned |
578 // (c - min) <= (max - min) check, using the sequence: | 610 // (c - min) <= (max - min) check, using the sequence: |
579 // lea(rax, Operand(current_character(), -min)) or sub(rax, Immediate(min)) | 611 // lea(rax, Operand(current_character(), -min)) or sub(rax, Immediate(min)) |
580 // cmp(rax, Immediate(max - min)) | 612 // cmp(rax, Immediate(max - min)) |
581 switch (type) { | 613 switch (type) { |
582 case 's': | 614 case 's': |
583 // Match space-characters | 615 // Match space-characters |
584 if (mode_ == ASCII) { | 616 if (mode_ == ASCII) { |
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1416 } | 1448 } |
1417 } | 1449 } |
1418 | 1450 |
1419 #undef __ | 1451 #undef __ |
1420 | 1452 |
1421 #endif // V8_INTERPRETED_REGEXP | 1453 #endif // V8_INTERPRETED_REGEXP |
1422 | 1454 |
1423 }} // namespace v8::internal | 1455 }} // namespace v8::internal |
1424 | 1456 |
1425 #endif // V8_TARGET_ARCH_X64 | 1457 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |