Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 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 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 575 Factory::NewStringFromAscii(CStrVector("barfoo")); | 575 Factory::NewStringFromAscii(CStrVector("barfoo")); |
| 576 Handle<String> f2_16 = RegExpImpl::StringToTwoByte(f2); | 576 Handle<String> f2_16 = RegExpImpl::StringToTwoByte(f2); |
| 577 CHECK(!IrregexpInterpreter::Match(array, f2_16, captures, 0)); | 577 CHECK(!IrregexpInterpreter::Match(array, f2_16, captures, 0)); |
| 578 CHECK_EQ(42, captures[0]); | 578 CHECK_EQ(42, captures[0]); |
| 579 } | 579 } |
| 580 | 580 |
| 581 | 581 |
| 582 #ifndef ARM // IA32 only tests. | 582 #ifndef ARM // IA32 only tests. |
| 583 | 583 |
| 584 TEST(MacroAssemblerIA32Success) { | 584 TEST(MacroAssemblerIA32Success) { |
| 585 typedef bool (*AsciiTest) ( | |
| 586 SeqAsciiString** base, int start_index, int end_index, int* captures); | |
| 587 | |
| 588 V8::Initialize(NULL); | 585 V8::Initialize(NULL); |
| 589 | 586 |
| 590 // regexp-macro-assembler-ia32 needs a handle scope to allocate | 587 // regexp-macro-assembler-ia32 needs a handle scope to allocate |
| 591 // byte-arrays for constants. | 588 // byte-arrays for constants. |
| 592 v8::HandleScope scope; | 589 v8::HandleScope scope; |
| 593 | 590 |
| 594 RegExpMacroAssemblerIA32 m(RegExpMacroAssemblerIA32::ASCII, 4); | 591 RegExpMacroAssemblerIA32 m(RegExpMacroAssemblerIA32::ASCII, 4); |
| 595 | 592 |
| 596 m.Succeed(); | 593 m.Succeed(); |
| 597 | 594 |
| 598 Handle<Object> code_object = m.GetCode(); | 595 Handle<Object> code_object = m.GetCode(); |
| 599 Handle<Code> code = Handle<Code>::cast(code_object); | 596 Handle<Code> code = Handle<Code>::cast(code_object); |
| 600 AsciiTest test = FUNCTION_CAST<AsciiTest>(code->entry()); | |
| 601 | 597 |
| 602 int captures[4] = {42, 37, 87, 117}; | 598 int captures[4] = {42, 37, 87, 117}; |
| 603 Handle<String> input = Factory::NewStringFromAscii(CStrVector("foofoo")); | 599 Handle<String> input = Factory::NewStringFromAscii(CStrVector("foofoo")); |
| 604 Handle<SeqAsciiString> seq_input = Handle<SeqAsciiString>::cast(input); | 600 Handle<SeqAsciiString> seq_input = Handle<SeqAsciiString>::cast(input); |
| 605 Address start_adr = seq_input->GetCharsAddress(); | 601 Address start_adr = seq_input->GetCharsAddress(); |
| 606 int start_offset = start_adr - reinterpret_cast<Address>(*seq_input); | 602 int start_offset = start_adr - reinterpret_cast<Address>(*seq_input); |
| 607 int end_offset = start_offset + seq_input->length(); | 603 int end_offset = start_offset + seq_input->length(); |
| 608 | 604 |
| 609 bool success = | 605 bool success = RegExpMacroAssemblerIA32::Execute( |
| 610 test(seq_input.location(), start_offset, end_offset, captures); | 606 *code, seq_input.location(), start_offset, end_offset, captures, true); |
|
Erik Corry
2008/11/30 19:39:27
Although the style guide is not strict on this poi
Lasse Reichstein
2008/12/04 15:18:37
Done.
| |
| 611 | 607 |
| 612 CHECK(success); | 608 CHECK(success); |
| 613 CHECK_EQ(-1, captures[0]); | 609 CHECK_EQ(-1, captures[0]); |
| 614 CHECK_EQ(-1, captures[1]); | 610 CHECK_EQ(-1, captures[1]); |
| 615 CHECK_EQ(-1, captures[2]); | 611 CHECK_EQ(-1, captures[2]); |
| 616 CHECK_EQ(-1, captures[3]); | 612 CHECK_EQ(-1, captures[3]); |
| 617 } | 613 } |
| 618 | 614 |
| 619 | 615 |
| 620 TEST(MacroAssemblerIA32Simple) { | 616 TEST(MacroAssemblerIA32Simple) { |
| 621 typedef bool (*AsciiTest) ( | |
| 622 SeqAsciiString** base, int start_index, int end_index, int* captures); | |
| 623 | |
| 624 V8::Initialize(NULL); | 617 V8::Initialize(NULL); |
| 625 | 618 |
| 626 // regexp-macro-assembler-ia32 needs a handle scope to allocate | 619 // regexp-macro-assembler-ia32 needs a handle scope to allocate |
| 627 // byte-arrays for constants. | 620 // byte-arrays for constants. |
| 628 v8::HandleScope scope; | 621 v8::HandleScope scope; |
| 629 | 622 |
| 630 RegExpMacroAssemblerIA32 m(RegExpMacroAssemblerIA32::ASCII, 4); | 623 RegExpMacroAssemblerIA32 m(RegExpMacroAssemblerIA32::ASCII, 4); |
| 631 | 624 |
| 632 uc16 foo_chars[3] = {'f', 'o', 'o'}; | 625 uc16 foo_chars[3] = {'f', 'o', 'o'}; |
| 633 Vector<const uc16> foo(foo_chars, 3); | 626 Vector<const uc16> foo(foo_chars, 3); |
| 634 | 627 |
| 635 Label fail; | 628 Label fail; |
| 636 m.CheckCharacters(foo, 0, &fail); | 629 m.CheckCharacters(foo, 0, &fail); |
| 637 m.WriteCurrentPositionToRegister(0); | 630 m.WriteCurrentPositionToRegister(0); |
| 638 m.AdvanceCurrentPosition(3); | 631 m.AdvanceCurrentPosition(3); |
| 639 m.WriteCurrentPositionToRegister(1); | 632 m.WriteCurrentPositionToRegister(1); |
| 640 m.Succeed(); | 633 m.Succeed(); |
| 641 m.Bind(&fail); | 634 m.Bind(&fail); |
| 642 m.Fail(); | 635 m.Fail(); |
| 643 | 636 |
| 644 Handle<Object> code_object = m.GetCode(); | 637 Handle<Object> code_object = m.GetCode(); |
| 645 Handle<Code> code = Handle<Code>::cast(code_object); | 638 Handle<Code> code = Handle<Code>::cast(code_object); |
| 646 AsciiTest test = FUNCTION_CAST<AsciiTest>(code->entry()); | |
| 647 | 639 |
| 648 int captures[4] = {42, 37, 87, 117}; | 640 int captures[4] = {42, 37, 87, 117}; |
| 649 Handle<String> input = Factory::NewStringFromAscii(CStrVector("foofoo")); | 641 Handle<String> input = Factory::NewStringFromAscii(CStrVector("foofoo")); |
| 650 Handle<SeqAsciiString> seq_input = Handle<SeqAsciiString>::cast(input); | 642 Handle<SeqAsciiString> seq_input = Handle<SeqAsciiString>::cast(input); |
| 651 Address start_adr = seq_input->GetCharsAddress(); | 643 Address start_adr = seq_input->GetCharsAddress(); |
| 652 int start_offset = start_adr - reinterpret_cast<Address>(*seq_input); | 644 int start_offset = start_adr - reinterpret_cast<Address>(*seq_input); |
| 653 int end_offset = start_offset + seq_input->length(); | 645 int end_offset = start_offset + seq_input->length(); |
| 654 | 646 |
| 655 bool success = | 647 bool success = RegExpMacroAssemblerIA32::Execute( |
| 656 test(seq_input.location(), start_offset, end_offset, captures); | 648 *code, seq_input.location(), start_offset, end_offset, captures, true); |
| 657 | 649 |
| 658 CHECK(success); | 650 CHECK(success); |
| 659 CHECK_EQ(0, captures[0]); | 651 CHECK_EQ(0, captures[0]); |
| 660 CHECK_EQ(3, captures[1]); | 652 CHECK_EQ(3, captures[1]); |
| 661 CHECK_EQ(-1, captures[2]); | 653 CHECK_EQ(-1, captures[2]); |
| 662 CHECK_EQ(-1, captures[3]); | 654 CHECK_EQ(-1, captures[3]); |
| 663 | 655 |
| 664 input = Factory::NewStringFromAscii(CStrVector("barbarbar")); | 656 input = Factory::NewStringFromAscii(CStrVector("barbarbar")); |
| 665 seq_input = Handle<SeqAsciiString>::cast(input); | 657 seq_input = Handle<SeqAsciiString>::cast(input); |
| 666 start_adr = seq_input->GetCharsAddress(); | 658 start_adr = seq_input->GetCharsAddress(); |
| 667 start_offset = start_adr - reinterpret_cast<Address>(*seq_input); | 659 start_offset = start_adr - reinterpret_cast<Address>(*seq_input); |
| 668 end_offset = start_offset + seq_input->length(); | 660 end_offset = start_offset + seq_input->length(); |
| 669 | 661 |
| 670 success = test(seq_input.location(), start_offset, end_offset, captures); | 662 success = RegExpMacroAssemblerIA32::Execute( |
| 663 *code, seq_input.location(), start_offset, end_offset, captures, true); | |
| 671 | 664 |
| 672 CHECK(!success); | 665 CHECK(!success); |
| 673 } | 666 } |
| 674 | 667 |
| 675 | 668 |
| 676 TEST(MacroAssemblerIA32SimpleUC16) { | 669 TEST(MacroAssemblerIA32SimpleUC16) { |
| 677 typedef bool (*UC16Test) ( | |
| 678 SeqTwoByteString** base, int start_index, int end_index, int* captures); | |
| 679 | |
| 680 V8::Initialize(NULL); | 670 V8::Initialize(NULL); |
| 681 | 671 |
| 682 // regexp-macro-assembler-ia32 needs a handle scope to allocate | 672 // regexp-macro-assembler-ia32 needs a handle scope to allocate |
| 683 // byte-arrays for constants. | 673 // byte-arrays for constants. |
| 684 v8::HandleScope scope; | 674 v8::HandleScope scope; |
| 685 | 675 |
| 686 RegExpMacroAssemblerIA32 m(RegExpMacroAssemblerIA32::UC16, 4); | 676 RegExpMacroAssemblerIA32 m(RegExpMacroAssemblerIA32::UC16, 4); |
| 687 | 677 |
| 688 uc16 foo_chars[3] = {'f', 'o', 'o'}; | 678 uc16 foo_chars[3] = {'f', 'o', 'o'}; |
| 689 Vector<const uc16> foo(foo_chars, 3); | 679 Vector<const uc16> foo(foo_chars, 3); |
| 690 | 680 |
| 691 Label fail; | 681 Label fail; |
| 692 m.CheckCharacters(foo, 0, &fail); | 682 m.CheckCharacters(foo, 0, &fail); |
| 693 m.WriteCurrentPositionToRegister(0); | 683 m.WriteCurrentPositionToRegister(0); |
| 694 m.AdvanceCurrentPosition(3); | 684 m.AdvanceCurrentPosition(3); |
| 695 m.WriteCurrentPositionToRegister(1); | 685 m.WriteCurrentPositionToRegister(1); |
| 696 m.Succeed(); | 686 m.Succeed(); |
| 697 m.Bind(&fail); | 687 m.Bind(&fail); |
| 698 m.Fail(); | 688 m.Fail(); |
| 699 | 689 |
| 700 Handle<Object> code_object = m.GetCode(); | 690 Handle<Object> code_object = m.GetCode(); |
| 701 Handle<Code> code = Handle<Code>::cast(code_object); | 691 Handle<Code> code = Handle<Code>::cast(code_object); |
| 702 UC16Test test = FUNCTION_CAST<UC16Test>(code->entry()); | |
| 703 | 692 |
| 704 int captures[4] = {42, 37, 87, 117}; | 693 int captures[4] = {42, 37, 87, 117}; |
| 705 const uc16 input_data[6] = {'f', 'o', 'o', 'f', 'o', '\xa0'}; | 694 const uc16 input_data[6] = {'f', 'o', 'o', 'f', 'o', '\xa0'}; |
| 706 Handle<String> input = | 695 Handle<String> input = |
| 707 Factory::NewStringFromTwoByte(Vector<const uc16>(input_data, 6)); | 696 Factory::NewStringFromTwoByte(Vector<const uc16>(input_data, 6)); |
| 708 Handle<SeqTwoByteString> seq_input = Handle<SeqTwoByteString>::cast(input); | 697 Handle<SeqTwoByteString> seq_input = Handle<SeqTwoByteString>::cast(input); |
| 709 Address start_adr = seq_input->GetCharsAddress(); | 698 Address start_adr = seq_input->GetCharsAddress(); |
| 710 int start_offset = start_adr - reinterpret_cast<Address>(*seq_input); | 699 int start_offset = start_adr - reinterpret_cast<Address>(*seq_input); |
| 711 int end_offset = start_offset + seq_input->length() * sizeof(uc16); | 700 int end_offset = start_offset + seq_input->length() * sizeof(uc16); |
| 712 | 701 |
| 713 bool success = | 702 bool success = RegExpMacroAssemblerIA32::Execute( |
| 714 test(seq_input.location(), start_offset, end_offset, captures); | 703 *code, seq_input.location(), start_offset, end_offset, captures, true); |
| 715 | 704 |
| 716 CHECK(success); | 705 CHECK(success); |
| 717 CHECK_EQ(0, captures[0]); | 706 CHECK_EQ(0, captures[0]); |
| 718 CHECK_EQ(3, captures[1]); | 707 CHECK_EQ(3, captures[1]); |
| 719 CHECK_EQ(-1, captures[2]); | 708 CHECK_EQ(-1, captures[2]); |
| 720 CHECK_EQ(-1, captures[3]); | 709 CHECK_EQ(-1, captures[3]); |
| 721 | 710 |
| 722 const uc16 input_data2[9] = {'b', 'a', 'r', 'b', 'a', 'r', 'b', 'a', '\xa0'}; | 711 const uc16 input_data2[9] = {'b', 'a', 'r', 'b', 'a', 'r', 'b', 'a', '\xa0'}; |
| 723 input = Factory::NewStringFromTwoByte(Vector<const uc16>(input_data2, 9)); | 712 input = Factory::NewStringFromTwoByte(Vector<const uc16>(input_data2, 9)); |
| 724 seq_input = Handle<SeqTwoByteString>::cast(input); | 713 seq_input = Handle<SeqTwoByteString>::cast(input); |
| 725 start_adr = seq_input->GetCharsAddress(); | 714 start_adr = seq_input->GetCharsAddress(); |
| 726 start_offset = start_adr - reinterpret_cast<Address>(*seq_input); | 715 start_offset = start_adr - reinterpret_cast<Address>(*seq_input); |
| 727 end_offset = start_offset + seq_input->length() * sizeof(uc16); | 716 end_offset = start_offset + seq_input->length() * sizeof(uc16); |
| 728 | 717 |
| 729 success = test(seq_input.location(), start_offset, end_offset, captures); | 718 success = RegExpMacroAssemblerIA32::Execute( |
| 719 *code, seq_input.location(), start_offset, end_offset, captures, true); | |
| 730 | 720 |
| 731 CHECK(!success); | 721 CHECK(!success); |
| 732 } | 722 } |
| 733 | 723 |
| 734 | 724 |
| 735 TEST(MacroAssemblerIA32Backtrack) { | 725 TEST(MacroAssemblerIA32Backtrack) { |
| 736 typedef bool (*AsciiTest) ( | |
| 737 SeqAsciiString** base, int start_index, int end_index, int* captures); | |
| 738 | |
| 739 V8::Initialize(NULL); | 726 V8::Initialize(NULL); |
| 740 | 727 |
| 741 // regexp-macro-assembler-ia32 needs a handle scope to allocate | 728 // regexp-macro-assembler-ia32 needs a handle scope to allocate |
| 742 // byte-arrays for constants. | 729 // byte-arrays for constants. |
| 743 v8::HandleScope scope; | 730 v8::HandleScope scope; |
| 744 | 731 |
| 745 RegExpMacroAssemblerIA32 m(RegExpMacroAssemblerIA32::ASCII, 0); | 732 RegExpMacroAssemblerIA32 m(RegExpMacroAssemblerIA32::ASCII, 0); |
| 746 | 733 |
| 747 uc16 foo_chars[3] = {'f', 'o', 'o'}; | 734 uc16 foo_chars[3] = {'f', 'o', 'o'}; |
| 748 Vector<const uc16> foo(foo_chars, 3); | 735 Vector<const uc16> foo(foo_chars, 3); |
| 749 | 736 |
| 750 Label fail; | 737 Label fail; |
| 751 Label backtrack; | 738 Label backtrack; |
| 752 m.LoadCurrentCharacter(10, &fail); | 739 m.LoadCurrentCharacter(10, &fail); |
| 753 m.Succeed(); | 740 m.Succeed(); |
| 754 m.Bind(&fail); | 741 m.Bind(&fail); |
| 755 m.PushBacktrack(&backtrack); | 742 m.PushBacktrack(&backtrack); |
| 756 m.LoadCurrentCharacter(10, NULL); | 743 m.LoadCurrentCharacter(10, NULL); |
| 757 m.Succeed(); | 744 m.Succeed(); |
| 758 m.Bind(&backtrack); | 745 m.Bind(&backtrack); |
| 759 m.Fail(); | 746 m.Fail(); |
| 760 | 747 |
| 761 Handle<Object> code_object = m.GetCode(); | 748 Handle<Object> code_object = m.GetCode(); |
| 762 Handle<Code> code = Handle<Code>::cast(code_object); | 749 Handle<Code> code = Handle<Code>::cast(code_object); |
| 763 AsciiTest test = FUNCTION_CAST<AsciiTest>(code->entry()); | |
| 764 | 750 |
| 765 Handle<String> input = Factory::NewStringFromAscii(CStrVector("foofoo")); | 751 Handle<String> input = Factory::NewStringFromAscii(CStrVector("foofoo")); |
| 766 Handle<SeqAsciiString> seq_input = Handle<SeqAsciiString>::cast(input); | 752 Handle<SeqAsciiString> seq_input = Handle<SeqAsciiString>::cast(input); |
| 767 Address start_adr = seq_input->GetCharsAddress(); | 753 Address start_adr = seq_input->GetCharsAddress(); |
| 768 int start_offset = start_adr - reinterpret_cast<Address>(*seq_input); | 754 int start_offset = start_adr - reinterpret_cast<Address>(*seq_input); |
| 769 int end_offset = start_offset + seq_input->length(); | 755 int end_offset = start_offset + seq_input->length(); |
| 770 | 756 |
| 771 bool success = | 757 bool success = RegExpMacroAssemblerIA32::Execute( |
| 772 test(seq_input.location(), start_offset, end_offset, NULL); | 758 *code, seq_input.location(), start_offset, end_offset, NULL, true); |
| 759 | |
| 760 CHECK(!success); | |
| 761 } | |
| 762 | |
| 763 TEST(MacroAssemblerIA32AtStart) { | |
| 764 V8::Initialize(NULL); | |
| 765 | |
| 766 // regexp-macro-assembler-ia32 needs a handle scope to allocate | |
| 767 // byte-arrays for constants. | |
| 768 v8::HandleScope scope; | |
| 769 | |
| 770 RegExpMacroAssemblerIA32 m(RegExpMacroAssemblerIA32::ASCII, 0); | |
| 771 | |
| 772 uc16 foo_chars[3] = {'f', 'o', 'o'}; | |
| 773 Vector<const uc16> foo(foo_chars, 3); | |
| 774 | |
| 775 // RegExp: /^foo/ | |
| 776 Label fail; | |
| 777 m.CheckNotAtStart(&fail); | |
| 778 m.CheckCharacters(foo, 0, &fail); | |
| 779 m.Succeed(); | |
| 780 m.Bind(&fail); | |
| 781 m.Fail(); | |
| 782 | |
| 783 Handle<Object> code_object = m.GetCode(); | |
| 784 Handle<Code> code = Handle<Code>::cast(code_object); | |
| 785 | |
| 786 Handle<String> input = Factory::NewStringFromAscii(CStrVector("foofoo")); | |
| 787 Handle<SeqAsciiString> seq_input = Handle<SeqAsciiString>::cast(input); | |
| 788 Address start_adr = seq_input->GetCharsAddress(); | |
| 789 int start_offset = start_adr - reinterpret_cast<Address>(*seq_input); | |
| 790 int end_offset = start_offset + seq_input->length(); | |
| 791 | |
| 792 bool success = RegExpMacroAssemblerIA32::Execute( | |
| 793 *code, seq_input.location(), start_offset, end_offset, NULL, true); | |
| 794 | |
| 795 CHECK(success); | |
| 796 | |
| 797 start_offset += 3; | |
| 798 success = RegExpMacroAssemblerIA32::Execute( | |
| 799 *code, seq_input.location(), start_offset, end_offset, NULL, false); | |
| 773 | 800 |
| 774 CHECK(!success); | 801 CHECK(!success); |
| 775 } | 802 } |
| 776 | 803 |
| 777 | 804 |
| 805 | |
| 778 TEST(MacroAssemblerIA32Registers) { | 806 TEST(MacroAssemblerIA32Registers) { |
| 779 typedef bool (*AsciiTest) ( | |
| 780 SeqAsciiString** base, int start_index, int end_index, int* captures); | |
| 781 | |
| 782 V8::Initialize(NULL); | 807 V8::Initialize(NULL); |
| 783 | 808 |
| 784 // regexp-macro-assembler-ia32 needs a handle scope to allocate | 809 // regexp-macro-assembler-ia32 needs a handle scope to allocate |
| 785 // byte-arrays for constants. | 810 // byte-arrays for constants. |
| 786 v8::HandleScope scope; | 811 v8::HandleScope scope; |
| 787 | 812 |
| 788 RegExpMacroAssemblerIA32 m(RegExpMacroAssemblerIA32::ASCII, 5); | 813 RegExpMacroAssemblerIA32 m(RegExpMacroAssemblerIA32::ASCII, 5); |
| 789 | 814 |
| 790 uc16 foo_chars[3] = {'f', 'o', 'o'}; | 815 uc16 foo_chars[3] = {'f', 'o', 'o'}; |
| 791 Vector<const uc16> foo(foo_chars, 3); | 816 Vector<const uc16> foo(foo_chars, 3); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 843 m.Bind(&exit_loop3); | 868 m.Bind(&exit_loop3); |
| 844 m.WriteCurrentPositionToRegister(out5); // [0,3,6,9,9] | 869 m.WriteCurrentPositionToRegister(out5); // [0,3,6,9,9] |
| 845 | 870 |
| 846 m.Succeed(); | 871 m.Succeed(); |
| 847 | 872 |
| 848 m.Bind(&fail); | 873 m.Bind(&fail); |
| 849 m.Fail(); | 874 m.Fail(); |
| 850 | 875 |
| 851 Handle<Object> code_object = m.GetCode(); | 876 Handle<Object> code_object = m.GetCode(); |
| 852 Handle<Code> code = Handle<Code>::cast(code_object); | 877 Handle<Code> code = Handle<Code>::cast(code_object); |
| 853 AsciiTest test = FUNCTION_CAST<AsciiTest>(code->entry()); | |
| 854 | 878 |
| 855 // String long enough for test (content doesn't matter). | 879 // String long enough for test (content doesn't matter). |
| 856 Handle<String> input = | 880 Handle<String> input = |
| 857 Factory::NewStringFromAscii(CStrVector("foofoofoofoofoo")); | 881 Factory::NewStringFromAscii(CStrVector("foofoofoofoofoo")); |
| 858 Handle<SeqAsciiString> seq_input = Handle<SeqAsciiString>::cast(input); | 882 Handle<SeqAsciiString> seq_input = Handle<SeqAsciiString>::cast(input); |
| 859 Address start_adr = seq_input->GetCharsAddress(); | 883 Address start_adr = seq_input->GetCharsAddress(); |
| 860 int start_offset = start_adr - reinterpret_cast<Address>(*seq_input); | 884 int start_offset = start_adr - reinterpret_cast<Address>(*seq_input); |
| 861 int end_offset = start_offset + seq_input->length(); | 885 int end_offset = start_offset + seq_input->length(); |
| 862 | 886 |
| 863 int output[5]; | 887 int output[5]; |
| 864 bool success = | 888 bool success = RegExpMacroAssemblerIA32::Execute( |
| 865 test(seq_input.location(), start_offset, end_offset, output); | 889 *code, seq_input.location(), start_offset, end_offset, output, true); |
| 866 | 890 |
| 867 CHECK(success); | 891 CHECK(success); |
| 868 CHECK_EQ(0, output[0]); | 892 CHECK_EQ(0, output[0]); |
| 869 CHECK_EQ(3, output[1]); | 893 CHECK_EQ(3, output[1]); |
| 870 CHECK_EQ(6, output[2]); | 894 CHECK_EQ(6, output[2]); |
| 871 CHECK_EQ(9, output[3]); | 895 CHECK_EQ(9, output[3]); |
| 872 CHECK_EQ(9, output[4]); | 896 CHECK_EQ(9, output[4]); |
| 873 } | 897 } |
| 874 | 898 |
| 875 #endif // !defined ARM | 899 #endif // !defined ARM |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1083 // whole block at a time. | 1107 // whole block at a time. |
| 1084 TestSimpleRangeCaseIndependence(CharacterRange('A', 'k'), | 1108 TestSimpleRangeCaseIndependence(CharacterRange('A', 'k'), |
| 1085 CharacterRange('a', 'z')); | 1109 CharacterRange('a', 'z')); |
| 1086 } | 1110 } |
| 1087 | 1111 |
| 1088 | 1112 |
| 1089 TEST(Graph) { | 1113 TEST(Graph) { |
| 1090 V8::Initialize(NULL); | 1114 V8::Initialize(NULL); |
| 1091 Execute("foo$(?!bar)", false, true); | 1115 Execute("foo$(?!bar)", false, true); |
| 1092 } | 1116 } |
| OLD | NEW |