Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(104)

Side by Side Diff: test/cctest/test-regexp.cc

Issue 10534006: Remove TLS access for current Zone. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address review. Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « test/cctest/test-liveedit.cc ('k') | test/cctest/test-strings.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 81
82 static SmartArrayPointer<const char> Parse(const char* input) { 82 static SmartArrayPointer<const char> Parse(const char* input) {
83 V8::Initialize(NULL); 83 V8::Initialize(NULL);
84 v8::HandleScope scope; 84 v8::HandleScope scope;
85 ZoneScope zone_scope(Isolate::Current(), DELETE_ON_EXIT); 85 ZoneScope zone_scope(Isolate::Current(), DELETE_ON_EXIT);
86 FlatStringReader reader(Isolate::Current(), CStrVector(input)); 86 FlatStringReader reader(Isolate::Current(), CStrVector(input));
87 RegExpCompileData result; 87 RegExpCompileData result;
88 CHECK(v8::internal::RegExpParser::ParseRegExp(&reader, false, &result)); 88 CHECK(v8::internal::RegExpParser::ParseRegExp(&reader, false, &result));
89 CHECK(result.tree != NULL); 89 CHECK(result.tree != NULL);
90 CHECK(result.error.is_null()); 90 CHECK(result.error.is_null());
91 SmartArrayPointer<const char> output = result.tree->ToString(); 91 SmartArrayPointer<const char> output =
92 result.tree->ToString(Isolate::Current()->zone());
92 return output; 93 return output;
93 } 94 }
94 95
95 static bool CheckSimple(const char* input) { 96 static bool CheckSimple(const char* input) {
96 V8::Initialize(NULL); 97 V8::Initialize(NULL);
97 v8::HandleScope scope; 98 v8::HandleScope scope;
98 unibrow::Utf8InputBuffer<> buffer(input, StrLength(input)); 99 unibrow::Utf8InputBuffer<> buffer(input, StrLength(input));
99 ZoneScope zone_scope(Isolate::Current(), DELETE_ON_EXIT); 100 ZoneScope zone_scope(Isolate::Current(), DELETE_ON_EXIT);
100 FlatStringReader reader(Isolate::Current(), CStrVector(input)); 101 FlatStringReader reader(Isolate::Current(), CStrVector(input));
101 RegExpCompileData result; 102 RegExpCompileData result;
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 } 463 }
463 464
464 465
465 static bool NotWord(uc16 c) { 466 static bool NotWord(uc16 c) {
466 return !IsRegExpWord(c); 467 return !IsRegExpWord(c);
467 } 468 }
468 469
469 470
470 static void TestCharacterClassEscapes(uc16 c, bool (pred)(uc16 c)) { 471 static void TestCharacterClassEscapes(uc16 c, bool (pred)(uc16 c)) {
471 ZoneScope scope(Isolate::Current(), DELETE_ON_EXIT); 472 ZoneScope scope(Isolate::Current(), DELETE_ON_EXIT);
472 ZoneList<CharacterRange>* ranges = new ZoneList<CharacterRange>(2); 473 Zone* zone = Isolate::Current()->zone();
473 CharacterRange::AddClassEscape(c, ranges); 474 ZoneList<CharacterRange>* ranges =
475 new(zone) ZoneList<CharacterRange>(2, zone);
476 CharacterRange::AddClassEscape(c, ranges, zone);
474 for (unsigned i = 0; i < (1 << 16); i++) { 477 for (unsigned i = 0; i < (1 << 16); i++) {
475 bool in_class = false; 478 bool in_class = false;
476 for (int j = 0; !in_class && j < ranges->length(); j++) { 479 for (int j = 0; !in_class && j < ranges->length(); j++) {
477 CharacterRange& range = ranges->at(j); 480 CharacterRange& range = ranges->at(j);
478 in_class = (range.from() <= i && i <= range.to()); 481 in_class = (range.from() <= i && i <= range.to());
479 } 482 }
480 CHECK_EQ(pred(i), in_class); 483 CHECK_EQ(pred(i), in_class);
481 } 484 }
482 } 485 }
483 486
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 560
558 static unsigned PseudoRandom(int i, int j) { 561 static unsigned PseudoRandom(int i, int j) {
559 return ~(~((i * 781) ^ (j * 329))); 562 return ~(~((i * 781) ^ (j * 329)));
560 } 563 }
561 564
562 565
563 TEST(SplayTreeSimple) { 566 TEST(SplayTreeSimple) {
564 v8::internal::V8::Initialize(NULL); 567 v8::internal::V8::Initialize(NULL);
565 static const unsigned kLimit = 1000; 568 static const unsigned kLimit = 1000;
566 ZoneScope zone_scope(Isolate::Current(), DELETE_ON_EXIT); 569 ZoneScope zone_scope(Isolate::Current(), DELETE_ON_EXIT);
567 ZoneSplayTree<TestConfig> tree; 570 ZoneSplayTree<TestConfig> tree(Isolate::Current()->zone());
568 bool seen[kLimit]; 571 bool seen[kLimit];
569 for (unsigned i = 0; i < kLimit; i++) seen[i] = false; 572 for (unsigned i = 0; i < kLimit; i++) seen[i] = false;
570 #define CHECK_MAPS_EQUAL() do { \ 573 #define CHECK_MAPS_EQUAL() do { \
571 for (unsigned k = 0; k < kLimit; k++) \ 574 for (unsigned k = 0; k < kLimit; k++) \
572 CHECK_EQ(seen[k], tree.Find(k, &loc)); \ 575 CHECK_EQ(seen[k], tree.Find(k, &loc)); \
573 } while (false) 576 } while (false)
574 for (int i = 0; i < 50; i++) { 577 for (int i = 0; i < 50; i++) {
575 for (int j = 0; j < 50; j++) { 578 for (int j = 0; j < 50; j++) {
576 unsigned next = PseudoRandom(i, j) % kLimit; 579 unsigned next = PseudoRandom(i, j) % kLimit;
577 if (seen[next]) { 580 if (seen[next]) {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 for (int j = 0; j < 2 * kRangeSize; j++) { 628 for (int j = 0; j < 2 * kRangeSize; j++) {
626 range[j] = PseudoRandom(i + 25, j + 87) % kLimit; 629 range[j] = PseudoRandom(i + 25, j + 87) % kLimit;
627 } 630 }
628 range.Sort(); 631 range.Sort();
629 for (int j = 1; j < 2 * kRangeSize; j++) { 632 for (int j = 1; j < 2 * kRangeSize; j++) {
630 CHECK(range[j-1] <= range[j]); 633 CHECK(range[j-1] <= range[j]);
631 } 634 }
632 } 635 }
633 // Enter test data into dispatch table. 636 // Enter test data into dispatch table.
634 ZoneScope zone_scope(Isolate::Current(), DELETE_ON_EXIT); 637 ZoneScope zone_scope(Isolate::Current(), DELETE_ON_EXIT);
635 DispatchTable table; 638 DispatchTable table(Isolate::Current()->zone());
636 for (int i = 0; i < kRangeCount; i++) { 639 for (int i = 0; i < kRangeCount; i++) {
637 uc16* range = ranges[i]; 640 uc16* range = ranges[i];
638 for (int j = 0; j < 2 * kRangeSize; j += 2) 641 for (int j = 0; j < 2 * kRangeSize; j += 2)
639 table.AddRange(CharacterRange(range[j], range[j + 1]), i); 642 table.AddRange(CharacterRange(range[j], range[j + 1]), i,
643 Isolate::Current()->zone());
640 } 644 }
641 // Check that the table looks as we would expect 645 // Check that the table looks as we would expect
642 for (int p = 0; p < kLimit; p++) { 646 for (int p = 0; p < kLimit; p++) {
643 OutSet* outs = table.Get(p); 647 OutSet* outs = table.Get(p);
644 for (int j = 0; j < kRangeCount; j++) { 648 for (int j = 0; j < kRangeCount; j++) {
645 uc16* range = ranges[j]; 649 uc16* range = ranges[j];
646 bool is_on = false; 650 bool is_on = false;
647 for (int k = 0; !is_on && (k < 2 * kRangeSize); k += 2) 651 for (int k = 0; !is_on && (k < 2 * kRangeSize); k += 2)
648 is_on = (range[k] <= p && p <= range[k + 1]); 652 is_on = (range[k] <= p && p <= range[k + 1]);
649 CHECK_EQ(is_on, outs->Get(j)); 653 CHECK_EQ(is_on, outs->Get(j));
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 0, 733 0,
730 Isolate::Current()); 734 Isolate::Current());
731 } 735 }
732 736
733 737
734 TEST(MacroAssemblerNativeSuccess) { 738 TEST(MacroAssemblerNativeSuccess) {
735 v8::V8::Initialize(); 739 v8::V8::Initialize();
736 ContextInitializer initializer; 740 ContextInitializer initializer;
737 Factory* factory = Isolate::Current()->factory(); 741 Factory* factory = Isolate::Current()->factory();
738 742
739 ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 4); 743 ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 4,
744 Isolate::Current()->zone());
740 745
741 m.Succeed(); 746 m.Succeed();
742 747
743 Handle<String> source = factory->NewStringFromAscii(CStrVector("")); 748 Handle<String> source = factory->NewStringFromAscii(CStrVector(""));
744 Handle<Object> code_object = m.GetCode(source); 749 Handle<Object> code_object = m.GetCode(source);
745 Handle<Code> code = Handle<Code>::cast(code_object); 750 Handle<Code> code = Handle<Code>::cast(code_object);
746 751
747 int captures[4] = {42, 37, 87, 117}; 752 int captures[4] = {42, 37, 87, 117};
748 Handle<String> input = factory->NewStringFromAscii(CStrVector("foofoo")); 753 Handle<String> input = factory->NewStringFromAscii(CStrVector("foofoo"));
749 Handle<SeqAsciiString> seq_input = Handle<SeqAsciiString>::cast(input); 754 Handle<SeqAsciiString> seq_input = Handle<SeqAsciiString>::cast(input);
(...skipping 14 matching lines...) Expand all
764 CHECK_EQ(-1, captures[2]); 769 CHECK_EQ(-1, captures[2]);
765 CHECK_EQ(-1, captures[3]); 770 CHECK_EQ(-1, captures[3]);
766 } 771 }
767 772
768 773
769 TEST(MacroAssemblerNativeSimple) { 774 TEST(MacroAssemblerNativeSimple) {
770 v8::V8::Initialize(); 775 v8::V8::Initialize();
771 ContextInitializer initializer; 776 ContextInitializer initializer;
772 Factory* factory = Isolate::Current()->factory(); 777 Factory* factory = Isolate::Current()->factory();
773 778
774 ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 4); 779 ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 4,
780 Isolate::Current()->zone());
775 781
776 uc16 foo_chars[3] = {'f', 'o', 'o'}; 782 uc16 foo_chars[3] = {'f', 'o', 'o'};
777 Vector<const uc16> foo(foo_chars, 3); 783 Vector<const uc16> foo(foo_chars, 3);
778 784
779 Label fail; 785 Label fail;
780 m.CheckCharacters(foo, 0, &fail, true); 786 m.CheckCharacters(foo, 0, &fail, true);
781 m.WriteCurrentPositionToRegister(0, 0); 787 m.WriteCurrentPositionToRegister(0, 0);
782 m.AdvanceCurrentPosition(3); 788 m.AdvanceCurrentPosition(3);
783 m.WriteCurrentPositionToRegister(1, 0); 789 m.WriteCurrentPositionToRegister(1, 0);
784 m.Succeed(); 790 m.Succeed();
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 827
822 CHECK_EQ(NativeRegExpMacroAssembler::FAILURE, result); 828 CHECK_EQ(NativeRegExpMacroAssembler::FAILURE, result);
823 } 829 }
824 830
825 831
826 TEST(MacroAssemblerNativeSimpleUC16) { 832 TEST(MacroAssemblerNativeSimpleUC16) {
827 v8::V8::Initialize(); 833 v8::V8::Initialize();
828 ContextInitializer initializer; 834 ContextInitializer initializer;
829 Factory* factory = Isolate::Current()->factory(); 835 Factory* factory = Isolate::Current()->factory();
830 836
831 ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::UC16, 4); 837 ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::UC16, 4,
838 Isolate::Current()->zone());
832 839
833 uc16 foo_chars[3] = {'f', 'o', 'o'}; 840 uc16 foo_chars[3] = {'f', 'o', 'o'};
834 Vector<const uc16> foo(foo_chars, 3); 841 Vector<const uc16> foo(foo_chars, 3);
835 842
836 Label fail; 843 Label fail;
837 m.CheckCharacters(foo, 0, &fail, true); 844 m.CheckCharacters(foo, 0, &fail, true);
838 m.WriteCurrentPositionToRegister(0, 0); 845 m.WriteCurrentPositionToRegister(0, 0);
839 m.AdvanceCurrentPosition(3); 846 m.AdvanceCurrentPosition(3);
840 m.WriteCurrentPositionToRegister(1, 0); 847 m.WriteCurrentPositionToRegister(1, 0);
841 m.Succeed(); 848 m.Succeed();
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 890
884 CHECK_EQ(NativeRegExpMacroAssembler::FAILURE, result); 891 CHECK_EQ(NativeRegExpMacroAssembler::FAILURE, result);
885 } 892 }
886 893
887 894
888 TEST(MacroAssemblerNativeBacktrack) { 895 TEST(MacroAssemblerNativeBacktrack) {
889 v8::V8::Initialize(); 896 v8::V8::Initialize();
890 ContextInitializer initializer; 897 ContextInitializer initializer;
891 Factory* factory = Isolate::Current()->factory(); 898 Factory* factory = Isolate::Current()->factory();
892 899
893 ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 0); 900 ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 0,
901 Isolate::Current()->zone());
894 902
895 Label fail; 903 Label fail;
896 Label backtrack; 904 Label backtrack;
897 m.LoadCurrentCharacter(10, &fail); 905 m.LoadCurrentCharacter(10, &fail);
898 m.Succeed(); 906 m.Succeed();
899 m.Bind(&fail); 907 m.Bind(&fail);
900 m.PushBacktrack(&backtrack); 908 m.PushBacktrack(&backtrack);
901 m.LoadCurrentCharacter(10, NULL); 909 m.LoadCurrentCharacter(10, NULL);
902 m.Succeed(); 910 m.Succeed();
903 m.Bind(&backtrack); 911 m.Bind(&backtrack);
(...skipping 17 matching lines...) Expand all
921 929
922 CHECK_EQ(NativeRegExpMacroAssembler::FAILURE, result); 930 CHECK_EQ(NativeRegExpMacroAssembler::FAILURE, result);
923 } 931 }
924 932
925 933
926 TEST(MacroAssemblerNativeBackReferenceASCII) { 934 TEST(MacroAssemblerNativeBackReferenceASCII) {
927 v8::V8::Initialize(); 935 v8::V8::Initialize();
928 ContextInitializer initializer; 936 ContextInitializer initializer;
929 Factory* factory = Isolate::Current()->factory(); 937 Factory* factory = Isolate::Current()->factory();
930 938
931 ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 4); 939 ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 4,
940 Isolate::Current()->zone());
932 941
933 m.WriteCurrentPositionToRegister(0, 0); 942 m.WriteCurrentPositionToRegister(0, 0);
934 m.AdvanceCurrentPosition(2); 943 m.AdvanceCurrentPosition(2);
935 m.WriteCurrentPositionToRegister(1, 0); 944 m.WriteCurrentPositionToRegister(1, 0);
936 Label nomatch; 945 Label nomatch;
937 m.CheckNotBackReference(0, &nomatch); 946 m.CheckNotBackReference(0, &nomatch);
938 m.Fail(); 947 m.Fail();
939 m.Bind(&nomatch); 948 m.Bind(&nomatch);
940 m.AdvanceCurrentPosition(2); 949 m.AdvanceCurrentPosition(2);
941 Label missing_match; 950 Label missing_match;
(...skipping 26 matching lines...) Expand all
968 CHECK_EQ(6, output[2]); 977 CHECK_EQ(6, output[2]);
969 CHECK_EQ(-1, output[3]); 978 CHECK_EQ(-1, output[3]);
970 } 979 }
971 980
972 981
973 TEST(MacroAssemblerNativeBackReferenceUC16) { 982 TEST(MacroAssemblerNativeBackReferenceUC16) {
974 v8::V8::Initialize(); 983 v8::V8::Initialize();
975 ContextInitializer initializer; 984 ContextInitializer initializer;
976 Factory* factory = Isolate::Current()->factory(); 985 Factory* factory = Isolate::Current()->factory();
977 986
978 ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::UC16, 4); 987 ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::UC16, 4,
988 Isolate::Current()->zone());
979 989
980 m.WriteCurrentPositionToRegister(0, 0); 990 m.WriteCurrentPositionToRegister(0, 0);
981 m.AdvanceCurrentPosition(2); 991 m.AdvanceCurrentPosition(2);
982 m.WriteCurrentPositionToRegister(1, 0); 992 m.WriteCurrentPositionToRegister(1, 0);
983 Label nomatch; 993 Label nomatch;
984 m.CheckNotBackReference(0, &nomatch); 994 m.CheckNotBackReference(0, &nomatch);
985 m.Fail(); 995 m.Fail();
986 m.Bind(&nomatch); 996 m.Bind(&nomatch);
987 m.AdvanceCurrentPosition(2); 997 m.AdvanceCurrentPosition(2);
988 Label missing_match; 998 Label missing_match;
(...skipping 29 matching lines...) Expand all
1018 CHECK_EQ(-1, output[3]); 1028 CHECK_EQ(-1, output[3]);
1019 } 1029 }
1020 1030
1021 1031
1022 1032
1023 TEST(MacroAssemblernativeAtStart) { 1033 TEST(MacroAssemblernativeAtStart) {
1024 v8::V8::Initialize(); 1034 v8::V8::Initialize();
1025 ContextInitializer initializer; 1035 ContextInitializer initializer;
1026 Factory* factory = Isolate::Current()->factory(); 1036 Factory* factory = Isolate::Current()->factory();
1027 1037
1028 ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 0); 1038 ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 0,
1039 Isolate::Current()->zone());
1029 1040
1030 Label not_at_start, newline, fail; 1041 Label not_at_start, newline, fail;
1031 m.CheckNotAtStart(&not_at_start); 1042 m.CheckNotAtStart(&not_at_start);
1032 // Check that prevchar = '\n' and current = 'f'. 1043 // Check that prevchar = '\n' and current = 'f'.
1033 m.CheckCharacter('\n', &newline); 1044 m.CheckCharacter('\n', &newline);
1034 m.Bind(&fail); 1045 m.Bind(&fail);
1035 m.Fail(); 1046 m.Fail();
1036 m.Bind(&newline); 1047 m.Bind(&newline);
1037 m.LoadCurrentCharacter(0, &fail); 1048 m.LoadCurrentCharacter(0, &fail);
1038 m.CheckNotCharacter('f', &fail); 1049 m.CheckNotCharacter('f', &fail);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1075 1086
1076 CHECK_EQ(NativeRegExpMacroAssembler::SUCCESS, result); 1087 CHECK_EQ(NativeRegExpMacroAssembler::SUCCESS, result);
1077 } 1088 }
1078 1089
1079 1090
1080 TEST(MacroAssemblerNativeBackRefNoCase) { 1091 TEST(MacroAssemblerNativeBackRefNoCase) {
1081 v8::V8::Initialize(); 1092 v8::V8::Initialize();
1082 ContextInitializer initializer; 1093 ContextInitializer initializer;
1083 Factory* factory = Isolate::Current()->factory(); 1094 Factory* factory = Isolate::Current()->factory();
1084 1095
1085 ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 4); 1096 ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 4,
1097 Isolate::Current()->zone());
1086 1098
1087 Label fail, succ; 1099 Label fail, succ;
1088 1100
1089 m.WriteCurrentPositionToRegister(0, 0); 1101 m.WriteCurrentPositionToRegister(0, 0);
1090 m.WriteCurrentPositionToRegister(2, 0); 1102 m.WriteCurrentPositionToRegister(2, 0);
1091 m.AdvanceCurrentPosition(3); 1103 m.AdvanceCurrentPosition(3);
1092 m.WriteCurrentPositionToRegister(3, 0); 1104 m.WriteCurrentPositionToRegister(3, 0);
1093 m.CheckNotBackReferenceIgnoreCase(2, &fail); // Match "AbC". 1105 m.CheckNotBackReferenceIgnoreCase(2, &fail); // Match "AbC".
1094 m.CheckNotBackReferenceIgnoreCase(2, &fail); // Match "ABC". 1106 m.CheckNotBackReferenceIgnoreCase(2, &fail); // Match "ABC".
1095 Label expected_fail; 1107 Label expected_fail;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1132 CHECK_EQ(3, output[3]); 1144 CHECK_EQ(3, output[3]);
1133 } 1145 }
1134 1146
1135 1147
1136 1148
1137 TEST(MacroAssemblerNativeRegisters) { 1149 TEST(MacroAssemblerNativeRegisters) {
1138 v8::V8::Initialize(); 1150 v8::V8::Initialize();
1139 ContextInitializer initializer; 1151 ContextInitializer initializer;
1140 Factory* factory = Isolate::Current()->factory(); 1152 Factory* factory = Isolate::Current()->factory();
1141 1153
1142 ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 6); 1154 ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 6,
1155 Isolate::Current()->zone());
1143 1156
1144 uc16 foo_chars[3] = {'f', 'o', 'o'}; 1157 uc16 foo_chars[3] = {'f', 'o', 'o'};
1145 Vector<const uc16> foo(foo_chars, 3); 1158 Vector<const uc16> foo(foo_chars, 3);
1146 1159
1147 enum registers { out1, out2, out3, out4, out5, out6, sp, loop_cnt }; 1160 enum registers { out1, out2, out3, out4, out5, out6, sp, loop_cnt };
1148 Label fail; 1161 Label fail;
1149 Label backtrack; 1162 Label backtrack;
1150 m.WriteCurrentPositionToRegister(out1, 0); // Output: [0] 1163 m.WriteCurrentPositionToRegister(out1, 0); // Output: [0]
1151 m.PushRegister(out1, RegExpMacroAssembler::kNoStackLimitCheck); 1164 m.PushRegister(out1, RegExpMacroAssembler::kNoStackLimitCheck);
1152 m.PushBacktrack(&backtrack); 1165 m.PushBacktrack(&backtrack);
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
1234 CHECK_EQ(-1, output[5]); 1247 CHECK_EQ(-1, output[5]);
1235 } 1248 }
1236 1249
1237 1250
1238 TEST(MacroAssemblerStackOverflow) { 1251 TEST(MacroAssemblerStackOverflow) {
1239 v8::V8::Initialize(); 1252 v8::V8::Initialize();
1240 ContextInitializer initializer; 1253 ContextInitializer initializer;
1241 Isolate* isolate = Isolate::Current(); 1254 Isolate* isolate = Isolate::Current();
1242 Factory* factory = isolate->factory(); 1255 Factory* factory = isolate->factory();
1243 1256
1244 ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 0); 1257 ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 0,
1258 Isolate::Current()->zone());
1245 1259
1246 Label loop; 1260 Label loop;
1247 m.Bind(&loop); 1261 m.Bind(&loop);
1248 m.PushBacktrack(&loop); 1262 m.PushBacktrack(&loop);
1249 m.GoTo(&loop); 1263 m.GoTo(&loop);
1250 1264
1251 Handle<String> source = 1265 Handle<String> source =
1252 factory->NewStringFromAscii(CStrVector("<stack overflow test>")); 1266 factory->NewStringFromAscii(CStrVector("<stack overflow test>"));
1253 Handle<Object> code_object = m.GetCode(source); 1267 Handle<Object> code_object = m.GetCode(source);
1254 Handle<Code> code = Handle<Code>::cast(code_object); 1268 Handle<Code> code = Handle<Code>::cast(code_object);
(...skipping 17 matching lines...) Expand all
1272 isolate->clear_pending_exception(); 1286 isolate->clear_pending_exception();
1273 } 1287 }
1274 1288
1275 1289
1276 TEST(MacroAssemblerNativeLotsOfRegisters) { 1290 TEST(MacroAssemblerNativeLotsOfRegisters) {
1277 v8::V8::Initialize(); 1291 v8::V8::Initialize();
1278 ContextInitializer initializer; 1292 ContextInitializer initializer;
1279 Isolate* isolate = Isolate::Current(); 1293 Isolate* isolate = Isolate::Current();
1280 Factory* factory = isolate->factory(); 1294 Factory* factory = isolate->factory();
1281 1295
1282 ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 2); 1296 ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 2,
1297 Isolate::Current()->zone());
1283 1298
1284 // At least 2048, to ensure the allocated space for registers 1299 // At least 2048, to ensure the allocated space for registers
1285 // span one full page. 1300 // span one full page.
1286 const int large_number = 8000; 1301 const int large_number = 8000;
1287 m.WriteCurrentPositionToRegister(large_number, 42); 1302 m.WriteCurrentPositionToRegister(large_number, 42);
1288 m.WriteCurrentPositionToRegister(0, 0); 1303 m.WriteCurrentPositionToRegister(0, 0);
1289 m.WriteCurrentPositionToRegister(1, 1); 1304 m.WriteCurrentPositionToRegister(1, 1);
1290 Label done; 1305 Label done;
1291 m.CheckNotBackReference(0, &done); // Performs a system-stack push. 1306 m.CheckNotBackReference(0, &done); // Performs a system-stack push.
1292 m.Bind(&done); 1307 m.Bind(&done);
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
1390 1405
1391 #endif // V8_INTERPRETED_REGEXP 1406 #endif // V8_INTERPRETED_REGEXP
1392 1407
1393 1408
1394 TEST(AddInverseToTable) { 1409 TEST(AddInverseToTable) {
1395 v8::internal::V8::Initialize(NULL); 1410 v8::internal::V8::Initialize(NULL);
1396 static const int kLimit = 1000; 1411 static const int kLimit = 1000;
1397 static const int kRangeCount = 16; 1412 static const int kRangeCount = 16;
1398 for (int t = 0; t < 10; t++) { 1413 for (int t = 0; t < 10; t++) {
1399 ZoneScope zone_scope(Isolate::Current(), DELETE_ON_EXIT); 1414 ZoneScope zone_scope(Isolate::Current(), DELETE_ON_EXIT);
1415 Zone* zone = Isolate::Current()->zone();
1400 ZoneList<CharacterRange>* ranges = 1416 ZoneList<CharacterRange>* ranges =
1401 new ZoneList<CharacterRange>(kRangeCount); 1417 new(zone)
1418 ZoneList<CharacterRange>(kRangeCount, zone);
1402 for (int i = 0; i < kRangeCount; i++) { 1419 for (int i = 0; i < kRangeCount; i++) {
1403 int from = PseudoRandom(t + 87, i + 25) % kLimit; 1420 int from = PseudoRandom(t + 87, i + 25) % kLimit;
1404 int to = from + (PseudoRandom(i + 87, t + 25) % (kLimit / 20)); 1421 int to = from + (PseudoRandom(i + 87, t + 25) % (kLimit / 20));
1405 if (to > kLimit) to = kLimit; 1422 if (to > kLimit) to = kLimit;
1406 ranges->Add(CharacterRange(from, to)); 1423 ranges->Add(CharacterRange(from, to), zone);
1407 } 1424 }
1408 DispatchTable table; 1425 DispatchTable table(zone);
1409 DispatchTableConstructor cons(&table, false); 1426 DispatchTableConstructor cons(&table, false, Isolate::Current()->zone());
1410 cons.set_choice_index(0); 1427 cons.set_choice_index(0);
1411 cons.AddInverse(ranges); 1428 cons.AddInverse(ranges);
1412 for (int i = 0; i < kLimit; i++) { 1429 for (int i = 0; i < kLimit; i++) {
1413 bool is_on = false; 1430 bool is_on = false;
1414 for (int j = 0; !is_on && j < kRangeCount; j++) 1431 for (int j = 0; !is_on && j < kRangeCount; j++)
1415 is_on = ranges->at(j).Contains(i); 1432 is_on = ranges->at(j).Contains(i);
1416 OutSet* set = table.Get(i); 1433 OutSet* set = table.Get(i);
1417 CHECK_EQ(is_on, set->Get(0) == false); 1434 CHECK_EQ(is_on, set->Get(0) == false);
1418 } 1435 }
1419 } 1436 }
1420 ZoneScope zone_scope(Isolate::Current(), DELETE_ON_EXIT); 1437 ZoneScope zone_scope(Isolate::Current(), DELETE_ON_EXIT);
1438 Zone* zone = Isolate::Current()->zone();
1421 ZoneList<CharacterRange>* ranges = 1439 ZoneList<CharacterRange>* ranges =
1422 new ZoneList<CharacterRange>(1); 1440 new(zone) ZoneList<CharacterRange>(1, zone);
1423 ranges->Add(CharacterRange(0xFFF0, 0xFFFE)); 1441 ranges->Add(CharacterRange(0xFFF0, 0xFFFE), zone);
1424 DispatchTable table; 1442 DispatchTable table(zone);
1425 DispatchTableConstructor cons(&table, false); 1443 DispatchTableConstructor cons(&table, false, Isolate::Current()->zone());
1426 cons.set_choice_index(0); 1444 cons.set_choice_index(0);
1427 cons.AddInverse(ranges); 1445 cons.AddInverse(ranges);
1428 CHECK(!table.Get(0xFFFE)->Get(0)); 1446 CHECK(!table.Get(0xFFFE)->Get(0));
1429 CHECK(table.Get(0xFFFF)->Get(0)); 1447 CHECK(table.Get(0xFFFF)->Get(0));
1430 } 1448 }
1431 1449
1432 1450
1433 static uc32 canonicalize(uc32 c) { 1451 static uc32 canonicalize(uc32 c) {
1434 unibrow::uchar canon[unibrow::Ecma262Canonicalize::kMaxWidth]; 1452 unibrow::uchar canon[unibrow::Ecma262Canonicalize::kMaxWidth];
1435 int count = unibrow::Ecma262Canonicalize::Convert(c, '\0', canon, NULL); 1453 int count = unibrow::Ecma262Canonicalize::Convert(c, '\0', canon, NULL);
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
1524 for (int k = 0; k < length; k++) 1542 for (int k = 0; k < length; k++)
1525 CHECK_EQ(static_cast<int>(chars[k]), static_cast<int>(chars2[k])); 1543 CHECK_EQ(static_cast<int>(chars[k]), static_cast<int>(chars2[k]));
1526 } 1544 }
1527 } 1545 }
1528 } 1546 }
1529 1547
1530 1548
1531 static void TestRangeCaseIndependence(CharacterRange input, 1549 static void TestRangeCaseIndependence(CharacterRange input,
1532 Vector<CharacterRange> expected) { 1550 Vector<CharacterRange> expected) {
1533 ZoneScope zone_scope(Isolate::Current(), DELETE_ON_EXIT); 1551 ZoneScope zone_scope(Isolate::Current(), DELETE_ON_EXIT);
1552 Zone* zone = Isolate::Current()->zone();
1534 int count = expected.length(); 1553 int count = expected.length();
1535 ZoneList<CharacterRange>* list = new ZoneList<CharacterRange>(count); 1554 ZoneList<CharacterRange>* list =
1536 input.AddCaseEquivalents(list, false); 1555 new(zone) ZoneList<CharacterRange>(count, zone);
1556 input.AddCaseEquivalents(list, false, zone);
1537 CHECK_EQ(count, list->length()); 1557 CHECK_EQ(count, list->length());
1538 for (int i = 0; i < list->length(); i++) { 1558 for (int i = 0; i < list->length(); i++) {
1539 CHECK_EQ(expected[i].from(), list->at(i).from()); 1559 CHECK_EQ(expected[i].from(), list->at(i).from());
1540 CHECK_EQ(expected[i].to(), list->at(i).to()); 1560 CHECK_EQ(expected[i].to(), list->at(i).to());
1541 } 1561 }
1542 } 1562 }
1543 1563
1544 1564
1545 static void TestSimpleRangeCaseIndependence(CharacterRange input, 1565 static void TestSimpleRangeCaseIndependence(CharacterRange input,
1546 CharacterRange expected) { 1566 CharacterRange expected) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1588 if (range.from() <= c && c <= range.to()) 1608 if (range.from() <= c && c <= range.to())
1589 return true; 1609 return true;
1590 } 1610 }
1591 return false; 1611 return false;
1592 } 1612 }
1593 1613
1594 1614
1595 TEST(CharClassDifference) { 1615 TEST(CharClassDifference) {
1596 v8::internal::V8::Initialize(NULL); 1616 v8::internal::V8::Initialize(NULL);
1597 ZoneScope zone_scope(Isolate::Current(), DELETE_ON_EXIT); 1617 ZoneScope zone_scope(Isolate::Current(), DELETE_ON_EXIT);
1598 ZoneList<CharacterRange>* base = new ZoneList<CharacterRange>(1); 1618 Zone* zone = Isolate::Current()->zone();
1599 base->Add(CharacterRange::Everything()); 1619 ZoneList<CharacterRange>* base =
1620 new(zone) ZoneList<CharacterRange>(1, zone);
1621 base->Add(CharacterRange::Everything(), zone);
1600 Vector<const int> overlay = CharacterRange::GetWordBounds(); 1622 Vector<const int> overlay = CharacterRange::GetWordBounds();
1601 ZoneList<CharacterRange>* included = NULL; 1623 ZoneList<CharacterRange>* included = NULL;
1602 ZoneList<CharacterRange>* excluded = NULL; 1624 ZoneList<CharacterRange>* excluded = NULL;
1603 CharacterRange::Split(base, overlay, &included, &excluded); 1625 CharacterRange::Split(base, overlay, &included, &excluded,
1626 Isolate::Current()->zone());
1604 for (int i = 0; i < (1 << 16); i++) { 1627 for (int i = 0; i < (1 << 16); i++) {
1605 bool in_base = InClass(i, base); 1628 bool in_base = InClass(i, base);
1606 if (in_base) { 1629 if (in_base) {
1607 bool in_overlay = false; 1630 bool in_overlay = false;
1608 for (int j = 0; !in_overlay && j < overlay.length(); j += 2) { 1631 for (int j = 0; !in_overlay && j < overlay.length(); j += 2) {
1609 if (overlay[j] <= i && i < overlay[j+1]) 1632 if (overlay[j] <= i && i < overlay[j+1])
1610 in_overlay = true; 1633 in_overlay = true;
1611 } 1634 }
1612 CHECK_EQ(in_overlay, InClass(i, included)); 1635 CHECK_EQ(in_overlay, InClass(i, included));
1613 CHECK_EQ(!in_overlay, InClass(i, excluded)); 1636 CHECK_EQ(!in_overlay, InClass(i, excluded));
1614 } else { 1637 } else {
1615 CHECK(!InClass(i, included)); 1638 CHECK(!InClass(i, included));
1616 CHECK(!InClass(i, excluded)); 1639 CHECK(!InClass(i, excluded));
1617 } 1640 }
1618 } 1641 }
1619 } 1642 }
1620 1643
1621 1644
1622 TEST(CanonicalizeCharacterSets) { 1645 TEST(CanonicalizeCharacterSets) {
1623 v8::internal::V8::Initialize(NULL); 1646 v8::internal::V8::Initialize(NULL);
1624 ZoneScope scope(Isolate::Current(), DELETE_ON_EXIT); 1647 ZoneScope scope(Isolate::Current(), DELETE_ON_EXIT);
1625 ZoneList<CharacterRange>* list = new ZoneList<CharacterRange>(4); 1648 Zone* zone = Isolate::Current()->zone();
1649 ZoneList<CharacterRange>* list =
1650 new(zone) ZoneList<CharacterRange>(4, zone);
1626 CharacterSet set(list); 1651 CharacterSet set(list);
1627 1652
1628 list->Add(CharacterRange(10, 20)); 1653 list->Add(CharacterRange(10, 20), zone);
1629 list->Add(CharacterRange(30, 40)); 1654 list->Add(CharacterRange(30, 40), zone);
1630 list->Add(CharacterRange(50, 60)); 1655 list->Add(CharacterRange(50, 60), zone);
1631 set.Canonicalize(); 1656 set.Canonicalize();
1632 ASSERT_EQ(3, list->length()); 1657 ASSERT_EQ(3, list->length());
1633 ASSERT_EQ(10, list->at(0).from()); 1658 ASSERT_EQ(10, list->at(0).from());
1634 ASSERT_EQ(20, list->at(0).to()); 1659 ASSERT_EQ(20, list->at(0).to());
1635 ASSERT_EQ(30, list->at(1).from()); 1660 ASSERT_EQ(30, list->at(1).from());
1636 ASSERT_EQ(40, list->at(1).to()); 1661 ASSERT_EQ(40, list->at(1).to());
1637 ASSERT_EQ(50, list->at(2).from()); 1662 ASSERT_EQ(50, list->at(2).from());
1638 ASSERT_EQ(60, list->at(2).to()); 1663 ASSERT_EQ(60, list->at(2).to());
1639 1664
1640 list->Rewind(0); 1665 list->Rewind(0);
1641 list->Add(CharacterRange(10, 20)); 1666 list->Add(CharacterRange(10, 20), zone);
1642 list->Add(CharacterRange(50, 60)); 1667 list->Add(CharacterRange(50, 60), zone);
1643 list->Add(CharacterRange(30, 40)); 1668 list->Add(CharacterRange(30, 40), zone);
1644 set.Canonicalize(); 1669 set.Canonicalize();
1645 ASSERT_EQ(3, list->length()); 1670 ASSERT_EQ(3, list->length());
1646 ASSERT_EQ(10, list->at(0).from()); 1671 ASSERT_EQ(10, list->at(0).from());
1647 ASSERT_EQ(20, list->at(0).to()); 1672 ASSERT_EQ(20, list->at(0).to());
1648 ASSERT_EQ(30, list->at(1).from()); 1673 ASSERT_EQ(30, list->at(1).from());
1649 ASSERT_EQ(40, list->at(1).to()); 1674 ASSERT_EQ(40, list->at(1).to());
1650 ASSERT_EQ(50, list->at(2).from()); 1675 ASSERT_EQ(50, list->at(2).from());
1651 ASSERT_EQ(60, list->at(2).to()); 1676 ASSERT_EQ(60, list->at(2).to());
1652 1677
1653 list->Rewind(0); 1678 list->Rewind(0);
1654 list->Add(CharacterRange(30, 40)); 1679 list->Add(CharacterRange(30, 40), zone);
1655 list->Add(CharacterRange(10, 20)); 1680 list->Add(CharacterRange(10, 20), zone);
1656 list->Add(CharacterRange(25, 25)); 1681 list->Add(CharacterRange(25, 25), zone);
1657 list->Add(CharacterRange(100, 100)); 1682 list->Add(CharacterRange(100, 100), zone);
1658 list->Add(CharacterRange(1, 1)); 1683 list->Add(CharacterRange(1, 1), zone);
1659 set.Canonicalize(); 1684 set.Canonicalize();
1660 ASSERT_EQ(5, list->length()); 1685 ASSERT_EQ(5, list->length());
1661 ASSERT_EQ(1, list->at(0).from()); 1686 ASSERT_EQ(1, list->at(0).from());
1662 ASSERT_EQ(1, list->at(0).to()); 1687 ASSERT_EQ(1, list->at(0).to());
1663 ASSERT_EQ(10, list->at(1).from()); 1688 ASSERT_EQ(10, list->at(1).from());
1664 ASSERT_EQ(20, list->at(1).to()); 1689 ASSERT_EQ(20, list->at(1).to());
1665 ASSERT_EQ(25, list->at(2).from()); 1690 ASSERT_EQ(25, list->at(2).from());
1666 ASSERT_EQ(25, list->at(2).to()); 1691 ASSERT_EQ(25, list->at(2).to());
1667 ASSERT_EQ(30, list->at(3).from()); 1692 ASSERT_EQ(30, list->at(3).from());
1668 ASSERT_EQ(40, list->at(3).to()); 1693 ASSERT_EQ(40, list->at(3).to());
1669 ASSERT_EQ(100, list->at(4).from()); 1694 ASSERT_EQ(100, list->at(4).from());
1670 ASSERT_EQ(100, list->at(4).to()); 1695 ASSERT_EQ(100, list->at(4).to());
1671 1696
1672 list->Rewind(0); 1697 list->Rewind(0);
1673 list->Add(CharacterRange(10, 19)); 1698 list->Add(CharacterRange(10, 19), zone);
1674 list->Add(CharacterRange(21, 30)); 1699 list->Add(CharacterRange(21, 30), zone);
1675 list->Add(CharacterRange(20, 20)); 1700 list->Add(CharacterRange(20, 20), zone);
1676 set.Canonicalize(); 1701 set.Canonicalize();
1677 ASSERT_EQ(1, list->length()); 1702 ASSERT_EQ(1, list->length());
1678 ASSERT_EQ(10, list->at(0).from()); 1703 ASSERT_EQ(10, list->at(0).from());
1679 ASSERT_EQ(30, list->at(0).to()); 1704 ASSERT_EQ(30, list->at(0).to());
1680 } 1705 }
1681 1706
1682 1707
1683 TEST(CharacterRangeMerge) { 1708 TEST(CharacterRangeMerge) {
1684 v8::internal::V8::Initialize(NULL); 1709 v8::internal::V8::Initialize(NULL);
1685 ZoneScope zone_scope(Isolate::Current(), DELETE_ON_EXIT); 1710 ZoneScope zone_scope(Isolate::Current(), DELETE_ON_EXIT);
1686 ZoneList<CharacterRange> l1(4); 1711 ZoneList<CharacterRange> l1(4, Isolate::Current()->zone());
1687 ZoneList<CharacterRange> l2(4); 1712 ZoneList<CharacterRange> l2(4, Isolate::Current()->zone());
1713 Zone* zone = Isolate::Current()->zone();
1688 // Create all combinations of intersections of ranges, both singletons and 1714 // Create all combinations of intersections of ranges, both singletons and
1689 // longer. 1715 // longer.
1690 1716
1691 int offset = 0; 1717 int offset = 0;
1692 1718
1693 // The five kinds of singleton intersections: 1719 // The five kinds of singleton intersections:
1694 // X 1720 // X
1695 // Y - outside before 1721 // Y - outside before
1696 // Y - outside touching start 1722 // Y - outside touching start
1697 // Y - overlap 1723 // Y - overlap
1698 // Y - outside touching end 1724 // Y - outside touching end
1699 // Y - outside after 1725 // Y - outside after
1700 1726
1701 for (int i = 0; i < 5; i++) { 1727 for (int i = 0; i < 5; i++) {
1702 l1.Add(CharacterRange::Singleton(offset + 2)); 1728 l1.Add(CharacterRange::Singleton(offset + 2), zone);
1703 l2.Add(CharacterRange::Singleton(offset + i)); 1729 l2.Add(CharacterRange::Singleton(offset + i), zone);
1704 offset += 6; 1730 offset += 6;
1705 } 1731 }
1706 1732
1707 // The seven kinds of singleton/non-singleton intersections: 1733 // The seven kinds of singleton/non-singleton intersections:
1708 // XXX 1734 // XXX
1709 // Y - outside before 1735 // Y - outside before
1710 // Y - outside touching start 1736 // Y - outside touching start
1711 // Y - inside touching start 1737 // Y - inside touching start
1712 // Y - entirely inside 1738 // Y - entirely inside
1713 // Y - inside touching end 1739 // Y - inside touching end
1714 // Y - outside touching end 1740 // Y - outside touching end
1715 // Y - disjoint after 1741 // Y - disjoint after
1716 1742
1717 for (int i = 0; i < 7; i++) { 1743 for (int i = 0; i < 7; i++) {
1718 l1.Add(CharacterRange::Range(offset + 2, offset + 4)); 1744 l1.Add(CharacterRange::Range(offset + 2, offset + 4), zone);
1719 l2.Add(CharacterRange::Singleton(offset + i)); 1745 l2.Add(CharacterRange::Singleton(offset + i), zone);
1720 offset += 8; 1746 offset += 8;
1721 } 1747 }
1722 1748
1723 // The eleven kinds of non-singleton intersections: 1749 // The eleven kinds of non-singleton intersections:
1724 // 1750 //
1725 // XXXXXXXX 1751 // XXXXXXXX
1726 // YYYY - outside before. 1752 // YYYY - outside before.
1727 // YYYY - outside touching start. 1753 // YYYY - outside touching start.
1728 // YYYY - overlapping start 1754 // YYYY - overlapping start
1729 // YYYY - inside touching start 1755 // YYYY - inside touching start
1730 // YYYY - entirely inside 1756 // YYYY - entirely inside
1731 // YYYY - inside touching end 1757 // YYYY - inside touching end
1732 // YYYY - overlapping end 1758 // YYYY - overlapping end
1733 // YYYY - outside touching end 1759 // YYYY - outside touching end
1734 // YYYY - outside after 1760 // YYYY - outside after
1735 // YYYYYYYY - identical 1761 // YYYYYYYY - identical
1736 // YYYYYYYYYYYY - containing entirely. 1762 // YYYYYYYYYYYY - containing entirely.
1737 1763
1738 for (int i = 0; i < 9; i++) { 1764 for (int i = 0; i < 9; i++) {
1739 l1.Add(CharacterRange::Range(offset + 6, offset + 15)); // Length 8. 1765 l1.Add(CharacterRange::Range(offset + 6, offset + 15), zone); // Length 8.
1740 l2.Add(CharacterRange::Range(offset + 2 * i, offset + 2 * i + 3)); 1766 l2.Add(CharacterRange::Range(offset + 2 * i, offset + 2 * i + 3), zone);
1741 offset += 22; 1767 offset += 22;
1742 } 1768 }
1743 l1.Add(CharacterRange::Range(offset + 6, offset + 15)); 1769 l1.Add(CharacterRange::Range(offset + 6, offset + 15), zone);
1744 l2.Add(CharacterRange::Range(offset + 6, offset + 15)); 1770 l2.Add(CharacterRange::Range(offset + 6, offset + 15), zone);
1745 offset += 22; 1771 offset += 22;
1746 l1.Add(CharacterRange::Range(offset + 6, offset + 15)); 1772 l1.Add(CharacterRange::Range(offset + 6, offset + 15), zone);
1747 l2.Add(CharacterRange::Range(offset + 4, offset + 17)); 1773 l2.Add(CharacterRange::Range(offset + 4, offset + 17), zone);
1748 offset += 22; 1774 offset += 22;
1749 1775
1750 // Different kinds of multi-range overlap: 1776 // Different kinds of multi-range overlap:
1751 // XXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXX 1777 // XXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXX
1752 // YYYY Y YYYY Y YYYY Y YYYY Y YYYY Y YYYY Y 1778 // YYYY Y YYYY Y YYYY Y YYYY Y YYYY Y YYYY Y
1753 1779
1754 l1.Add(CharacterRange::Range(offset, offset + 21)); 1780 l1.Add(CharacterRange::Range(offset, offset + 21), zone);
1755 l1.Add(CharacterRange::Range(offset + 31, offset + 52)); 1781 l1.Add(CharacterRange::Range(offset + 31, offset + 52), zone);
1756 for (int i = 0; i < 6; i++) { 1782 for (int i = 0; i < 6; i++) {
1757 l2.Add(CharacterRange::Range(offset + 2, offset + 5)); 1783 l2.Add(CharacterRange::Range(offset + 2, offset + 5), zone);
1758 l2.Add(CharacterRange::Singleton(offset + 8)); 1784 l2.Add(CharacterRange::Singleton(offset + 8), zone);
1759 offset += 9; 1785 offset += 9;
1760 } 1786 }
1761 1787
1762 ASSERT(CharacterRange::IsCanonical(&l1)); 1788 ASSERT(CharacterRange::IsCanonical(&l1));
1763 ASSERT(CharacterRange::IsCanonical(&l2)); 1789 ASSERT(CharacterRange::IsCanonical(&l2));
1764 1790
1765 ZoneList<CharacterRange> first_only(4); 1791 ZoneList<CharacterRange> first_only(4, Isolate::Current()->zone());
1766 ZoneList<CharacterRange> second_only(4); 1792 ZoneList<CharacterRange> second_only(4, Isolate::Current()->zone());
1767 ZoneList<CharacterRange> both(4); 1793 ZoneList<CharacterRange> both(4, Isolate::Current()->zone());
1768 } 1794 }
1769 1795
1770 1796
1771 TEST(Graph) { 1797 TEST(Graph) {
1772 V8::Initialize(NULL); 1798 V8::Initialize(NULL);
1773 Execute("\\b\\w+\\b", false, true, true); 1799 Execute("\\b\\w+\\b", false, true, true);
1774 } 1800 }
OLDNEW
« no previous file with comments | « test/cctest/test-liveedit.cc ('k') | test/cctest/test-strings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698