Index: test/cctest/test-regexp.cc |
diff --git a/test/cctest/test-regexp.cc b/test/cctest/test-regexp.cc |
index d91b1a071badc306d52b4a93868ad42ce3a4d707..325c68606366109cb0305620fe47e722c41eb5ed 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++) { |
@@ -564,7 +567,7 @@ TEST(SplayTreeSimple) { |
v8::internal::V8::Initialize(NULL); |
static const unsigned kLimit = 1000; |
ZoneScope zone_scope(Isolate::Current(), DELETE_ON_EXIT); |
- ZoneSplayTree<TestConfig> tree; |
+ ZoneSplayTree<TestConfig> tree(Isolate::Current()->zone()); |
bool seen[kLimit]; |
for (unsigned i = 0; i < kLimit; i++) seen[i] = false; |
#define CHECK_MAPS_EQUAL() do { \ |
@@ -632,11 +635,12 @@ TEST(DispatchTableConstruction) { |
} |
// Enter test data into dispatch table. |
ZoneScope zone_scope(Isolate::Current(), DELETE_ON_EXIT); |
- DispatchTable table; |
+ DispatchTable table(Isolate::Current()->zone()); |
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 +740,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 +776,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 +834,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 +897,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 +936,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 +984,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 +1035,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 +1093,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 +1151,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 +1254,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 +1293,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 +1412,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); |
+ DispatchTable table(zone); |
+ DispatchTableConstructor cons(&table, false, Isolate::Current()->zone()); |
cons.set_choice_index(0); |
cons.AddInverse(ranges); |
for (int i = 0; i < kLimit; i++) { |
@@ -1418,11 +1435,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)); |
- DispatchTable table; |
- DispatchTableConstructor cons(&table, false); |
+ new(zone) ZoneList<CharacterRange>(1, zone); |
+ ranges->Add(CharacterRange(0xFFF0, 0xFFFE), zone); |
+ DispatchTable table(zone); |
+ DispatchTableConstructor cons(&table, false, Isolate::Current()->zone()); |
cons.set_choice_index(0); |
cons.AddInverse(ranges); |
CHECK(!table.Get(0xFFFE)->Get(0)); |
@@ -1531,9 +1549,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 +1615,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 +1645,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 +1663,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 +1676,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 +1695,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 +1708,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 +1725,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 +1741,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 +1762,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()); |
} |