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

Unified Diff: test/cctest/test-regexp.cc

Issue 868883002: Remove the dependency of Zone on Isolate (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix compilation issues Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cctest/test-parsing.cc ('k') | test/cctest/test-types.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-regexp.cc
diff --git a/test/cctest/test-regexp.cc b/test/cctest/test-regexp.cc
index 8afde463598787103b0abd3917938b9494e5a7f2..8aa9ffb015909ee2e283e85c8938241e72c453a8 100644
--- a/test/cctest/test-regexp.cc
+++ b/test/cctest/test-regexp.cc
@@ -91,21 +91,21 @@ using namespace v8::internal;
static bool CheckParse(const char* input) {
v8::HandleScope scope(CcTest::isolate());
- Zone zone(CcTest::i_isolate());
+ Zone zone;
FlatStringReader reader(CcTest::i_isolate(), CStrVector(input));
RegExpCompileData result;
- return v8::internal::RegExpParser::ParseRegExp(&reader, false, false, &result,
- &zone);
+ return v8::internal::RegExpParser::ParseRegExp(
+ CcTest::i_isolate(), &zone, &reader, false, false, &result);
}
static void CheckParseEq(const char* input, const char* expected) {
v8::HandleScope scope(CcTest::isolate());
- Zone zone(CcTest::i_isolate());
+ Zone zone;
FlatStringReader reader(CcTest::i_isolate(), CStrVector(input));
RegExpCompileData result;
- CHECK(v8::internal::RegExpParser::ParseRegExp(&reader, false, false, &result,
- &zone));
+ CHECK(v8::internal::RegExpParser::ParseRegExp(
+ CcTest::i_isolate(), &zone, &reader, false, false, &result));
CHECK(result.tree != NULL);
CHECK(result.error.is_null());
std::ostringstream os;
@@ -116,11 +116,11 @@ static void CheckParseEq(const char* input, const char* expected) {
static bool CheckSimple(const char* input) {
v8::HandleScope scope(CcTest::isolate());
- Zone zone(CcTest::i_isolate());
+ Zone zone;
FlatStringReader reader(CcTest::i_isolate(), CStrVector(input));
RegExpCompileData result;
- CHECK(v8::internal::RegExpParser::ParseRegExp(&reader, false, false, &result,
- &zone));
+ CHECK(v8::internal::RegExpParser::ParseRegExp(
+ CcTest::i_isolate(), &zone, &reader, false, false, &result));
CHECK(result.tree != NULL);
CHECK(result.error.is_null());
return result.simple;
@@ -134,11 +134,11 @@ struct MinMaxPair {
static MinMaxPair CheckMinMaxMatch(const char* input) {
v8::HandleScope scope(CcTest::isolate());
- Zone zone(CcTest::i_isolate());
+ Zone zone;
FlatStringReader reader(CcTest::i_isolate(), CStrVector(input));
RegExpCompileData result;
- CHECK(v8::internal::RegExpParser::ParseRegExp(&reader, false, false, &result,
- &zone));
+ CHECK(v8::internal::RegExpParser::ParseRegExp(
+ CcTest::i_isolate(), &zone, &reader, false, false, &result));
CHECK(result.tree != NULL);
CHECK(result.error.is_null());
int min_match = result.tree->min_match();
@@ -407,11 +407,11 @@ TEST(ParserRegression) {
static void ExpectError(const char* input,
const char* expected) {
v8::HandleScope scope(CcTest::isolate());
- Zone zone(CcTest::i_isolate());
+ Zone zone;
FlatStringReader reader(CcTest::i_isolate(), CStrVector(input));
RegExpCompileData result;
- CHECK(!v8::internal::RegExpParser::ParseRegExp(&reader, false, false, &result,
- &zone));
+ CHECK(!v8::internal::RegExpParser::ParseRegExp(
+ CcTest::i_isolate(), &zone, &reader, false, false, &result));
CHECK(result.tree == NULL);
CHECK(!result.error.is_null());
SmartArrayPointer<char> str = result.error->ToCString(ALLOW_NULLS);
@@ -476,7 +476,7 @@ static bool NotWord(uc16 c) {
static void TestCharacterClassEscapes(uc16 c, bool (pred)(uc16 c)) {
- Zone zone(CcTest::i_isolate());
+ Zone zone;
ZoneList<CharacterRange>* ranges =
new(&zone) ZoneList<CharacterRange>(2, &zone);
CharacterRange::AddClassEscape(c, ranges, &zone);
@@ -507,16 +507,17 @@ static RegExpNode* Compile(const char* input, bool multiline, bool unicode,
Isolate* isolate = CcTest::i_isolate();
FlatStringReader reader(isolate, CStrVector(input));
RegExpCompileData compile_data;
- if (!v8::internal::RegExpParser::ParseRegExp(&reader, multiline, unicode,
- &compile_data, zone))
+ if (!v8::internal::RegExpParser::ParseRegExp(CcTest::i_isolate(), zone,
+ &reader, multiline, unicode,
+ &compile_data))
return NULL;
Handle<String> pattern = isolate->factory()
->NewStringFromUtf8(CStrVector(input))
.ToHandleChecked();
Handle<String> sample_subject =
isolate->factory()->NewStringFromUtf8(CStrVector("")).ToHandleChecked();
- RegExpEngine::Compile(&compile_data, false, false, multiline, false, pattern,
- sample_subject, is_one_byte, zone);
+ RegExpEngine::Compile(isolate, zone, &compile_data, false, false, multiline,
+ false, pattern, sample_subject, is_one_byte);
return compile_data.node;
}
@@ -524,7 +525,7 @@ static RegExpNode* Compile(const char* input, bool multiline, bool unicode,
static void Execute(const char* input, bool multiline, bool unicode,
bool is_one_byte, bool dot_output = false) {
v8::HandleScope scope(CcTest::isolate());
- Zone zone(CcTest::i_isolate());
+ Zone zone;
RegExpNode* node = Compile(input, multiline, unicode, is_one_byte, &zone);
USE(node);
#ifdef DEBUG
@@ -562,7 +563,7 @@ static unsigned PseudoRandom(int i, int j) {
TEST(SplayTreeSimple) {
static const unsigned kLimit = 1000;
- Zone zone(CcTest::i_isolate());
+ Zone zone;
ZoneSplayTree<TestConfig> tree(&zone);
bool seen[kLimit];
for (unsigned i = 0; i < kLimit; i++) seen[i] = false;
@@ -629,7 +630,7 @@ TEST(DispatchTableConstruction) {
}
}
// Enter test data into dispatch table.
- Zone zone(CcTest::i_isolate());
+ Zone zone;
DispatchTable table(&zone);
for (int i = 0; i < kRangeCount; i++) {
uc16* range = ranges[i];
@@ -741,9 +742,10 @@ TEST(MacroAssemblerNativeSuccess) {
ContextInitializer initializer;
Isolate* isolate = CcTest::i_isolate();
Factory* factory = isolate->factory();
- Zone zone(isolate);
+ Zone zone;
- ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::LATIN1, 4, &zone);
+ ArchRegExpMacroAssembler m(isolate, &zone, NativeRegExpMacroAssembler::LATIN1,
+ 4);
m.Succeed();
@@ -778,9 +780,10 @@ TEST(MacroAssemblerNativeSimple) {
ContextInitializer initializer;
Isolate* isolate = CcTest::i_isolate();
Factory* factory = isolate->factory();
- Zone zone(isolate);
+ Zone zone;
- ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::LATIN1, 4, &zone);
+ ArchRegExpMacroAssembler m(isolate, &zone, NativeRegExpMacroAssembler::LATIN1,
+ 4);
Label fail, backtrack;
m.PushBacktrack(&fail);
@@ -844,9 +847,10 @@ TEST(MacroAssemblerNativeSimpleUC16) {
ContextInitializer initializer;
Isolate* isolate = CcTest::i_isolate();
Factory* factory = isolate->factory();
- Zone zone(isolate);
+ Zone zone;
- ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::UC16, 4, &zone);
+ ArchRegExpMacroAssembler m(isolate, &zone, NativeRegExpMacroAssembler::UC16,
+ 4);
Label fail, backtrack;
m.PushBacktrack(&fail);
@@ -916,9 +920,10 @@ TEST(MacroAssemblerNativeBacktrack) {
ContextInitializer initializer;
Isolate* isolate = CcTest::i_isolate();
Factory* factory = isolate->factory();
- Zone zone(isolate);
+ Zone zone;
- ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::LATIN1, 0, &zone);
+ ArchRegExpMacroAssembler m(isolate, &zone, NativeRegExpMacroAssembler::LATIN1,
+ 0);
Label fail;
Label backtrack;
@@ -956,9 +961,10 @@ TEST(MacroAssemblerNativeBackReferenceLATIN1) {
ContextInitializer initializer;
Isolate* isolate = CcTest::i_isolate();
Factory* factory = isolate->factory();
- Zone zone(isolate);
+ Zone zone;
- ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::LATIN1, 4, &zone);
+ ArchRegExpMacroAssembler m(isolate, &zone, NativeRegExpMacroAssembler::LATIN1,
+ 4);
m.WriteCurrentPositionToRegister(0, 0);
m.AdvanceCurrentPosition(2);
@@ -1005,9 +1011,10 @@ TEST(MacroAssemblerNativeBackReferenceUC16) {
ContextInitializer initializer;
Isolate* isolate = CcTest::i_isolate();
Factory* factory = isolate->factory();
- Zone zone(isolate);
+ Zone zone;
- ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::UC16, 4, &zone);
+ ArchRegExpMacroAssembler m(isolate, &zone, NativeRegExpMacroAssembler::UC16,
+ 4);
m.WriteCurrentPositionToRegister(0, 0);
m.AdvanceCurrentPosition(2);
@@ -1057,9 +1064,10 @@ TEST(MacroAssemblernativeAtStart) {
ContextInitializer initializer;
Isolate* isolate = CcTest::i_isolate();
Factory* factory = isolate->factory();
- Zone zone(isolate);
+ Zone zone;
- ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::LATIN1, 0, &zone);
+ ArchRegExpMacroAssembler m(isolate, &zone, NativeRegExpMacroAssembler::LATIN1,
+ 0);
Label not_at_start, newline, fail;
m.CheckNotAtStart(&not_at_start);
@@ -1116,9 +1124,10 @@ TEST(MacroAssemblerNativeBackRefNoCase) {
ContextInitializer initializer;
Isolate* isolate = CcTest::i_isolate();
Factory* factory = isolate->factory();
- Zone zone(isolate);
+ Zone zone;
- ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::LATIN1, 4, &zone);
+ ArchRegExpMacroAssembler m(isolate, &zone, NativeRegExpMacroAssembler::LATIN1,
+ 4);
Label fail, succ;
@@ -1174,9 +1183,10 @@ TEST(MacroAssemblerNativeRegisters) {
ContextInitializer initializer;
Isolate* isolate = CcTest::i_isolate();
Factory* factory = isolate->factory();
- Zone zone(isolate);
+ Zone zone;
- ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::LATIN1, 6, &zone);
+ ArchRegExpMacroAssembler m(isolate, &zone, NativeRegExpMacroAssembler::LATIN1,
+ 6);
uc16 foo_chars[3] = {'f', 'o', 'o'};
Vector<const uc16> foo(foo_chars, 3);
@@ -1275,9 +1285,10 @@ TEST(MacroAssemblerStackOverflow) {
ContextInitializer initializer;
Isolate* isolate = CcTest::i_isolate();
Factory* factory = isolate->factory();
- Zone zone(isolate);
+ Zone zone;
- ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::LATIN1, 0, &zone);
+ ArchRegExpMacroAssembler m(isolate, &zone, NativeRegExpMacroAssembler::LATIN1,
+ 0);
Label loop;
m.Bind(&loop);
@@ -1313,9 +1324,10 @@ TEST(MacroAssemblerNativeLotsOfRegisters) {
ContextInitializer initializer;
Isolate* isolate = CcTest::i_isolate();
Factory* factory = isolate->factory();
- Zone zone(isolate);
+ Zone zone;
- ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::LATIN1, 2, &zone);
+ ArchRegExpMacroAssembler m(isolate, &zone, NativeRegExpMacroAssembler::LATIN1,
+ 2);
// At least 2048, to ensure the allocated space for registers
// span one full page.
@@ -1427,7 +1439,7 @@ TEST(AddInverseToTable) {
static const int kLimit = 1000;
static const int kRangeCount = 16;
for (int t = 0; t < 10; t++) {
- Zone zone(CcTest::i_isolate());
+ Zone zone;
ZoneList<CharacterRange>* ranges =
new(&zone) ZoneList<CharacterRange>(kRangeCount, &zone);
for (int i = 0; i < kRangeCount; i++) {
@@ -1448,7 +1460,7 @@ TEST(AddInverseToTable) {
CHECK_EQ(is_on, set->Get(0) == false);
}
}
- Zone zone(CcTest::i_isolate());
+ Zone zone;
ZoneList<CharacterRange>* ranges =
new(&zone) ZoneList<CharacterRange>(1, &zone);
ranges->Add(CharacterRange(0xFFF0, 0xFFFE), &zone);
@@ -1559,13 +1571,13 @@ TEST(UncanonicalizeEquivalence) {
}
-static void TestRangeCaseIndependence(CharacterRange input,
+static void TestRangeCaseIndependence(Isolate* isolate, CharacterRange input,
Vector<CharacterRange> expected) {
- Zone zone(CcTest::i_isolate());
+ Zone zone;
int count = expected.length();
ZoneList<CharacterRange>* list =
new(&zone) ZoneList<CharacterRange>(count, &zone);
- input.AddCaseEquivalents(list, false, &zone);
+ input.AddCaseEquivalents(isolate, &zone, list, false);
CHECK_EQ(count, list->length());
for (int i = 0; i < list->length(); i++) {
CHECK_EQ(expected[i].from(), list->at(i).from());
@@ -1574,39 +1586,41 @@ static void TestRangeCaseIndependence(CharacterRange input,
}
-static void TestSimpleRangeCaseIndependence(CharacterRange input,
+static void TestSimpleRangeCaseIndependence(Isolate* isolate,
+ CharacterRange input,
CharacterRange expected) {
EmbeddedVector<CharacterRange, 1> vector;
vector[0] = expected;
- TestRangeCaseIndependence(input, vector);
+ TestRangeCaseIndependence(isolate, input, vector);
}
TEST(CharacterRangeCaseIndependence) {
- TestSimpleRangeCaseIndependence(CharacterRange::Singleton('a'),
+ Isolate* isolate = CcTest::i_isolate();
+ TestSimpleRangeCaseIndependence(isolate, CharacterRange::Singleton('a'),
CharacterRange::Singleton('A'));
- TestSimpleRangeCaseIndependence(CharacterRange::Singleton('z'),
+ TestSimpleRangeCaseIndependence(isolate, CharacterRange::Singleton('z'),
CharacterRange::Singleton('Z'));
- TestSimpleRangeCaseIndependence(CharacterRange('a', 'z'),
+ TestSimpleRangeCaseIndependence(isolate, CharacterRange('a', 'z'),
CharacterRange('A', 'Z'));
- TestSimpleRangeCaseIndependence(CharacterRange('c', 'f'),
+ TestSimpleRangeCaseIndependence(isolate, CharacterRange('c', 'f'),
CharacterRange('C', 'F'));
- TestSimpleRangeCaseIndependence(CharacterRange('a', 'b'),
+ TestSimpleRangeCaseIndependence(isolate, CharacterRange('a', 'b'),
CharacterRange('A', 'B'));
- TestSimpleRangeCaseIndependence(CharacterRange('y', 'z'),
+ TestSimpleRangeCaseIndependence(isolate, CharacterRange('y', 'z'),
CharacterRange('Y', 'Z'));
- TestSimpleRangeCaseIndependence(CharacterRange('a' - 1, 'z' + 1),
+ TestSimpleRangeCaseIndependence(isolate, CharacterRange('a' - 1, 'z' + 1),
CharacterRange('A', 'Z'));
- TestSimpleRangeCaseIndependence(CharacterRange('A', 'Z'),
+ TestSimpleRangeCaseIndependence(isolate, CharacterRange('A', 'Z'),
CharacterRange('a', 'z'));
- TestSimpleRangeCaseIndependence(CharacterRange('C', 'F'),
+ TestSimpleRangeCaseIndependence(isolate, CharacterRange('C', 'F'),
CharacterRange('c', 'f'));
- TestSimpleRangeCaseIndependence(CharacterRange('A' - 1, 'Z' + 1),
+ TestSimpleRangeCaseIndependence(isolate, CharacterRange('A' - 1, 'Z' + 1),
CharacterRange('a', 'z'));
// Here we need to add [l-z] to complete the case independence of
// [A-Za-z] but we expect [a-z] to be added since we always add a
// whole block at a time.
- TestSimpleRangeCaseIndependence(CharacterRange('A', 'k'),
+ TestSimpleRangeCaseIndependence(isolate, CharacterRange('A', 'k'),
CharacterRange('a', 'z'));
}
@@ -1624,7 +1638,7 @@ static bool InClass(uc16 c, ZoneList<CharacterRange>* ranges) {
TEST(CharClassDifference) {
- Zone zone(CcTest::i_isolate());
+ Zone zone;
ZoneList<CharacterRange>* base =
new(&zone) ZoneList<CharacterRange>(1, &zone);
base->Add(CharacterRange::Everything(), &zone);
@@ -1651,7 +1665,7 @@ TEST(CharClassDifference) {
TEST(CanonicalizeCharacterSets) {
- Zone zone(CcTest::i_isolate());
+ Zone zone;
ZoneList<CharacterRange>* list =
new(&zone) ZoneList<CharacterRange>(4, &zone);
CharacterSet set(list);
@@ -1712,7 +1726,7 @@ TEST(CanonicalizeCharacterSets) {
TEST(CharacterRangeMerge) {
- Zone zone(CcTest::i_isolate());
+ Zone zone;
ZoneList<CharacterRange> l1(4, &zone);
ZoneList<CharacterRange> l2(4, &zone);
// Create all combinations of intersections of ranges, both singletons and
« no previous file with comments | « test/cctest/test-parsing.cc ('k') | test/cctest/test-types.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698