| Index: test/cctest/test-regexp.cc
|
| diff --git a/test/cctest/test-regexp.cc b/test/cctest/test-regexp.cc
|
| index d91b1a071badc306d52b4a93868ad42ce3a4d707..9357a6195b3f48583351f21067c8093ead148774 100644
|
| --- a/test/cctest/test-regexp.cc
|
| +++ b/test/cctest/test-regexp.cc
|
| @@ -88,7 +88,8 @@ static SmartArrayPointer<const char> Parse(const char* input) {
|
| CHECK(v8::internal::RegExpParser::ParseRegExp(&reader, false, &result));
|
| CHECK(result.tree != NULL);
|
| CHECK(result.error.is_null());
|
| - SmartArrayPointer<const char> output = result.tree->ToString();
|
| + SmartArrayPointer<const char> output =
|
| + result.tree->ToString(Isolate::Current()->zone());
|
| return output;
|
| }
|
|
|
| @@ -469,8 +470,10 @@ static bool NotWord(uc16 c) {
|
|
|
| static void TestCharacterClassEscapes(uc16 c, bool (pred)(uc16 c)) {
|
| ZoneScope scope(Isolate::Current(), DELETE_ON_EXIT);
|
| - ZoneList<CharacterRange>* ranges = new ZoneList<CharacterRange>(2);
|
| - CharacterRange::AddClassEscape(c, ranges);
|
| + Zone* zone = Isolate::Current()->zone();
|
| + ZoneList<CharacterRange>* ranges =
|
| + new(zone) ZoneList<CharacterRange>(2, zone);
|
| + CharacterRange::AddClassEscape(c, ranges, zone);
|
| for (unsigned i = 0; i < (1 << 16); i++) {
|
| bool in_class = false;
|
| for (int j = 0; !in_class && j < ranges->length(); j++) {
|
| @@ -565,6 +568,7 @@ TEST(SplayTreeSimple) {
|
| static const unsigned kLimit = 1000;
|
| ZoneScope zone_scope(Isolate::Current(), DELETE_ON_EXIT);
|
| ZoneSplayTree<TestConfig> tree;
|
| + ZoneAllocationPolicy allocator(Isolate::Current()->zone());
|
| bool seen[kLimit];
|
| for (unsigned i = 0; i < kLimit; i++) seen[i] = false;
|
| #define CHECK_MAPS_EQUAL() do { \
|
| @@ -588,7 +592,7 @@ TEST(SplayTreeSimple) {
|
| // Check that it wasn't there already and then add it.
|
| ZoneSplayTree<TestConfig>::Locator loc;
|
| CHECK(!tree.Find(next, &loc));
|
| - CHECK(tree.Insert(next, &loc));
|
| + CHECK(tree.Insert(next, &loc, allocator));
|
| CHECK_EQ(next, loc.key());
|
| loc.set_value(3 * next);
|
| seen[next] = true;
|
| @@ -636,7 +640,8 @@ TEST(DispatchTableConstruction) {
|
| for (int i = 0; i < kRangeCount; i++) {
|
| uc16* range = ranges[i];
|
| for (int j = 0; j < 2 * kRangeSize; j += 2)
|
| - table.AddRange(CharacterRange(range[j], range[j + 1]), i);
|
| + table.AddRange(CharacterRange(range[j], range[j + 1]), i,
|
| + Isolate::Current()->zone());
|
| }
|
| // Check that the table looks as we would expect
|
| for (int p = 0; p < kLimit; p++) {
|
| @@ -736,7 +741,8 @@ TEST(MacroAssemblerNativeSuccess) {
|
| ContextInitializer initializer;
|
| Factory* factory = Isolate::Current()->factory();
|
|
|
| - ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 4);
|
| + ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 4,
|
| + Isolate::Current()->zone());
|
|
|
| m.Succeed();
|
|
|
| @@ -771,7 +777,8 @@ TEST(MacroAssemblerNativeSimple) {
|
| ContextInitializer initializer;
|
| Factory* factory = Isolate::Current()->factory();
|
|
|
| - ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 4);
|
| + ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 4,
|
| + Isolate::Current()->zone());
|
|
|
| uc16 foo_chars[3] = {'f', 'o', 'o'};
|
| Vector<const uc16> foo(foo_chars, 3);
|
| @@ -828,7 +835,8 @@ TEST(MacroAssemblerNativeSimpleUC16) {
|
| ContextInitializer initializer;
|
| Factory* factory = Isolate::Current()->factory();
|
|
|
| - ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::UC16, 4);
|
| + ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::UC16, 4,
|
| + Isolate::Current()->zone());
|
|
|
| uc16 foo_chars[3] = {'f', 'o', 'o'};
|
| Vector<const uc16> foo(foo_chars, 3);
|
| @@ -890,7 +898,8 @@ TEST(MacroAssemblerNativeBacktrack) {
|
| ContextInitializer initializer;
|
| Factory* factory = Isolate::Current()->factory();
|
|
|
| - ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 0);
|
| + ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 0,
|
| + Isolate::Current()->zone());
|
|
|
| Label fail;
|
| Label backtrack;
|
| @@ -928,7 +937,8 @@ TEST(MacroAssemblerNativeBackReferenceASCII) {
|
| ContextInitializer initializer;
|
| Factory* factory = Isolate::Current()->factory();
|
|
|
| - ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 4);
|
| + ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 4,
|
| + Isolate::Current()->zone());
|
|
|
| m.WriteCurrentPositionToRegister(0, 0);
|
| m.AdvanceCurrentPosition(2);
|
| @@ -975,7 +985,8 @@ TEST(MacroAssemblerNativeBackReferenceUC16) {
|
| ContextInitializer initializer;
|
| Factory* factory = Isolate::Current()->factory();
|
|
|
| - ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::UC16, 4);
|
| + ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::UC16, 4,
|
| + Isolate::Current()->zone());
|
|
|
| m.WriteCurrentPositionToRegister(0, 0);
|
| m.AdvanceCurrentPosition(2);
|
| @@ -1025,7 +1036,8 @@ TEST(MacroAssemblernativeAtStart) {
|
| ContextInitializer initializer;
|
| Factory* factory = Isolate::Current()->factory();
|
|
|
| - ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 0);
|
| + ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 0,
|
| + Isolate::Current()->zone());
|
|
|
| Label not_at_start, newline, fail;
|
| m.CheckNotAtStart(¬_at_start);
|
| @@ -1082,7 +1094,8 @@ TEST(MacroAssemblerNativeBackRefNoCase) {
|
| ContextInitializer initializer;
|
| Factory* factory = Isolate::Current()->factory();
|
|
|
| - ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 4);
|
| + ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 4,
|
| + Isolate::Current()->zone());
|
|
|
| Label fail, succ;
|
|
|
| @@ -1139,7 +1152,8 @@ TEST(MacroAssemblerNativeRegisters) {
|
| ContextInitializer initializer;
|
| Factory* factory = Isolate::Current()->factory();
|
|
|
| - ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 6);
|
| + ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 6,
|
| + Isolate::Current()->zone());
|
|
|
| uc16 foo_chars[3] = {'f', 'o', 'o'};
|
| Vector<const uc16> foo(foo_chars, 3);
|
| @@ -1241,7 +1255,8 @@ TEST(MacroAssemblerStackOverflow) {
|
| Isolate* isolate = Isolate::Current();
|
| Factory* factory = isolate->factory();
|
|
|
| - ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 0);
|
| + ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 0,
|
| + Isolate::Current()->zone());
|
|
|
| Label loop;
|
| m.Bind(&loop);
|
| @@ -1279,7 +1294,8 @@ TEST(MacroAssemblerNativeLotsOfRegisters) {
|
| Isolate* isolate = Isolate::Current();
|
| Factory* factory = isolate->factory();
|
|
|
| - ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 2);
|
| + ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 2,
|
| + Isolate::Current()->zone());
|
|
|
| // At least 2048, to ensure the allocated space for registers
|
| // span one full page.
|
| @@ -1397,16 +1413,18 @@ TEST(AddInverseToTable) {
|
| static const int kRangeCount = 16;
|
| for (int t = 0; t < 10; t++) {
|
| ZoneScope zone_scope(Isolate::Current(), DELETE_ON_EXIT);
|
| + Zone* zone = Isolate::Current()->zone();
|
| ZoneList<CharacterRange>* ranges =
|
| - new ZoneList<CharacterRange>(kRangeCount);
|
| + new(zone)
|
| + ZoneList<CharacterRange>(kRangeCount, zone);
|
| for (int i = 0; i < kRangeCount; i++) {
|
| int from = PseudoRandom(t + 87, i + 25) % kLimit;
|
| int to = from + (PseudoRandom(i + 87, t + 25) % (kLimit / 20));
|
| if (to > kLimit) to = kLimit;
|
| - ranges->Add(CharacterRange(from, to));
|
| + ranges->Add(CharacterRange(from, to), zone);
|
| }
|
| DispatchTable table;
|
| - DispatchTableConstructor cons(&table, false);
|
| + DispatchTableConstructor cons(&table, false, Isolate::Current()->zone());
|
| cons.set_choice_index(0);
|
| cons.AddInverse(ranges);
|
| for (int i = 0; i < kLimit; i++) {
|
| @@ -1418,11 +1436,12 @@ TEST(AddInverseToTable) {
|
| }
|
| }
|
| ZoneScope zone_scope(Isolate::Current(), DELETE_ON_EXIT);
|
| + Zone* zone = Isolate::Current()->zone();
|
| ZoneList<CharacterRange>* ranges =
|
| - new ZoneList<CharacterRange>(1);
|
| - ranges->Add(CharacterRange(0xFFF0, 0xFFFE));
|
| + new(zone) ZoneList<CharacterRange>(1, zone);
|
| + ranges->Add(CharacterRange(0xFFF0, 0xFFFE), zone);
|
| DispatchTable table;
|
| - DispatchTableConstructor cons(&table, false);
|
| + DispatchTableConstructor cons(&table, false, Isolate::Current()->zone());
|
| cons.set_choice_index(0);
|
| cons.AddInverse(ranges);
|
| CHECK(!table.Get(0xFFFE)->Get(0));
|
| @@ -1531,9 +1550,11 @@ TEST(UncanonicalizeEquivalence) {
|
| static void TestRangeCaseIndependence(CharacterRange input,
|
| Vector<CharacterRange> expected) {
|
| ZoneScope zone_scope(Isolate::Current(), DELETE_ON_EXIT);
|
| + Zone* zone = Isolate::Current()->zone();
|
| int count = expected.length();
|
| - ZoneList<CharacterRange>* list = new ZoneList<CharacterRange>(count);
|
| - input.AddCaseEquivalents(list, false);
|
| + ZoneList<CharacterRange>* list =
|
| + new(zone) ZoneList<CharacterRange>(count, zone);
|
| + input.AddCaseEquivalents(list, false, zone);
|
| CHECK_EQ(count, list->length());
|
| for (int i = 0; i < list->length(); i++) {
|
| CHECK_EQ(expected[i].from(), list->at(i).from());
|
| @@ -1595,12 +1616,15 @@ static bool InClass(uc16 c, ZoneList<CharacterRange>* ranges) {
|
| TEST(CharClassDifference) {
|
| v8::internal::V8::Initialize(NULL);
|
| ZoneScope zone_scope(Isolate::Current(), DELETE_ON_EXIT);
|
| - ZoneList<CharacterRange>* base = new ZoneList<CharacterRange>(1);
|
| - base->Add(CharacterRange::Everything());
|
| + Zone* zone = Isolate::Current()->zone();
|
| + ZoneList<CharacterRange>* base =
|
| + new(zone) ZoneList<CharacterRange>(1, zone);
|
| + base->Add(CharacterRange::Everything(), zone);
|
| Vector<const int> overlay = CharacterRange::GetWordBounds();
|
| ZoneList<CharacterRange>* included = NULL;
|
| ZoneList<CharacterRange>* excluded = NULL;
|
| - CharacterRange::Split(base, overlay, &included, &excluded);
|
| + CharacterRange::Split(base, overlay, &included, &excluded,
|
| + Isolate::Current()->zone());
|
| for (int i = 0; i < (1 << 16); i++) {
|
| bool in_base = InClass(i, base);
|
| if (in_base) {
|
| @@ -1622,12 +1646,14 @@ TEST(CharClassDifference) {
|
| TEST(CanonicalizeCharacterSets) {
|
| v8::internal::V8::Initialize(NULL);
|
| ZoneScope scope(Isolate::Current(), DELETE_ON_EXIT);
|
| - ZoneList<CharacterRange>* list = new ZoneList<CharacterRange>(4);
|
| + Zone* zone = Isolate::Current()->zone();
|
| + ZoneList<CharacterRange>* list =
|
| + new(zone) ZoneList<CharacterRange>(4, zone);
|
| CharacterSet set(list);
|
|
|
| - list->Add(CharacterRange(10, 20));
|
| - list->Add(CharacterRange(30, 40));
|
| - list->Add(CharacterRange(50, 60));
|
| + list->Add(CharacterRange(10, 20), zone);
|
| + list->Add(CharacterRange(30, 40), zone);
|
| + list->Add(CharacterRange(50, 60), zone);
|
| set.Canonicalize();
|
| ASSERT_EQ(3, list->length());
|
| ASSERT_EQ(10, list->at(0).from());
|
| @@ -1638,9 +1664,9 @@ TEST(CanonicalizeCharacterSets) {
|
| ASSERT_EQ(60, list->at(2).to());
|
|
|
| list->Rewind(0);
|
| - list->Add(CharacterRange(10, 20));
|
| - list->Add(CharacterRange(50, 60));
|
| - list->Add(CharacterRange(30, 40));
|
| + list->Add(CharacterRange(10, 20), zone);
|
| + list->Add(CharacterRange(50, 60), zone);
|
| + list->Add(CharacterRange(30, 40), zone);
|
| set.Canonicalize();
|
| ASSERT_EQ(3, list->length());
|
| ASSERT_EQ(10, list->at(0).from());
|
| @@ -1651,11 +1677,11 @@ TEST(CanonicalizeCharacterSets) {
|
| ASSERT_EQ(60, list->at(2).to());
|
|
|
| list->Rewind(0);
|
| - list->Add(CharacterRange(30, 40));
|
| - list->Add(CharacterRange(10, 20));
|
| - list->Add(CharacterRange(25, 25));
|
| - list->Add(CharacterRange(100, 100));
|
| - list->Add(CharacterRange(1, 1));
|
| + list->Add(CharacterRange(30, 40), zone);
|
| + list->Add(CharacterRange(10, 20), zone);
|
| + list->Add(CharacterRange(25, 25), zone);
|
| + list->Add(CharacterRange(100, 100), zone);
|
| + list->Add(CharacterRange(1, 1), zone);
|
| set.Canonicalize();
|
| ASSERT_EQ(5, list->length());
|
| ASSERT_EQ(1, list->at(0).from());
|
| @@ -1670,9 +1696,9 @@ TEST(CanonicalizeCharacterSets) {
|
| ASSERT_EQ(100, list->at(4).to());
|
|
|
| list->Rewind(0);
|
| - list->Add(CharacterRange(10, 19));
|
| - list->Add(CharacterRange(21, 30));
|
| - list->Add(CharacterRange(20, 20));
|
| + list->Add(CharacterRange(10, 19), zone);
|
| + list->Add(CharacterRange(21, 30), zone);
|
| + list->Add(CharacterRange(20, 20), zone);
|
| set.Canonicalize();
|
| ASSERT_EQ(1, list->length());
|
| ASSERT_EQ(10, list->at(0).from());
|
| @@ -1683,8 +1709,9 @@ TEST(CanonicalizeCharacterSets) {
|
| TEST(CharacterRangeMerge) {
|
| v8::internal::V8::Initialize(NULL);
|
| ZoneScope zone_scope(Isolate::Current(), DELETE_ON_EXIT);
|
| - ZoneList<CharacterRange> l1(4);
|
| - ZoneList<CharacterRange> l2(4);
|
| + ZoneList<CharacterRange> l1(4, Isolate::Current()->zone());
|
| + ZoneList<CharacterRange> l2(4, Isolate::Current()->zone());
|
| + Zone* zone = Isolate::Current()->zone();
|
| // Create all combinations of intersections of ranges, both singletons and
|
| // longer.
|
|
|
| @@ -1699,8 +1726,8 @@ TEST(CharacterRangeMerge) {
|
| // Y - outside after
|
|
|
| for (int i = 0; i < 5; i++) {
|
| - l1.Add(CharacterRange::Singleton(offset + 2));
|
| - l2.Add(CharacterRange::Singleton(offset + i));
|
| + l1.Add(CharacterRange::Singleton(offset + 2), zone);
|
| + l2.Add(CharacterRange::Singleton(offset + i), zone);
|
| offset += 6;
|
| }
|
|
|
| @@ -1715,8 +1742,8 @@ TEST(CharacterRangeMerge) {
|
| // Y - disjoint after
|
|
|
| for (int i = 0; i < 7; i++) {
|
| - l1.Add(CharacterRange::Range(offset + 2, offset + 4));
|
| - l2.Add(CharacterRange::Singleton(offset + i));
|
| + l1.Add(CharacterRange::Range(offset + 2, offset + 4), zone);
|
| + l2.Add(CharacterRange::Singleton(offset + i), zone);
|
| offset += 8;
|
| }
|
|
|
| @@ -1736,35 +1763,35 @@ TEST(CharacterRangeMerge) {
|
| // YYYYYYYYYYYY - containing entirely.
|
|
|
| for (int i = 0; i < 9; i++) {
|
| - l1.Add(CharacterRange::Range(offset + 6, offset + 15)); // Length 8.
|
| - l2.Add(CharacterRange::Range(offset + 2 * i, offset + 2 * i + 3));
|
| + l1.Add(CharacterRange::Range(offset + 6, offset + 15), zone); // Length 8.
|
| + l2.Add(CharacterRange::Range(offset + 2 * i, offset + 2 * i + 3), zone);
|
| offset += 22;
|
| }
|
| - l1.Add(CharacterRange::Range(offset + 6, offset + 15));
|
| - l2.Add(CharacterRange::Range(offset + 6, offset + 15));
|
| + l1.Add(CharacterRange::Range(offset + 6, offset + 15), zone);
|
| + l2.Add(CharacterRange::Range(offset + 6, offset + 15), zone);
|
| offset += 22;
|
| - l1.Add(CharacterRange::Range(offset + 6, offset + 15));
|
| - l2.Add(CharacterRange::Range(offset + 4, offset + 17));
|
| + l1.Add(CharacterRange::Range(offset + 6, offset + 15), zone);
|
| + l2.Add(CharacterRange::Range(offset + 4, offset + 17), zone);
|
| offset += 22;
|
|
|
| // Different kinds of multi-range overlap:
|
| // XXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXX
|
| // YYYY Y YYYY Y YYYY Y YYYY Y YYYY Y YYYY Y
|
|
|
| - l1.Add(CharacterRange::Range(offset, offset + 21));
|
| - l1.Add(CharacterRange::Range(offset + 31, offset + 52));
|
| + l1.Add(CharacterRange::Range(offset, offset + 21), zone);
|
| + l1.Add(CharacterRange::Range(offset + 31, offset + 52), zone);
|
| for (int i = 0; i < 6; i++) {
|
| - l2.Add(CharacterRange::Range(offset + 2, offset + 5));
|
| - l2.Add(CharacterRange::Singleton(offset + 8));
|
| + l2.Add(CharacterRange::Range(offset + 2, offset + 5), zone);
|
| + l2.Add(CharacterRange::Singleton(offset + 8), zone);
|
| offset += 9;
|
| }
|
|
|
| ASSERT(CharacterRange::IsCanonical(&l1));
|
| ASSERT(CharacterRange::IsCanonical(&l2));
|
|
|
| - ZoneList<CharacterRange> first_only(4);
|
| - ZoneList<CharacterRange> second_only(4);
|
| - ZoneList<CharacterRange> both(4);
|
| + ZoneList<CharacterRange> first_only(4, Isolate::Current()->zone());
|
| + ZoneList<CharacterRange> second_only(4, Isolate::Current()->zone());
|
| + ZoneList<CharacterRange> both(4, Isolate::Current()->zone());
|
| }
|
|
|
|
|
|
|