Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-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 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 713 CHECK_EQ(84, captures[4]); | 713 CHECK_EQ(84, captures[4]); |
| 714 | 714 |
| 715 Handle<String> f2 = | 715 Handle<String> f2 = |
| 716 Factory::NewStringFromAscii(CStrVector("barfoo")); | 716 Factory::NewStringFromAscii(CStrVector("barfoo")); |
| 717 Handle<String> f2_16 = RegExpImpl::StringToTwoByte(f2); | 717 Handle<String> f2_16 = RegExpImpl::StringToTwoByte(f2); |
| 718 CHECK(!IrregexpInterpreter::Match(array, f2_16, captures, 0)); | 718 CHECK(!IrregexpInterpreter::Match(array, f2_16, captures, 0)); |
| 719 CHECK_EQ(42, captures[0]); | 719 CHECK_EQ(42, captures[0]); |
| 720 } | 720 } |
| 721 | 721 |
| 722 | 722 |
| 723 IA32TEST(MacroAssemblerIA32Success) { | 723 #if !(defined(ARM) || defined(__arm__) || defined(__thumb__)) |
|
iposva
2008/11/25 15:44:10
It should be sufficient to only test for "defined(
| |
| 724 | |
| 725 TEST(MacroAssemblerIA32Success) { | |
| 724 typedef bool (*AsciiTest) ( | 726 typedef bool (*AsciiTest) ( |
| 725 SeqAsciiString** base, int start_index, int end_index, int* captures); | 727 SeqAsciiString** base, int start_index, int end_index, int* captures); |
| 726 | 728 |
| 727 V8::Initialize(NULL); | 729 V8::Initialize(NULL); |
| 728 | 730 |
| 729 // regexp-macro-assembler-ia32 needs a handle scope to allocate | 731 // regexp-macro-assembler-ia32 needs a handle scope to allocate |
| 730 // byte-arrays for constants. | 732 // byte-arrays for constants. |
| 731 v8::HandleScope scope; | 733 v8::HandleScope scope; |
| 732 | 734 |
| 733 RegExpMacroAssemblerIA32 m(RegExpMacroAssemblerIA32::ASCII, 4); | 735 RegExpMacroAssemblerIA32 m(RegExpMacroAssemblerIA32::ASCII, 4); |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 749 test(seq_input.location(), start_offset, end_offset, captures); | 751 test(seq_input.location(), start_offset, end_offset, captures); |
| 750 | 752 |
| 751 CHECK(success); | 753 CHECK(success); |
| 752 CHECK_EQ(-1, captures[0]); | 754 CHECK_EQ(-1, captures[0]); |
| 753 CHECK_EQ(-1, captures[1]); | 755 CHECK_EQ(-1, captures[1]); |
| 754 CHECK_EQ(-1, captures[2]); | 756 CHECK_EQ(-1, captures[2]); |
| 755 CHECK_EQ(-1, captures[3]); | 757 CHECK_EQ(-1, captures[3]); |
| 756 } | 758 } |
| 757 | 759 |
| 758 | 760 |
| 759 IA32TEST(MacroAssemblerIA32Simple) { | 761 TEST(MacroAssemblerIA32Simple) { |
| 760 typedef bool (*AsciiTest) ( | 762 typedef bool (*AsciiTest) ( |
| 761 SeqAsciiString** base, int start_index, int end_index, int* captures); | 763 SeqAsciiString** base, int start_index, int end_index, int* captures); |
| 762 | 764 |
| 763 V8::Initialize(NULL); | 765 V8::Initialize(NULL); |
| 764 | 766 |
| 765 // regexp-macro-assembler-ia32 needs a handle scope to allocate | 767 // regexp-macro-assembler-ia32 needs a handle scope to allocate |
| 766 // byte-arrays for constants. | 768 // byte-arrays for constants. |
| 767 v8::HandleScope scope; | 769 v8::HandleScope scope; |
| 768 | 770 |
| 769 RegExpMacroAssemblerIA32 m(RegExpMacroAssemblerIA32::ASCII, 4); | 771 RegExpMacroAssemblerIA32 m(RegExpMacroAssemblerIA32::ASCII, 4); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 805 start_adr = seq_input->GetCharsAddress(); | 807 start_adr = seq_input->GetCharsAddress(); |
| 806 start_offset = start_adr - reinterpret_cast<Address>(*seq_input); | 808 start_offset = start_adr - reinterpret_cast<Address>(*seq_input); |
| 807 end_offset = start_offset + seq_input->length(); | 809 end_offset = start_offset + seq_input->length(); |
| 808 | 810 |
| 809 success = test(seq_input.location(), start_offset, end_offset, captures); | 811 success = test(seq_input.location(), start_offset, end_offset, captures); |
| 810 | 812 |
| 811 CHECK(!success); | 813 CHECK(!success); |
| 812 } | 814 } |
| 813 | 815 |
| 814 | 816 |
| 815 IA32TEST(MacroAssemblerIA32Backtrack) { | 817 TEST(MacroAssemblerIA32Backtrack) { |
| 816 typedef bool (*AsciiTest) ( | 818 typedef bool (*AsciiTest) ( |
| 817 SeqAsciiString** base, int start_index, int end_index, int* captures); | 819 SeqAsciiString** base, int start_index, int end_index, int* captures); |
| 818 | 820 |
| 819 V8::Initialize(NULL); | 821 V8::Initialize(NULL); |
| 820 | 822 |
| 821 // regexp-macro-assembler-ia32 needs a handle scope to allocate | 823 // regexp-macro-assembler-ia32 needs a handle scope to allocate |
| 822 // byte-arrays for constants. | 824 // byte-arrays for constants. |
| 823 v8::HandleScope scope; | 825 v8::HandleScope scope; |
| 824 | 826 |
| 825 RegExpMacroAssemblerIA32 m(RegExpMacroAssemblerIA32::ASCII, 0); | 827 RegExpMacroAssemblerIA32 m(RegExpMacroAssemblerIA32::ASCII, 0); |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 848 int start_offset = start_adr - reinterpret_cast<Address>(*seq_input); | 850 int start_offset = start_adr - reinterpret_cast<Address>(*seq_input); |
| 849 int end_offset = start_offset + seq_input->length(); | 851 int end_offset = start_offset + seq_input->length(); |
| 850 | 852 |
| 851 bool success = | 853 bool success = |
| 852 test(seq_input.location(), start_offset, end_offset, NULL); | 854 test(seq_input.location(), start_offset, end_offset, NULL); |
| 853 | 855 |
| 854 CHECK(!success); | 856 CHECK(!success); |
| 855 } | 857 } |
| 856 | 858 |
| 857 | 859 |
| 858 IA32TEST(MacroAssemblerIA32Registers) { | 860 TEST(MacroAssemblerIA32Registers) { |
| 859 typedef bool (*AsciiTest) ( | 861 typedef bool (*AsciiTest) ( |
| 860 SeqAsciiString** base, int start_index, int end_index, int* captures); | 862 SeqAsciiString** base, int start_index, int end_index, int* captures); |
| 861 | 863 |
| 862 V8::Initialize(NULL); | 864 V8::Initialize(NULL); |
| 863 | 865 |
| 864 // regexp-macro-assembler-ia32 needs a handle scope to allocate | 866 // regexp-macro-assembler-ia32 needs a handle scope to allocate |
| 865 // byte-arrays for constants. | 867 // byte-arrays for constants. |
| 866 v8::HandleScope scope; | 868 v8::HandleScope scope; |
| 867 | 869 |
| 868 RegExpMacroAssemblerIA32 m(RegExpMacroAssemblerIA32::ASCII, 5); | 870 RegExpMacroAssemblerIA32 m(RegExpMacroAssemblerIA32::ASCII, 5); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 945 test(seq_input.location(), start_offset, end_offset, output); | 947 test(seq_input.location(), start_offset, end_offset, output); |
| 946 | 948 |
| 947 CHECK(success); | 949 CHECK(success); |
| 948 CHECK_EQ(0, output[0]); | 950 CHECK_EQ(0, output[0]); |
| 949 CHECK_EQ(3, output[1]); | 951 CHECK_EQ(3, output[1]); |
| 950 CHECK_EQ(6, output[2]); | 952 CHECK_EQ(6, output[2]); |
| 951 CHECK_EQ(9, output[3]); | 953 CHECK_EQ(9, output[3]); |
| 952 CHECK_EQ(9, output[4]); | 954 CHECK_EQ(9, output[4]); |
| 953 } | 955 } |
| 954 | 956 |
| 957 #endif // !(defined(ARM) || defined(__arm__) || defined(__thumb__)) | |
| 955 | 958 |
| 956 TEST(AddInverseToTable) { | 959 TEST(AddInverseToTable) { |
| 957 static const int kLimit = 1000; | 960 static const int kLimit = 1000; |
| 958 static const int kRangeCount = 16; | 961 static const int kRangeCount = 16; |
| 959 for (int t = 0; t < 10; t++) { | 962 for (int t = 0; t < 10; t++) { |
| 960 ZoneScope zone_scope(DELETE_ON_EXIT); | 963 ZoneScope zone_scope(DELETE_ON_EXIT); |
| 961 ZoneList<CharacterRange>* ranges = | 964 ZoneList<CharacterRange>* ranges = |
| 962 new ZoneList<CharacterRange>(kRangeCount); | 965 new ZoneList<CharacterRange>(kRangeCount); |
| 963 for (int i = 0; i < kRangeCount; i++) { | 966 for (int i = 0; i < kRangeCount; i++) { |
| 964 int from = PseudoRandom(t + 87, i + 25) % kLimit; | 967 int from = PseudoRandom(t + 87, i + 25) % kLimit; |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1146 // whole block at a time. | 1149 // whole block at a time. |
| 1147 TestSimpleRangeCaseIndependence(CharacterRange('A', 'k'), | 1150 TestSimpleRangeCaseIndependence(CharacterRange('A', 'k'), |
| 1148 CharacterRange('a', 'z')); | 1151 CharacterRange('a', 'z')); |
| 1149 } | 1152 } |
| 1150 | 1153 |
| 1151 | 1154 |
| 1152 TEST(Graph) { | 1155 TEST(Graph) { |
| 1153 V8::Initialize(NULL); | 1156 V8::Initialize(NULL); |
| 1154 Execute("(x)?\\1y", "", true); | 1157 Execute("(x)?\\1y", "", true); |
| 1155 } | 1158 } |
| OLD | NEW |