| Index: test/cctest/test-regexp.cc
|
| ===================================================================
|
| --- test/cctest/test-regexp.cc (revision 7267)
|
| +++ test/cctest/test-regexp.cc (working copy)
|
| @@ -62,7 +62,7 @@
|
| V8::Initialize(NULL);
|
| v8::HandleScope scope;
|
| ZoneScope zone_scope(DELETE_ON_EXIT);
|
| - FlatStringReader reader(CStrVector(input));
|
| + FlatStringReader reader(Isolate::Current(), CStrVector(input));
|
| RegExpCompileData result;
|
| return v8::internal::RegExpParser::ParseRegExp(&reader, false, &result);
|
| }
|
| @@ -72,7 +72,7 @@
|
| V8::Initialize(NULL);
|
| v8::HandleScope scope;
|
| ZoneScope zone_scope(DELETE_ON_EXIT);
|
| - FlatStringReader reader(CStrVector(input));
|
| + FlatStringReader reader(Isolate::Current(), CStrVector(input));
|
| RegExpCompileData result;
|
| CHECK(v8::internal::RegExpParser::ParseRegExp(&reader, false, &result));
|
| CHECK(result.tree != NULL);
|
| @@ -86,7 +86,7 @@
|
| v8::HandleScope scope;
|
| unibrow::Utf8InputBuffer<> buffer(input, StrLength(input));
|
| ZoneScope zone_scope(DELETE_ON_EXIT);
|
| - FlatStringReader reader(CStrVector(input));
|
| + FlatStringReader reader(Isolate::Current(), CStrVector(input));
|
| RegExpCompileData result;
|
| CHECK(v8::internal::RegExpParser::ParseRegExp(&reader, false, &result));
|
| CHECK(result.tree != NULL);
|
| @@ -104,7 +104,7 @@
|
| v8::HandleScope scope;
|
| unibrow::Utf8InputBuffer<> buffer(input, StrLength(input));
|
| ZoneScope zone_scope(DELETE_ON_EXIT);
|
| - FlatStringReader reader(CStrVector(input));
|
| + FlatStringReader reader(Isolate::Current(), CStrVector(input));
|
| RegExpCompileData result;
|
| CHECK(v8::internal::RegExpParser::ParseRegExp(&reader, false, &result));
|
| CHECK(result.tree != NULL);
|
| @@ -375,7 +375,7 @@
|
| V8::Initialize(NULL);
|
| v8::HandleScope scope;
|
| ZoneScope zone_scope(DELETE_ON_EXIT);
|
| - FlatStringReader reader(CStrVector(input));
|
| + FlatStringReader reader(Isolate::Current(), CStrVector(input));
|
| RegExpCompileData result;
|
| CHECK(!v8::internal::RegExpParser::ParseRegExp(&reader, false, &result));
|
| CHECK(result.tree == NULL);
|
| @@ -471,6 +471,7 @@
|
|
|
|
|
| TEST(CharacterClassEscapes) {
|
| + v8::internal::V8::Initialize(NULL);
|
| TestCharacterClassEscapes('.', IsRegExpNewline);
|
| TestCharacterClassEscapes('d', IsDigit);
|
| TestCharacterClassEscapes('D', NotDigit);
|
| @@ -483,12 +484,12 @@
|
|
|
| static RegExpNode* Compile(const char* input, bool multiline, bool is_ascii) {
|
| V8::Initialize(NULL);
|
| - FlatStringReader reader(CStrVector(input));
|
| + FlatStringReader reader(Isolate::Current(), CStrVector(input));
|
| RegExpCompileData compile_data;
|
| if (!v8::internal::RegExpParser::ParseRegExp(&reader, multiline,
|
| &compile_data))
|
| return NULL;
|
| - Handle<String> pattern = Factory::NewStringFromUtf8(CStrVector(input));
|
| + Handle<String> pattern = FACTORY->NewStringFromUtf8(CStrVector(input));
|
| RegExpEngine::Compile(&compile_data, false, multiline, pattern, is_ascii);
|
| return compile_data.node;
|
| }
|
| @@ -538,6 +539,7 @@
|
|
|
|
|
| TEST(SplayTreeSimple) {
|
| + v8::internal::V8::Initialize(NULL);
|
| static const unsigned kLimit = 1000;
|
| ZoneScope zone_scope(DELETE_ON_EXIT);
|
| ZoneSplayTree<TestConfig> tree;
|
| @@ -590,6 +592,7 @@
|
|
|
|
|
| TEST(DispatchTableConstruction) {
|
| + v8::internal::V8::Initialize(NULL);
|
| // Initialize test data.
|
| static const int kLimit = 1000;
|
| static const int kRangeCount = 8;
|
| @@ -673,7 +676,7 @@
|
| class ContextInitializer {
|
| public:
|
| ContextInitializer()
|
| - : env_(), scope_(), zone_(DELETE_ON_EXIT), stack_guard_() {
|
| + : env_(), scope_(), zone_(DELETE_ON_EXIT) {
|
| env_ = v8::Context::New();
|
| env_->Enter();
|
| }
|
| @@ -685,7 +688,6 @@
|
| v8::Persistent<v8::Context> env_;
|
| v8::HandleScope scope_;
|
| v8::internal::ZoneScope zone_;
|
| - v8::internal::StackGuard stack_guard_;
|
| };
|
|
|
|
|
| @@ -701,7 +703,8 @@
|
| start_offset,
|
| input_start,
|
| input_end,
|
| - captures);
|
| + captures,
|
| + Isolate::Current());
|
| }
|
|
|
|
|
| @@ -713,12 +716,12 @@
|
|
|
| m.Succeed();
|
|
|
| - Handle<String> source = Factory::NewStringFromAscii(CStrVector(""));
|
| + Handle<String> source = FACTORY->NewStringFromAscii(CStrVector(""));
|
| Handle<Object> code_object = m.GetCode(source);
|
| Handle<Code> code = Handle<Code>::cast(code_object);
|
|
|
| int captures[4] = {42, 37, 87, 117};
|
| - Handle<String> input = Factory::NewStringFromAscii(CStrVector("foofoo"));
|
| + Handle<String> input = FACTORY->NewStringFromAscii(CStrVector("foofoo"));
|
| Handle<SeqAsciiString> seq_input = Handle<SeqAsciiString>::cast(input);
|
| const byte* start_adr =
|
| reinterpret_cast<const byte*>(seq_input->GetCharsAddress());
|
| @@ -757,12 +760,12 @@
|
| m.Bind(&fail);
|
| m.Fail();
|
|
|
| - Handle<String> source = Factory::NewStringFromAscii(CStrVector("^foo"));
|
| + Handle<String> source = FACTORY->NewStringFromAscii(CStrVector("^foo"));
|
| Handle<Object> code_object = m.GetCode(source);
|
| Handle<Code> code = Handle<Code>::cast(code_object);
|
|
|
| int captures[4] = {42, 37, 87, 117};
|
| - Handle<String> input = Factory::NewStringFromAscii(CStrVector("foofoo"));
|
| + Handle<String> input = FACTORY->NewStringFromAscii(CStrVector("foofoo"));
|
| Handle<SeqAsciiString> seq_input = Handle<SeqAsciiString>::cast(input);
|
| Address start_adr = seq_input->GetCharsAddress();
|
|
|
| @@ -780,7 +783,7 @@
|
| CHECK_EQ(-1, captures[2]);
|
| CHECK_EQ(-1, captures[3]);
|
|
|
| - input = Factory::NewStringFromAscii(CStrVector("barbarbar"));
|
| + input = FACTORY->NewStringFromAscii(CStrVector("barbarbar"));
|
| seq_input = Handle<SeqAsciiString>::cast(input);
|
| start_adr = seq_input->GetCharsAddress();
|
|
|
| @@ -813,14 +816,14 @@
|
| m.Bind(&fail);
|
| m.Fail();
|
|
|
| - Handle<String> source = Factory::NewStringFromAscii(CStrVector("^foo"));
|
| + Handle<String> source = FACTORY->NewStringFromAscii(CStrVector("^foo"));
|
| Handle<Object> code_object = m.GetCode(source);
|
| Handle<Code> code = Handle<Code>::cast(code_object);
|
|
|
| int captures[4] = {42, 37, 87, 117};
|
| const uc16 input_data[6] = {'f', 'o', 'o', 'f', 'o', '\xa0'};
|
| Handle<String> input =
|
| - Factory::NewStringFromTwoByte(Vector<const uc16>(input_data, 6));
|
| + FACTORY->NewStringFromTwoByte(Vector<const uc16>(input_data, 6));
|
| Handle<SeqTwoByteString> seq_input = Handle<SeqTwoByteString>::cast(input);
|
| Address start_adr = seq_input->GetCharsAddress();
|
|
|
| @@ -839,7 +842,7 @@
|
| CHECK_EQ(-1, captures[3]);
|
|
|
| const uc16 input_data2[9] = {'b', 'a', 'r', 'b', 'a', 'r', 'b', 'a', '\xa0'};
|
| - input = Factory::NewStringFromTwoByte(Vector<const uc16>(input_data2, 9));
|
| + input = FACTORY->NewStringFromTwoByte(Vector<const uc16>(input_data2, 9));
|
| seq_input = Handle<SeqTwoByteString>::cast(input);
|
| start_adr = seq_input->GetCharsAddress();
|
|
|
| @@ -871,11 +874,11 @@
|
| m.Bind(&backtrack);
|
| m.Fail();
|
|
|
| - Handle<String> source = Factory::NewStringFromAscii(CStrVector(".........."));
|
| + Handle<String> source = FACTORY->NewStringFromAscii(CStrVector(".........."));
|
| Handle<Object> code_object = m.GetCode(source);
|
| Handle<Code> code = Handle<Code>::cast(code_object);
|
|
|
| - Handle<String> input = Factory::NewStringFromAscii(CStrVector("foofoo"));
|
| + Handle<String> input = FACTORY->NewStringFromAscii(CStrVector("foofoo"));
|
| Handle<SeqAsciiString> seq_input = Handle<SeqAsciiString>::cast(input);
|
| Address start_adr = seq_input->GetCharsAddress();
|
|
|
| @@ -912,11 +915,11 @@
|
| m.Bind(&missing_match);
|
| m.Fail();
|
|
|
| - Handle<String> source = Factory::NewStringFromAscii(CStrVector("^(..)..\1"));
|
| + Handle<String> source = FACTORY->NewStringFromAscii(CStrVector("^(..)..\1"));
|
| Handle<Object> code_object = m.GetCode(source);
|
| Handle<Code> code = Handle<Code>::cast(code_object);
|
|
|
| - Handle<String> input = Factory::NewStringFromAscii(CStrVector("fooofo"));
|
| + Handle<String> input = FACTORY->NewStringFromAscii(CStrVector("fooofo"));
|
| Handle<SeqAsciiString> seq_input = Handle<SeqAsciiString>::cast(input);
|
| Address start_adr = seq_input->GetCharsAddress();
|
|
|
| @@ -958,13 +961,13 @@
|
| m.Bind(&missing_match);
|
| m.Fail();
|
|
|
| - Handle<String> source = Factory::NewStringFromAscii(CStrVector("^(..)..\1"));
|
| + Handle<String> source = FACTORY->NewStringFromAscii(CStrVector("^(..)..\1"));
|
| Handle<Object> code_object = m.GetCode(source);
|
| Handle<Code> code = Handle<Code>::cast(code_object);
|
|
|
| const uc16 input_data[6] = {'f', 0x2028, 'o', 'o', 'f', 0x2028};
|
| Handle<String> input =
|
| - Factory::NewStringFromTwoByte(Vector<const uc16>(input_data, 6));
|
| + FACTORY->NewStringFromTwoByte(Vector<const uc16>(input_data, 6));
|
| Handle<SeqTwoByteString> seq_input = Handle<SeqTwoByteString>::cast(input);
|
| Address start_adr = seq_input->GetCharsAddress();
|
|
|
| @@ -1013,11 +1016,11 @@
|
| m.CheckNotCharacter('b', &fail);
|
| m.Succeed();
|
|
|
| - Handle<String> source = Factory::NewStringFromAscii(CStrVector("(^f|ob)"));
|
| + Handle<String> source = FACTORY->NewStringFromAscii(CStrVector("(^f|ob)"));
|
| Handle<Object> code_object = m.GetCode(source);
|
| Handle<Code> code = Handle<Code>::cast(code_object);
|
|
|
| - Handle<String> input = Factory::NewStringFromAscii(CStrVector("foobar"));
|
| + Handle<String> input = FACTORY->NewStringFromAscii(CStrVector("foobar"));
|
| Handle<SeqAsciiString> seq_input = Handle<SeqAsciiString>::cast(input);
|
| Address start_adr = seq_input->GetCharsAddress();
|
|
|
| @@ -1071,12 +1074,12 @@
|
| m.Succeed();
|
|
|
| Handle<String> source =
|
| - Factory::NewStringFromAscii(CStrVector("^(abc)\1\1(?!\1)...(?!\1)"));
|
| + FACTORY->NewStringFromAscii(CStrVector("^(abc)\1\1(?!\1)...(?!\1)"));
|
| Handle<Object> code_object = m.GetCode(source);
|
| Handle<Code> code = Handle<Code>::cast(code_object);
|
|
|
| Handle<String> input =
|
| - Factory::NewStringFromAscii(CStrVector("aBcAbCABCxYzab"));
|
| + FACTORY->NewStringFromAscii(CStrVector("aBcAbCABCxYzab"));
|
| Handle<SeqAsciiString> seq_input = Handle<SeqAsciiString>::cast(input);
|
| Address start_adr = seq_input->GetCharsAddress();
|
|
|
| @@ -1169,13 +1172,13 @@
|
| m.Fail();
|
|
|
| Handle<String> source =
|
| - Factory::NewStringFromAscii(CStrVector("<loop test>"));
|
| + FACTORY->NewStringFromAscii(CStrVector("<loop test>"));
|
| Handle<Object> code_object = m.GetCode(source);
|
| Handle<Code> code = Handle<Code>::cast(code_object);
|
|
|
| // String long enough for test (content doesn't matter).
|
| Handle<String> input =
|
| - Factory::NewStringFromAscii(CStrVector("foofoofoofoofoo"));
|
| + FACTORY->NewStringFromAscii(CStrVector("foofoofoofoofoo"));
|
| Handle<SeqAsciiString> seq_input = Handle<SeqAsciiString>::cast(input);
|
| Address start_adr = seq_input->GetCharsAddress();
|
|
|
| @@ -1210,13 +1213,13 @@
|
| m.GoTo(&loop);
|
|
|
| Handle<String> source =
|
| - Factory::NewStringFromAscii(CStrVector("<stack overflow test>"));
|
| + FACTORY->NewStringFromAscii(CStrVector("<stack overflow test>"));
|
| Handle<Object> code_object = m.GetCode(source);
|
| Handle<Code> code = Handle<Code>::cast(code_object);
|
|
|
| // String long enough for test (content doesn't matter).
|
| Handle<String> input =
|
| - Factory::NewStringFromAscii(CStrVector("dummy"));
|
| + FACTORY->NewStringFromAscii(CStrVector("dummy"));
|
| Handle<SeqAsciiString> seq_input = Handle<SeqAsciiString>::cast(input);
|
| Address start_adr = seq_input->GetCharsAddress();
|
|
|
| @@ -1229,8 +1232,8 @@
|
| NULL);
|
|
|
| CHECK_EQ(NativeRegExpMacroAssembler::EXCEPTION, result);
|
| - CHECK(Top::has_pending_exception());
|
| - Top::clear_pending_exception();
|
| + CHECK(Isolate::Current()->has_pending_exception());
|
| + Isolate::Current()->clear_pending_exception();
|
| }
|
|
|
|
|
| @@ -1254,13 +1257,13 @@
|
| m.Succeed();
|
|
|
| Handle<String> source =
|
| - Factory::NewStringFromAscii(CStrVector("<huge register space test>"));
|
| + FACTORY->NewStringFromAscii(CStrVector("<huge register space test>"));
|
| Handle<Object> code_object = m.GetCode(source);
|
| Handle<Code> code = Handle<Code>::cast(code_object);
|
|
|
| // String long enough for test (content doesn't matter).
|
| Handle<String> input =
|
| - Factory::NewStringFromAscii(CStrVector("sample text"));
|
| + FACTORY->NewStringFromAscii(CStrVector("sample text"));
|
| Handle<SeqAsciiString> seq_input = Handle<SeqAsciiString>::cast(input);
|
| Address start_adr = seq_input->GetCharsAddress();
|
|
|
| @@ -1277,7 +1280,7 @@
|
| CHECK_EQ(0, captures[0]);
|
| CHECK_EQ(42, captures[1]);
|
|
|
| - Top::clear_pending_exception();
|
| + Isolate::Current()->clear_pending_exception();
|
| }
|
|
|
| #else // V8_INTERPRETED_REGEXP
|
| @@ -1322,13 +1325,13 @@
|
|
|
| v8::HandleScope scope;
|
|
|
| - Handle<String> source = Factory::NewStringFromAscii(CStrVector("^f(o)o"));
|
| + Handle<String> source = FACTORY->NewStringFromAscii(CStrVector("^f(o)o"));
|
| Handle<ByteArray> array = Handle<ByteArray>::cast(m.GetCode(source));
|
| int captures[5];
|
|
|
| const uc16 str1[] = {'f', 'o', 'o', 'b', 'a', 'r'};
|
| Handle<String> f1_16 =
|
| - Factory::NewStringFromTwoByte(Vector<const uc16>(str1, 6));
|
| + FACTORY->NewStringFromTwoByte(Vector<const uc16>(str1, 6));
|
|
|
| CHECK(IrregexpInterpreter::Match(array, f1_16, captures, 0));
|
| CHECK_EQ(0, captures[0]);
|
| @@ -1339,7 +1342,7 @@
|
|
|
| const uc16 str2[] = {'b', 'a', 'r', 'f', 'o', 'o'};
|
| Handle<String> f2_16 =
|
| - Factory::NewStringFromTwoByte(Vector<const uc16>(str2, 6));
|
| + FACTORY->NewStringFromTwoByte(Vector<const uc16>(str2, 6));
|
|
|
| CHECK(!IrregexpInterpreter::Match(array, f2_16, captures, 0));
|
| CHECK_EQ(42, captures[0]);
|
| @@ -1349,6 +1352,7 @@
|
|
|
|
|
| TEST(AddInverseToTable) {
|
| + v8::internal::V8::Initialize(NULL);
|
| static const int kLimit = 1000;
|
| static const int kRangeCount = 16;
|
| for (int t = 0; t < 10; t++) {
|
| @@ -1507,6 +1511,7 @@
|
|
|
|
|
| TEST(CharacterRangeCaseIndependence) {
|
| + v8::internal::V8::Initialize(NULL);
|
| TestSimpleRangeCaseIndependence(CharacterRange::Singleton('a'),
|
| CharacterRange::Singleton('A'));
|
| TestSimpleRangeCaseIndependence(CharacterRange::Singleton('z'),
|
| @@ -1548,6 +1553,7 @@
|
|
|
|
|
| TEST(CharClassDifference) {
|
| + v8::internal::V8::Initialize(NULL);
|
| ZoneScope zone_scope(DELETE_ON_EXIT);
|
| ZoneList<CharacterRange>* base = new ZoneList<CharacterRange>(1);
|
| base->Add(CharacterRange::Everything());
|
| @@ -1574,6 +1580,7 @@
|
|
|
|
|
| TEST(CanonicalizeCharacterSets) {
|
| + v8::internal::V8::Initialize(NULL);
|
| ZoneScope scope(DELETE_ON_EXIT);
|
| ZoneList<CharacterRange>* list = new ZoneList<CharacterRange>(4);
|
| CharacterSet set(list);
|
| @@ -1644,6 +1651,7 @@
|
| }
|
|
|
| TEST(CharacterRangeMerge) {
|
| + v8::internal::V8::Initialize(NULL);
|
| ZoneScope zone_scope(DELETE_ON_EXIT);
|
| ZoneList<CharacterRange> l1(4);
|
| ZoneList<CharacterRange> l2(4);
|
|
|