OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1179 | 1179 |
1180 ArchRegExpMacroAssembler m(isolate, &zone, NativeRegExpMacroAssembler::LATIN1, | 1180 ArchRegExpMacroAssembler m(isolate, &zone, NativeRegExpMacroAssembler::LATIN1, |
1181 4); | 1181 4); |
1182 | 1182 |
1183 Label fail, succ; | 1183 Label fail, succ; |
1184 | 1184 |
1185 m.WriteCurrentPositionToRegister(0, 0); | 1185 m.WriteCurrentPositionToRegister(0, 0); |
1186 m.WriteCurrentPositionToRegister(2, 0); | 1186 m.WriteCurrentPositionToRegister(2, 0); |
1187 m.AdvanceCurrentPosition(3); | 1187 m.AdvanceCurrentPosition(3); |
1188 m.WriteCurrentPositionToRegister(3, 0); | 1188 m.WriteCurrentPositionToRegister(3, 0); |
1189 m.CheckNotBackReferenceIgnoreCase(2, false, &fail); // Match "AbC". | 1189 m.CheckNotBackReferenceIgnoreCase(2, false, false, &fail); // Match "AbC". |
1190 m.CheckNotBackReferenceIgnoreCase(2, false, &fail); // Match "ABC". | 1190 m.CheckNotBackReferenceIgnoreCase(2, false, false, &fail); // Match "ABC". |
1191 Label expected_fail; | 1191 Label expected_fail; |
1192 m.CheckNotBackReferenceIgnoreCase(2, false, &expected_fail); | 1192 m.CheckNotBackReferenceIgnoreCase(2, false, false, &expected_fail); |
1193 m.Bind(&fail); | 1193 m.Bind(&fail); |
1194 m.Fail(); | 1194 m.Fail(); |
1195 | 1195 |
1196 m.Bind(&expected_fail); | 1196 m.Bind(&expected_fail); |
1197 m.AdvanceCurrentPosition(3); // Skip "xYz" | 1197 m.AdvanceCurrentPosition(3); // Skip "xYz" |
1198 m.CheckNotBackReferenceIgnoreCase(2, false, &succ); | 1198 m.CheckNotBackReferenceIgnoreCase(2, false, false, &succ); |
1199 m.Fail(); | 1199 m.Fail(); |
1200 | 1200 |
1201 m.Bind(&succ); | 1201 m.Bind(&succ); |
1202 m.WriteCurrentPositionToRegister(1, 0); | 1202 m.WriteCurrentPositionToRegister(1, 0); |
1203 m.Succeed(); | 1203 m.Succeed(); |
1204 | 1204 |
1205 Handle<String> source = | 1205 Handle<String> source = |
1206 factory->NewStringFromStaticChars("^(abc)\1\1(?!\1)...(?!\1)"); | 1206 factory->NewStringFromStaticChars("^(abc)\1\1(?!\1)...(?!\1)"); |
1207 Handle<Object> code_object = m.GetCode(source); | 1207 Handle<Object> code_object = m.GetCode(source); |
1208 Handle<Code> code = Handle<Code>::cast(code_object); | 1208 Handle<Code> code = Handle<Code>::cast(code_object); |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1622 } | 1622 } |
1623 } | 1623 } |
1624 | 1624 |
1625 | 1625 |
1626 static void TestRangeCaseIndependence(Isolate* isolate, CharacterRange input, | 1626 static void TestRangeCaseIndependence(Isolate* isolate, CharacterRange input, |
1627 Vector<CharacterRange> expected) { | 1627 Vector<CharacterRange> expected) { |
1628 Zone zone; | 1628 Zone zone; |
1629 int count = expected.length(); | 1629 int count = expected.length(); |
1630 ZoneList<CharacterRange>* list = | 1630 ZoneList<CharacterRange>* list = |
1631 new(&zone) ZoneList<CharacterRange>(count, &zone); | 1631 new(&zone) ZoneList<CharacterRange>(count, &zone); |
1632 input.AddCaseEquivalents(isolate, &zone, list, false); | 1632 list->Add(input, &zone); |
| 1633 CharacterRange::AddCaseEquivalents(isolate, &zone, list, false); |
| 1634 list->Remove(0); // Remove the input before checking results. |
1633 CHECK_EQ(count, list->length()); | 1635 CHECK_EQ(count, list->length()); |
1634 for (int i = 0; i < list->length(); i++) { | 1636 for (int i = 0; i < list->length(); i++) { |
1635 CHECK_EQ(expected[i].from(), list->at(i).from()); | 1637 CHECK_EQ(expected[i].from(), list->at(i).from()); |
1636 CHECK_EQ(expected[i].to(), list->at(i).to()); | 1638 CHECK_EQ(expected[i].to(), list->at(i).to()); |
1637 } | 1639 } |
1638 } | 1640 } |
1639 | 1641 |
1640 | 1642 |
1641 static void TestSimpleRangeCaseIndependence(Isolate* isolate, | 1643 static void TestSimpleRangeCaseIndependence(Isolate* isolate, |
1642 CharacterRange input, | 1644 CharacterRange input, |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1956 // .toString() throws on non-RegExps that aren't RegExp.prototype | 1958 // .toString() throws on non-RegExps that aren't RegExp.prototype |
1957 v8::Local<v8::Value> resultToStringError = CompileRun( | 1959 v8::Local<v8::Value> resultToStringError = CompileRun( |
1958 "var exception;" | 1960 "var exception;" |
1959 "try { RegExp.prototype.toString.call(null) }" | 1961 "try { RegExp.prototype.toString.call(null) }" |
1960 "catch (e) { exception = e; }" | 1962 "catch (e) { exception = e; }" |
1961 "exception"); | 1963 "exception"); |
1962 CHECK_EQ(1, use_counts[v8::Isolate::kRegExpPrototypeStickyGetter]); | 1964 CHECK_EQ(1, use_counts[v8::Isolate::kRegExpPrototypeStickyGetter]); |
1963 CHECK_EQ(1, use_counts[v8::Isolate::kRegExpPrototypeToString]); | 1965 CHECK_EQ(1, use_counts[v8::Isolate::kRegExpPrototypeToString]); |
1964 CHECK(resultToStringError->IsObject()); | 1966 CHECK(resultToStringError->IsObject()); |
1965 } | 1967 } |
OLD | NEW |