| 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 21 matching lines...) Expand all Loading... |
| 32 #include "v8.h" | 32 #include "v8.h" |
| 33 | 33 |
| 34 #include "cctest.h" | 34 #include "cctest.h" |
| 35 #include "zone-inl.h" | 35 #include "zone-inl.h" |
| 36 #include "parser.h" | 36 #include "parser.h" |
| 37 #include "ast.h" | 37 #include "ast.h" |
| 38 #include "jsregexp-inl.h" | 38 #include "jsregexp-inl.h" |
| 39 #include "assembler-irregexp.h" | 39 #include "assembler-irregexp.h" |
| 40 #include "regexp-macro-assembler.h" | 40 #include "regexp-macro-assembler.h" |
| 41 #include "regexp-macro-assembler-irregexp.h" | 41 #include "regexp-macro-assembler-irregexp.h" |
| 42 #ifdef ARM |
| 43 #include "regexp-macro-assembler-arm.h" |
| 44 #else // IA32 |
| 45 #include "macro-assembler-ia32.h" |
| 42 #include "regexp-macro-assembler-ia32.h" | 46 #include "regexp-macro-assembler-ia32.h" |
| 47 #endif |
| 43 #include "interpreter-irregexp.h" | 48 #include "interpreter-irregexp.h" |
| 44 | 49 |
| 45 | 50 |
| 46 using namespace v8::internal; | 51 using namespace v8::internal; |
| 47 | 52 |
| 48 | 53 |
| 49 static SmartPointer<const char> Parse(const char* input) { | 54 static SmartPointer<const char> Parse(const char* input) { |
| 50 v8::HandleScope scope; | 55 v8::HandleScope scope; |
| 51 ZoneScope zone_scope(DELETE_ON_EXIT); | 56 ZoneScope zone_scope(DELETE_ON_EXIT); |
| 52 FlatStringReader reader(CStrVector(input)); | 57 FlatStringReader reader(CStrVector(input)); |
| (...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 713 CHECK_EQ(84, captures[4]); | 718 CHECK_EQ(84, captures[4]); |
| 714 | 719 |
| 715 Handle<String> f2 = | 720 Handle<String> f2 = |
| 716 Factory::NewStringFromAscii(CStrVector("barfoo")); | 721 Factory::NewStringFromAscii(CStrVector("barfoo")); |
| 717 Handle<String> f2_16 = RegExpImpl::StringToTwoByte(f2); | 722 Handle<String> f2_16 = RegExpImpl::StringToTwoByte(f2); |
| 718 CHECK(!IrregexpInterpreter::Match(array, f2_16, captures, 0)); | 723 CHECK(!IrregexpInterpreter::Match(array, f2_16, captures, 0)); |
| 719 CHECK_EQ(42, captures[0]); | 724 CHECK_EQ(42, captures[0]); |
| 720 } | 725 } |
| 721 | 726 |
| 722 | 727 |
| 723 #if !(defined(ARM) || defined(__arm__) || defined(__thumb__)) | 728 #ifndef ARM // IA32 only tests. |
| 724 | 729 |
| 725 TEST(MacroAssemblerIA32Success) { | 730 TEST(MacroAssemblerIA32Success) { |
| 726 typedef bool (*AsciiTest) ( | 731 typedef bool (*AsciiTest) ( |
| 727 SeqAsciiString** base, int start_index, int end_index, int* captures); | 732 SeqAsciiString** base, int start_index, int end_index, int* captures); |
| 728 | 733 |
| 729 V8::Initialize(NULL); | 734 V8::Initialize(NULL); |
| 730 | 735 |
| 731 // regexp-macro-assembler-ia32 needs a handle scope to allocate | 736 // regexp-macro-assembler-ia32 needs a handle scope to allocate |
| 732 // byte-arrays for constants. | 737 // byte-arrays for constants. |
| 733 v8::HandleScope scope; | 738 v8::HandleScope scope; |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 947 test(seq_input.location(), start_offset, end_offset, output); | 952 test(seq_input.location(), start_offset, end_offset, output); |
| 948 | 953 |
| 949 CHECK(success); | 954 CHECK(success); |
| 950 CHECK_EQ(0, output[0]); | 955 CHECK_EQ(0, output[0]); |
| 951 CHECK_EQ(3, output[1]); | 956 CHECK_EQ(3, output[1]); |
| 952 CHECK_EQ(6, output[2]); | 957 CHECK_EQ(6, output[2]); |
| 953 CHECK_EQ(9, output[3]); | 958 CHECK_EQ(9, output[3]); |
| 954 CHECK_EQ(9, output[4]); | 959 CHECK_EQ(9, output[4]); |
| 955 } | 960 } |
| 956 | 961 |
| 957 #endif // !(defined(ARM) || defined(__arm__) || defined(__thumb__)) | 962 #endif // !defined ARM |
| 958 | 963 |
| 959 TEST(AddInverseToTable) { | 964 TEST(AddInverseToTable) { |
| 960 static const int kLimit = 1000; | 965 static const int kLimit = 1000; |
| 961 static const int kRangeCount = 16; | 966 static const int kRangeCount = 16; |
| 962 for (int t = 0; t < 10; t++) { | 967 for (int t = 0; t < 10; t++) { |
| 963 ZoneScope zone_scope(DELETE_ON_EXIT); | 968 ZoneScope zone_scope(DELETE_ON_EXIT); |
| 964 ZoneList<CharacterRange>* ranges = | 969 ZoneList<CharacterRange>* ranges = |
| 965 new ZoneList<CharacterRange>(kRangeCount); | 970 new ZoneList<CharacterRange>(kRangeCount); |
| 966 for (int i = 0; i < kRangeCount; i++) { | 971 for (int i = 0; i < kRangeCount; i++) { |
| 967 int from = PseudoRandom(t + 87, i + 25) % kLimit; | 972 int from = PseudoRandom(t + 87, i + 25) % kLimit; |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1165 // whole block at a time. | 1170 // whole block at a time. |
| 1166 TestSimpleRangeCaseIndependence(CharacterRange('A', 'k'), | 1171 TestSimpleRangeCaseIndependence(CharacterRange('A', 'k'), |
| 1167 CharacterRange('a', 'z')); | 1172 CharacterRange('a', 'z')); |
| 1168 } | 1173 } |
| 1169 | 1174 |
| 1170 | 1175 |
| 1171 TEST(Graph) { | 1176 TEST(Graph) { |
| 1172 V8::Initialize(NULL); | 1177 V8::Initialize(NULL); |
| 1173 Execute("(x)?\\1y", "", true); | 1178 Execute("(x)?\\1y", "", true); |
| 1174 } | 1179 } |
| OLD | NEW |