| 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 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1046 if (count == 0) { | 1046 if (count == 0) { |
| 1047 return c; | 1047 return c; |
| 1048 } else { | 1048 } else { |
| 1049 CHECK_EQ(1, count); | 1049 CHECK_EQ(1, count); |
| 1050 return canon[0]; | 1050 return canon[0]; |
| 1051 } | 1051 } |
| 1052 } | 1052 } |
| 1053 | 1053 |
| 1054 | 1054 |
| 1055 TEST(RangeCanonicalization) { | 1055 TEST(RangeCanonicalization) { |
| 1056 CHECK((CanonRange(0) & CharacterRange::kStartMarker) != 0); | 1056 CHECK_NE(CanonRange(0) & CharacterRange::kStartMarker, 0); |
| 1057 // Check that we arrive at the same result when using the basic | 1057 // Check that we arrive at the same result when using the basic |
| 1058 // range canonicalization primitives as when using immediate | 1058 // range canonicalization primitives as when using immediate |
| 1059 // canonicalization. | 1059 // canonicalization. |
| 1060 unibrow::Mapping<unibrow::Ecma262UnCanonicalize> un_canonicalize; | 1060 unibrow::Mapping<unibrow::Ecma262UnCanonicalize> un_canonicalize; |
| 1061 for (int i = 0; i < CharacterRange::kRangeCanonicalizeMax; i++) { | 1061 for (int i = 0; i < CharacterRange::kRangeCanonicalizeMax; i++) { |
| 1062 int range = CanonRange(i); | 1062 int range = CanonRange(i); |
| 1063 int indirect_length = 0; | 1063 int indirect_length = 0; |
| 1064 unibrow::uchar indirect[unibrow::Ecma262UnCanonicalize::kMaxWidth]; | 1064 unibrow::uchar indirect[unibrow::Ecma262UnCanonicalize::kMaxWidth]; |
| 1065 if ((range & CharacterRange::kStartMarker) == 0) { | 1065 if ((range & CharacterRange::kStartMarker) == 0) { |
| 1066 indirect_length = un_canonicalize.get(i - range, '\0', indirect); | 1066 indirect_length = un_canonicalize.get(i - range, '\0', indirect); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1162 // whole block at a time. | 1162 // whole block at a time. |
| 1163 TestSimpleRangeCaseIndependence(CharacterRange('A', 'k'), | 1163 TestSimpleRangeCaseIndependence(CharacterRange('A', 'k'), |
| 1164 CharacterRange('a', 'z')); | 1164 CharacterRange('a', 'z')); |
| 1165 } | 1165 } |
| 1166 | 1166 |
| 1167 | 1167 |
| 1168 TEST(Graph) { | 1168 TEST(Graph) { |
| 1169 V8::Initialize(NULL); | 1169 V8::Initialize(NULL); |
| 1170 Execute("(?:foo|bar$)", false, true); | 1170 Execute("(?:foo|bar$)", false, true); |
| 1171 } | 1171 } |
| OLD | NEW |