| Index: test/cctest/test-regexp.cc
|
| diff --git a/test/cctest/test-regexp.cc b/test/cctest/test-regexp.cc
|
| index ac62b752c0c8d1b0f7bcee273d4a73bfd2e25f96..f810fcdb28d77da9e33eb3e5769e78907678a5e5 100644
|
| --- a/test/cctest/test-regexp.cc
|
| +++ b/test/cctest/test-regexp.cc
|
| @@ -72,37 +72,36 @@ using namespace v8::internal;
|
| static bool CheckParse(const char* input) {
|
| V8::Initialize(NULL);
|
| v8::HandleScope scope(v8::Isolate::GetCurrent());
|
| - ZoneScope zone_scope(Isolate::Current()->runtime_zone(), DELETE_ON_EXIT);
|
| + Zone zone(Isolate::Current());
|
| FlatStringReader reader(Isolate::Current(), CStrVector(input));
|
| RegExpCompileData result;
|
| return v8::internal::RegExpParser::ParseRegExp(
|
| - &reader, false, &result, Isolate::Current()->runtime_zone());
|
| + &reader, false, &result, &zone);
|
| }
|
|
|
|
|
| static SmartArrayPointer<const char> Parse(const char* input) {
|
| V8::Initialize(NULL);
|
| v8::HandleScope scope(v8::Isolate::GetCurrent());
|
| - ZoneScope zone_scope(Isolate::Current()->runtime_zone(), DELETE_ON_EXIT);
|
| + Zone zone(Isolate::Current());
|
| FlatStringReader reader(Isolate::Current(), CStrVector(input));
|
| RegExpCompileData result;
|
| CHECK(v8::internal::RegExpParser::ParseRegExp(
|
| - &reader, false, &result, Isolate::Current()->runtime_zone()));
|
| + &reader, false, &result, &zone));
|
| CHECK(result.tree != NULL);
|
| CHECK(result.error.is_null());
|
| - SmartArrayPointer<const char> output =
|
| - result.tree->ToString(Isolate::Current()->runtime_zone());
|
| + SmartArrayPointer<const char> output = result.tree->ToString(&zone);
|
| return output;
|
| }
|
|
|
| static bool CheckSimple(const char* input) {
|
| V8::Initialize(NULL);
|
| v8::HandleScope scope(v8::Isolate::GetCurrent());
|
| - ZoneScope zone_scope(Isolate::Current()->runtime_zone(), DELETE_ON_EXIT);
|
| + Zone zone(Isolate::Current());
|
| FlatStringReader reader(Isolate::Current(), CStrVector(input));
|
| RegExpCompileData result;
|
| CHECK(v8::internal::RegExpParser::ParseRegExp(
|
| - &reader, false, &result, Isolate::Current()->runtime_zone()));
|
| + &reader, false, &result, &zone));
|
| CHECK(result.tree != NULL);
|
| CHECK(result.error.is_null());
|
| return result.simple;
|
| @@ -116,11 +115,11 @@ struct MinMaxPair {
|
| static MinMaxPair CheckMinMaxMatch(const char* input) {
|
| V8::Initialize(NULL);
|
| v8::HandleScope scope(v8::Isolate::GetCurrent());
|
| - ZoneScope zone_scope(Isolate::Current()->runtime_zone(), DELETE_ON_EXIT);
|
| + Zone zone(Isolate::Current());
|
| FlatStringReader reader(Isolate::Current(), CStrVector(input));
|
| RegExpCompileData result;
|
| CHECK(v8::internal::RegExpParser::ParseRegExp(
|
| - &reader, false, &result, Isolate::Current()->runtime_zone()));
|
| + &reader, false, &result, &zone));
|
| CHECK(result.tree != NULL);
|
| CHECK(result.error.is_null());
|
| int min_match = result.tree->min_match();
|
| @@ -389,11 +388,11 @@ static void ExpectError(const char* input,
|
| const char* expected) {
|
| V8::Initialize(NULL);
|
| v8::HandleScope scope(v8::Isolate::GetCurrent());
|
| - ZoneScope zone_scope(Isolate::Current()->runtime_zone(), DELETE_ON_EXIT);
|
| + Zone zone(Isolate::Current());
|
| FlatStringReader reader(Isolate::Current(), CStrVector(input));
|
| RegExpCompileData result;
|
| CHECK(!v8::internal::RegExpParser::ParseRegExp(
|
| - &reader, false, &result, Isolate::Current()->runtime_zone()));
|
| + &reader, false, &result, &zone));
|
| CHECK(result.tree == NULL);
|
| CHECK(!result.error.is_null());
|
| SmartArrayPointer<char> str = result.error->ToCString(ALLOW_NULLS);
|
| @@ -473,11 +472,10 @@ static bool NotWord(uc16 c) {
|
|
|
|
|
| static void TestCharacterClassEscapes(uc16 c, bool (pred)(uc16 c)) {
|
| - ZoneScope scope(Isolate::Current()->runtime_zone(), DELETE_ON_EXIT);
|
| - Zone* zone = Isolate::Current()->runtime_zone();
|
| + Zone zone(Isolate::Current());
|
| ZoneList<CharacterRange>* ranges =
|
| - new(zone) ZoneList<CharacterRange>(2, zone);
|
| - CharacterRange::AddClassEscape(c, ranges, zone);
|
| + 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++) {
|
| @@ -501,14 +499,16 @@ TEST(CharacterClassEscapes) {
|
| }
|
|
|
|
|
| -static RegExpNode* Compile(const char* input, bool multiline, bool is_ascii) {
|
| +static RegExpNode* Compile(const char* input,
|
| + bool multiline,
|
| + bool is_ascii,
|
| + Zone* zone) {
|
| V8::Initialize(NULL);
|
| Isolate* isolate = Isolate::Current();
|
| FlatStringReader reader(isolate, CStrVector(input));
|
| RegExpCompileData compile_data;
|
| if (!v8::internal::RegExpParser::ParseRegExp(&reader, multiline,
|
| - &compile_data,
|
| - isolate->runtime_zone()))
|
| + &compile_data, zone))
|
| return NULL;
|
| Handle<String> pattern = isolate->factory()->
|
| NewStringFromUtf8(CStrVector(input));
|
| @@ -521,7 +521,7 @@ static RegExpNode* Compile(const char* input, bool multiline, bool is_ascii) {
|
| pattern,
|
| sample_subject,
|
| is_ascii,
|
| - isolate->runtime_zone());
|
| + zone);
|
| return compile_data.node;
|
| }
|
|
|
| @@ -531,8 +531,8 @@ static void Execute(const char* input,
|
| bool is_ascii,
|
| bool dot_output = false) {
|
| v8::HandleScope scope(v8::Isolate::GetCurrent());
|
| - ZoneScope zone_scope(Isolate::Current()->runtime_zone(), DELETE_ON_EXIT);
|
| - RegExpNode* node = Compile(input, multiline, is_ascii);
|
| + Zone zone(Isolate::Current());
|
| + RegExpNode* node = Compile(input, multiline, is_ascii, &zone);
|
| USE(node);
|
| #ifdef DEBUG
|
| if (dot_output) {
|
| @@ -571,8 +571,8 @@ static unsigned PseudoRandom(int i, int j) {
|
| TEST(SplayTreeSimple) {
|
| v8::internal::V8::Initialize(NULL);
|
| static const unsigned kLimit = 1000;
|
| - ZoneScope zone_scope(Isolate::Current()->runtime_zone(), DELETE_ON_EXIT);
|
| - ZoneSplayTree<TestConfig> tree(Isolate::Current()->runtime_zone());
|
| + Zone zone(Isolate::Current());
|
| + ZoneSplayTree<TestConfig> tree(&zone);
|
| bool seen[kLimit];
|
| for (unsigned i = 0; i < kLimit; i++) seen[i] = false;
|
| #define CHECK_MAPS_EQUAL() do { \
|
| @@ -639,13 +639,12 @@ TEST(DispatchTableConstruction) {
|
| }
|
| }
|
| // Enter test data into dispatch table.
|
| - ZoneScope zone_scope(Isolate::Current()->runtime_zone(), DELETE_ON_EXIT);
|
| - DispatchTable table(Isolate::Current()->runtime_zone());
|
| + Zone zone(Isolate::Current());
|
| + DispatchTable table(&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,
|
| - Isolate::Current()->runtime_zone());
|
| + table.AddRange(CharacterRange(range[j], range[j + 1]), i, &zone);
|
| }
|
| // Check that the table looks as we would expect
|
| for (int p = 0; p < kLimit; p++) {
|
| @@ -708,8 +707,7 @@ class ContextInitializer {
|
| public:
|
| ContextInitializer()
|
| : scope_(v8::Isolate::GetCurrent()),
|
| - env_(v8::Context::New(v8::Isolate::GetCurrent())),
|
| - zone_(Isolate::Current()->runtime_zone(), DELETE_ON_EXIT) {
|
| + env_(v8::Context::New(v8::Isolate::GetCurrent())) {
|
| env_->Enter();
|
| }
|
| ~ContextInitializer() {
|
| @@ -718,7 +716,6 @@ class ContextInitializer {
|
| private:
|
| v8::HandleScope scope_;
|
| v8::Handle<v8::Context> env_;
|
| - v8::internal::ZoneScope zone_;
|
| };
|
|
|
|
|
| @@ -743,10 +740,11 @@ static ArchRegExpMacroAssembler::Result Execute(Code* code,
|
| TEST(MacroAssemblerNativeSuccess) {
|
| v8::V8::Initialize();
|
| ContextInitializer initializer;
|
| - Factory* factory = Isolate::Current()->factory();
|
| + Isolate* isolate = Isolate::Current();
|
| + Factory* factory = isolate->factory();
|
| + Zone zone(isolate);
|
|
|
| - ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 4,
|
| - Isolate::Current()->runtime_zone());
|
| + ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 4, &zone);
|
|
|
| m.Succeed();
|
|
|
| @@ -779,10 +777,11 @@ TEST(MacroAssemblerNativeSuccess) {
|
| TEST(MacroAssemblerNativeSimple) {
|
| v8::V8::Initialize();
|
| ContextInitializer initializer;
|
| - Factory* factory = Isolate::Current()->factory();
|
| + Isolate* isolate = Isolate::Current();
|
| + Factory* factory = isolate->factory();
|
| + Zone zone(isolate);
|
|
|
| - ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 4,
|
| - Isolate::Current()->runtime_zone());
|
| + ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 4, &zone);
|
|
|
| Label fail, backtrack;
|
| m.PushBacktrack(&fail);
|
| @@ -844,10 +843,11 @@ TEST(MacroAssemblerNativeSimple) {
|
| TEST(MacroAssemblerNativeSimpleUC16) {
|
| v8::V8::Initialize();
|
| ContextInitializer initializer;
|
| - Factory* factory = Isolate::Current()->factory();
|
| + Isolate* isolate = Isolate::Current();
|
| + Factory* factory = isolate->factory();
|
| + Zone zone(isolate);
|
|
|
| - ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::UC16, 4,
|
| - Isolate::Current()->runtime_zone());
|
| + ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::UC16, 4, &zone);
|
|
|
| Label fail, backtrack;
|
| m.PushBacktrack(&fail);
|
| @@ -914,10 +914,11 @@ TEST(MacroAssemblerNativeSimpleUC16) {
|
| TEST(MacroAssemblerNativeBacktrack) {
|
| v8::V8::Initialize();
|
| ContextInitializer initializer;
|
| - Factory* factory = Isolate::Current()->factory();
|
| + Isolate* isolate = Isolate::Current();
|
| + Factory* factory = isolate->factory();
|
| + Zone zone(isolate);
|
|
|
| - ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 0,
|
| - Isolate::Current()->runtime_zone());
|
| + ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 0, &zone);
|
|
|
| Label fail;
|
| Label backtrack;
|
| @@ -953,10 +954,11 @@ TEST(MacroAssemblerNativeBacktrack) {
|
| TEST(MacroAssemblerNativeBackReferenceASCII) {
|
| v8::V8::Initialize();
|
| ContextInitializer initializer;
|
| - Factory* factory = Isolate::Current()->factory();
|
| + Isolate* isolate = Isolate::Current();
|
| + Factory* factory = isolate->factory();
|
| + Zone zone(isolate);
|
|
|
| - ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 4,
|
| - Isolate::Current()->runtime_zone());
|
| + ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 4, &zone);
|
|
|
| m.WriteCurrentPositionToRegister(0, 0);
|
| m.AdvanceCurrentPosition(2);
|
| @@ -1001,10 +1003,11 @@ TEST(MacroAssemblerNativeBackReferenceASCII) {
|
| TEST(MacroAssemblerNativeBackReferenceUC16) {
|
| v8::V8::Initialize();
|
| ContextInitializer initializer;
|
| - Factory* factory = Isolate::Current()->factory();
|
| + Isolate* isolate = Isolate::Current();
|
| + Factory* factory = isolate->factory();
|
| + Zone zone(isolate);
|
|
|
| - ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::UC16, 4,
|
| - Isolate::Current()->runtime_zone());
|
| + ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::UC16, 4, &zone);
|
|
|
| m.WriteCurrentPositionToRegister(0, 0);
|
| m.AdvanceCurrentPosition(2);
|
| @@ -1052,10 +1055,11 @@ TEST(MacroAssemblerNativeBackReferenceUC16) {
|
| TEST(MacroAssemblernativeAtStart) {
|
| v8::V8::Initialize();
|
| ContextInitializer initializer;
|
| - Factory* factory = Isolate::Current()->factory();
|
| + Isolate* isolate = Isolate::Current();
|
| + Factory* factory = isolate->factory();
|
| + Zone zone(isolate);
|
|
|
| - ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 0,
|
| - Isolate::Current()->runtime_zone());
|
| + ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 0, &zone);
|
|
|
| Label not_at_start, newline, fail;
|
| m.CheckNotAtStart(¬_at_start);
|
| @@ -1110,10 +1114,11 @@ TEST(MacroAssemblernativeAtStart) {
|
| TEST(MacroAssemblerNativeBackRefNoCase) {
|
| v8::V8::Initialize();
|
| ContextInitializer initializer;
|
| - Factory* factory = Isolate::Current()->factory();
|
| + Isolate* isolate = Isolate::Current();
|
| + Factory* factory = isolate->factory();
|
| + Zone zone(isolate);
|
|
|
| - ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 4,
|
| - Isolate::Current()->runtime_zone());
|
| + ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 4, &zone);
|
|
|
| Label fail, succ;
|
|
|
| @@ -1168,10 +1173,11 @@ TEST(MacroAssemblerNativeBackRefNoCase) {
|
| TEST(MacroAssemblerNativeRegisters) {
|
| v8::V8::Initialize();
|
| ContextInitializer initializer;
|
| - Factory* factory = Isolate::Current()->factory();
|
| + Isolate* isolate = Isolate::Current();
|
| + Factory* factory = isolate->factory();
|
| + Zone zone(isolate);
|
|
|
| - ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 6,
|
| - Isolate::Current()->runtime_zone());
|
| + ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 6, &zone);
|
|
|
| uc16 foo_chars[3] = {'f', 'o', 'o'};
|
| Vector<const uc16> foo(foo_chars, 3);
|
| @@ -1272,9 +1278,9 @@ TEST(MacroAssemblerStackOverflow) {
|
| ContextInitializer initializer;
|
| Isolate* isolate = Isolate::Current();
|
| Factory* factory = isolate->factory();
|
| + Zone zone(isolate);
|
|
|
| - ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 0,
|
| - Isolate::Current()->runtime_zone());
|
| + ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 0, &zone);
|
|
|
| Label loop;
|
| m.Bind(&loop);
|
| @@ -1311,9 +1317,9 @@ TEST(MacroAssemblerNativeLotsOfRegisters) {
|
| ContextInitializer initializer;
|
| Isolate* isolate = Isolate::Current();
|
| Factory* factory = isolate->factory();
|
| + Zone zone(isolate);
|
|
|
| - ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 2,
|
| - Isolate::Current()->runtime_zone());
|
| + ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 2, &zone);
|
|
|
| // At least 2048, to ensure the allocated space for registers
|
| // span one full page.
|
| @@ -1360,8 +1366,8 @@ TEST(MacroAssemblerNativeLotsOfRegisters) {
|
| TEST(MacroAssembler) {
|
| V8::Initialize(NULL);
|
| byte codes[1024];
|
| - RegExpMacroAssemblerIrregexp m(Vector<byte>(codes, 1024),
|
| - Isolate::Current()->runtime_zone());
|
| + Zone zone(Isolate::Current());
|
| + RegExpMacroAssemblerIrregexp m(Vector<byte>(codes, 1024), &zone);
|
| // ^f(o)o.
|
| Label start, fail, backtrack;
|
|
|
| @@ -1428,20 +1434,17 @@ TEST(AddInverseToTable) {
|
| static const int kLimit = 1000;
|
| static const int kRangeCount = 16;
|
| for (int t = 0; t < 10; t++) {
|
| - ZoneScope zone_scope(Isolate::Current()->runtime_zone(), DELETE_ON_EXIT);
|
| - Zone* zone = Isolate::Current()->runtime_zone();
|
| + Zone zone(Isolate::Current());
|
| ZoneList<CharacterRange>* ranges =
|
| - new(zone)
|
| - ZoneList<CharacterRange>(kRangeCount, zone);
|
| + 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), zone);
|
| + ranges->Add(CharacterRange(from, to), &zone);
|
| }
|
| - DispatchTable table(zone);
|
| - DispatchTableConstructor cons(&table, false,
|
| - Isolate::Current()->runtime_zone());
|
| + DispatchTable table(&zone);
|
| + DispatchTableConstructor cons(&table, false, &zone);
|
| cons.set_choice_index(0);
|
| cons.AddInverse(ranges);
|
| for (int i = 0; i < kLimit; i++) {
|
| @@ -1452,14 +1455,12 @@ TEST(AddInverseToTable) {
|
| CHECK_EQ(is_on, set->Get(0) == false);
|
| }
|
| }
|
| - ZoneScope zone_scope(Isolate::Current()->runtime_zone(), DELETE_ON_EXIT);
|
| - Zone* zone = Isolate::Current()->runtime_zone();
|
| + Zone zone(Isolate::Current());
|
| ZoneList<CharacterRange>* ranges =
|
| - new(zone) ZoneList<CharacterRange>(1, zone);
|
| - ranges->Add(CharacterRange(0xFFF0, 0xFFFE), zone);
|
| - DispatchTable table(zone);
|
| - DispatchTableConstructor cons(&table, false,
|
| - Isolate::Current()->runtime_zone());
|
| + new(&zone) ZoneList<CharacterRange>(1, &zone);
|
| + ranges->Add(CharacterRange(0xFFF0, 0xFFFE), &zone);
|
| + DispatchTable table(&zone);
|
| + DispatchTableConstructor cons(&table, false, &zone);
|
| cons.set_choice_index(0);
|
| cons.AddInverse(ranges);
|
| CHECK(!table.Get(0xFFFE)->Get(0));
|
| @@ -1567,12 +1568,11 @@ TEST(UncanonicalizeEquivalence) {
|
|
|
| static void TestRangeCaseIndependence(CharacterRange input,
|
| Vector<CharacterRange> expected) {
|
| - ZoneScope zone_scope(Isolate::Current()->runtime_zone(), DELETE_ON_EXIT);
|
| - Zone* zone = Isolate::Current()->runtime_zone();
|
| + Zone zone(Isolate::Current());
|
| int count = expected.length();
|
| ZoneList<CharacterRange>* list =
|
| - new(zone) ZoneList<CharacterRange>(count, zone);
|
| - input.AddCaseEquivalents(list, false, zone);
|
| + 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());
|
| @@ -1633,16 +1633,14 @@ static bool InClass(uc16 c, ZoneList<CharacterRange>* ranges) {
|
|
|
| TEST(CharClassDifference) {
|
| v8::internal::V8::Initialize(NULL);
|
| - ZoneScope zone_scope(Isolate::Current()->runtime_zone(), DELETE_ON_EXIT);
|
| - Zone* zone = Isolate::Current()->runtime_zone();
|
| + Zone zone(Isolate::Current());
|
| ZoneList<CharacterRange>* base =
|
| - new(zone) ZoneList<CharacterRange>(1, zone);
|
| - base->Add(CharacterRange::Everything(), zone);
|
| + 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,
|
| - Isolate::Current()->runtime_zone());
|
| + CharacterRange::Split(base, overlay, &included, &excluded, &zone);
|
| for (int i = 0; i < (1 << 16); i++) {
|
| bool in_base = InClass(i, base);
|
| if (in_base) {
|
| @@ -1663,15 +1661,14 @@ TEST(CharClassDifference) {
|
|
|
| TEST(CanonicalizeCharacterSets) {
|
| v8::internal::V8::Initialize(NULL);
|
| - ZoneScope scope(Isolate::Current()->runtime_zone(), DELETE_ON_EXIT);
|
| - Zone* zone = Isolate::Current()->runtime_zone();
|
| + Zone zone(Isolate::Current());
|
| ZoneList<CharacterRange>* list =
|
| - new(zone) ZoneList<CharacterRange>(4, zone);
|
| + new(&zone) ZoneList<CharacterRange>(4, &zone);
|
| CharacterSet set(list);
|
|
|
| - list->Add(CharacterRange(10, 20), zone);
|
| - list->Add(CharacterRange(30, 40), zone);
|
| - list->Add(CharacterRange(50, 60), zone);
|
| + 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());
|
| @@ -1682,9 +1679,9 @@ TEST(CanonicalizeCharacterSets) {
|
| ASSERT_EQ(60, list->at(2).to());
|
|
|
| list->Rewind(0);
|
| - list->Add(CharacterRange(10, 20), zone);
|
| - list->Add(CharacterRange(50, 60), zone);
|
| - list->Add(CharacterRange(30, 40), zone);
|
| + 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());
|
| @@ -1695,11 +1692,11 @@ TEST(CanonicalizeCharacterSets) {
|
| ASSERT_EQ(60, list->at(2).to());
|
|
|
| list->Rewind(0);
|
| - 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);
|
| + 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());
|
| @@ -1714,9 +1711,9 @@ TEST(CanonicalizeCharacterSets) {
|
| ASSERT_EQ(100, list->at(4).to());
|
|
|
| list->Rewind(0);
|
| - list->Add(CharacterRange(10, 19), zone);
|
| - list->Add(CharacterRange(21, 30), zone);
|
| - list->Add(CharacterRange(20, 20), zone);
|
| + 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());
|
| @@ -1726,10 +1723,9 @@ TEST(CanonicalizeCharacterSets) {
|
|
|
| TEST(CharacterRangeMerge) {
|
| v8::internal::V8::Initialize(NULL);
|
| - ZoneScope zone_scope(Isolate::Current()->runtime_zone(), DELETE_ON_EXIT);
|
| - ZoneList<CharacterRange> l1(4, Isolate::Current()->runtime_zone());
|
| - ZoneList<CharacterRange> l2(4, Isolate::Current()->runtime_zone());
|
| - Zone* zone = Isolate::Current()->runtime_zone();
|
| + Zone zone(Isolate::Current());
|
| + ZoneList<CharacterRange> l1(4, &zone);
|
| + ZoneList<CharacterRange> l2(4, &zone);
|
| // Create all combinations of intersections of ranges, both singletons and
|
| // longer.
|
|
|
| @@ -1744,8 +1740,8 @@ TEST(CharacterRangeMerge) {
|
| // Y - outside after
|
|
|
| for (int i = 0; i < 5; i++) {
|
| - l1.Add(CharacterRange::Singleton(offset + 2), zone);
|
| - l2.Add(CharacterRange::Singleton(offset + i), zone);
|
| + l1.Add(CharacterRange::Singleton(offset + 2), &zone);
|
| + l2.Add(CharacterRange::Singleton(offset + i), &zone);
|
| offset += 6;
|
| }
|
|
|
| @@ -1760,8 +1756,8 @@ TEST(CharacterRangeMerge) {
|
| // Y - disjoint after
|
|
|
| for (int i = 0; i < 7; i++) {
|
| - l1.Add(CharacterRange::Range(offset + 2, offset + 4), zone);
|
| - l2.Add(CharacterRange::Singleton(offset + i), zone);
|
| + l1.Add(CharacterRange::Range(offset + 2, offset + 4), &zone);
|
| + l2.Add(CharacterRange::Singleton(offset + i), &zone);
|
| offset += 8;
|
| }
|
|
|
| @@ -1781,35 +1777,35 @@ TEST(CharacterRangeMerge) {
|
| // YYYYYYYYYYYY - containing entirely.
|
|
|
| for (int i = 0; i < 9; i++) {
|
| - l1.Add(CharacterRange::Range(offset + 6, offset + 15), zone); // Length 8.
|
| - l2.Add(CharacterRange::Range(offset + 2 * i, offset + 2 * i + 3), zone);
|
| + 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), zone);
|
| - l2.Add(CharacterRange::Range(offset + 6, offset + 15), zone);
|
| + 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), zone);
|
| - l2.Add(CharacterRange::Range(offset + 4, offset + 17), zone);
|
| + 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), zone);
|
| - l1.Add(CharacterRange::Range(offset + 31, offset + 52), zone);
|
| + 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), zone);
|
| - l2.Add(CharacterRange::Singleton(offset + 8), zone);
|
| + 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, Isolate::Current()->runtime_zone());
|
| - ZoneList<CharacterRange> second_only(4, Isolate::Current()->runtime_zone());
|
| - ZoneList<CharacterRange> both(4, Isolate::Current()->runtime_zone());
|
| + ZoneList<CharacterRange> first_only(4, &zone);
|
| + ZoneList<CharacterRange> second_only(4, &zone);
|
| + ZoneList<CharacterRange> both(4, &zone);
|
| }
|
|
|
|
|
|
|