Revision f230a1cf deps/v8/test/cctest/test-regexp.cc

View differences:

deps/v8/test/cctest/test-regexp.cc
71 71

  
72 72
static bool CheckParse(const char* input) {
73 73
  V8::Initialize(NULL);
74
  v8::HandleScope scope(v8::Isolate::GetCurrent());
75
  Zone zone(Isolate::Current());
76
  FlatStringReader reader(Isolate::Current(), CStrVector(input));
74
  v8::HandleScope scope(CcTest::isolate());
75
  Zone zone(CcTest::i_isolate());
76
  FlatStringReader reader(CcTest::i_isolate(), CStrVector(input));
77 77
  RegExpCompileData result;
78 78
  return v8::internal::RegExpParser::ParseRegExp(
79 79
      &reader, false, &result, &zone);
......
82 82

  
83 83
static SmartArrayPointer<const char> Parse(const char* input) {
84 84
  V8::Initialize(NULL);
85
  v8::HandleScope scope(v8::Isolate::GetCurrent());
86
  Zone zone(Isolate::Current());
87
  FlatStringReader reader(Isolate::Current(), CStrVector(input));
85
  v8::HandleScope scope(CcTest::isolate());
86
  Zone zone(CcTest::i_isolate());
87
  FlatStringReader reader(CcTest::i_isolate(), CStrVector(input));
88 88
  RegExpCompileData result;
89 89
  CHECK(v8::internal::RegExpParser::ParseRegExp(
90 90
      &reader, false, &result, &zone));
......
97 97

  
98 98
static bool CheckSimple(const char* input) {
99 99
  V8::Initialize(NULL);
100
  v8::HandleScope scope(v8::Isolate::GetCurrent());
101
  Zone zone(Isolate::Current());
102
  FlatStringReader reader(Isolate::Current(), CStrVector(input));
100
  v8::HandleScope scope(CcTest::isolate());
101
  Zone zone(CcTest::i_isolate());
102
  FlatStringReader reader(CcTest::i_isolate(), CStrVector(input));
103 103
  RegExpCompileData result;
104 104
  CHECK(v8::internal::RegExpParser::ParseRegExp(
105 105
      &reader, false, &result, &zone));
......
116 116

  
117 117
static MinMaxPair CheckMinMaxMatch(const char* input) {
118 118
  V8::Initialize(NULL);
119
  v8::HandleScope scope(v8::Isolate::GetCurrent());
120
  Zone zone(Isolate::Current());
121
  FlatStringReader reader(Isolate::Current(), CStrVector(input));
119
  v8::HandleScope scope(CcTest::isolate());
120
  Zone zone(CcTest::i_isolate());
121
  FlatStringReader reader(CcTest::i_isolate(), CStrVector(input));
122 122
  RegExpCompileData result;
123 123
  CHECK(v8::internal::RegExpParser::ParseRegExp(
124 124
      &reader, false, &result, &zone));
......
390 390
static void ExpectError(const char* input,
391 391
                        const char* expected) {
392 392
  V8::Initialize(NULL);
393
  v8::HandleScope scope(v8::Isolate::GetCurrent());
394
  Zone zone(Isolate::Current());
395
  FlatStringReader reader(Isolate::Current(), CStrVector(input));
393
  v8::HandleScope scope(CcTest::isolate());
394
  Zone zone(CcTest::i_isolate());
395
  FlatStringReader reader(CcTest::i_isolate(), CStrVector(input));
396 396
  RegExpCompileData result;
397 397
  CHECK(!v8::internal::RegExpParser::ParseRegExp(
398 398
      &reader, false, &result, &zone));
......
404 404

  
405 405

  
406 406
TEST(Errors) {
407
  V8::Initialize(NULL);
408 407
  const char* kEndBackslash = "\\ at end of pattern";
409 408
  ExpectError("\\", kEndBackslash);
410 409
  const char* kUnterminatedGroup = "Unterminated group";
......
475 474

  
476 475

  
477 476
static void TestCharacterClassEscapes(uc16 c, bool (pred)(uc16 c)) {
478
  Zone zone(Isolate::Current());
477
  Zone zone(CcTest::i_isolate());
479 478
  ZoneList<CharacterRange>* ranges =
480 479
      new(&zone) ZoneList<CharacterRange>(2, &zone);
481 480
  CharacterRange::AddClassEscape(c, ranges, &zone);
......
507 506
                           bool is_ascii,
508 507
                           Zone* zone) {
509 508
  V8::Initialize(NULL);
510
  Isolate* isolate = Isolate::Current();
509
  Isolate* isolate = CcTest::i_isolate();
511 510
  FlatStringReader reader(isolate, CStrVector(input));
512 511
  RegExpCompileData compile_data;
513 512
  if (!v8::internal::RegExpParser::ParseRegExp(&reader, multiline,
......
533 532
                    bool multiline,
534 533
                    bool is_ascii,
535 534
                    bool dot_output = false) {
536
  v8::HandleScope scope(v8::Isolate::GetCurrent());
537
  Zone zone(Isolate::Current());
535
  v8::HandleScope scope(CcTest::isolate());
536
  Zone zone(CcTest::i_isolate());
538 537
  RegExpNode* node = Compile(input, multiline, is_ascii, &zone);
539 538
  USE(node);
540 539
#ifdef DEBUG
......
574 573
TEST(SplayTreeSimple) {
575 574
  v8::internal::V8::Initialize(NULL);
576 575
  static const unsigned kLimit = 1000;
577
  Zone zone(Isolate::Current());
576
  Zone zone(CcTest::i_isolate());
578 577
  ZoneSplayTree<TestConfig> tree(&zone);
579 578
  bool seen[kLimit];
580 579
  for (unsigned i = 0; i < kLimit; i++) seen[i] = false;
......
642 641
    }
643 642
  }
644 643
  // Enter test data into dispatch table.
645
  Zone zone(Isolate::Current());
644
  Zone zone(CcTest::i_isolate());
646 645
  DispatchTable table(&zone);
647 646
  for (int i = 0; i < kRangeCount; i++) {
648 647
    uc16* range = ranges[i];
......
710 709
class ContextInitializer {
711 710
 public:
712 711
  ContextInitializer()
713
      : scope_(v8::Isolate::GetCurrent()),
714
        env_(v8::Context::New(v8::Isolate::GetCurrent())) {
712
      : scope_(CcTest::isolate()),
713
        env_(v8::Context::New(CcTest::isolate())) {
715 714
    env_->Enter();
716 715
  }
717 716
  ~ContextInitializer() {
......
737 736
      input_end,
738 737
      captures,
739 738
      0,
740
      Isolate::Current());
739
      CcTest::i_isolate());
741 740
}
742 741

  
743 742

  
744 743
TEST(MacroAssemblerNativeSuccess) {
745 744
  v8::V8::Initialize();
746 745
  ContextInitializer initializer;
747
  Isolate* isolate = Isolate::Current();
746
  Isolate* isolate = CcTest::i_isolate();
748 747
  Factory* factory = isolate->factory();
749 748
  Zone zone(isolate);
750 749

  
......
781 780
TEST(MacroAssemblerNativeSimple) {
782 781
  v8::V8::Initialize();
783 782
  ContextInitializer initializer;
784
  Isolate* isolate = Isolate::Current();
783
  Isolate* isolate = CcTest::i_isolate();
785 784
  Factory* factory = isolate->factory();
786 785
  Zone zone(isolate);
787 786

  
......
847 846
TEST(MacroAssemblerNativeSimpleUC16) {
848 847
  v8::V8::Initialize();
849 848
  ContextInitializer initializer;
850
  Isolate* isolate = Isolate::Current();
849
  Isolate* isolate = CcTest::i_isolate();
851 850
  Factory* factory = isolate->factory();
852 851
  Zone zone(isolate);
853 852

  
......
918 917
TEST(MacroAssemblerNativeBacktrack) {
919 918
  v8::V8::Initialize();
920 919
  ContextInitializer initializer;
921
  Isolate* isolate = Isolate::Current();
920
  Isolate* isolate = CcTest::i_isolate();
922 921
  Factory* factory = isolate->factory();
923 922
  Zone zone(isolate);
924 923

  
......
958 957
TEST(MacroAssemblerNativeBackReferenceASCII) {
959 958
  v8::V8::Initialize();
960 959
  ContextInitializer initializer;
961
  Isolate* isolate = Isolate::Current();
960
  Isolate* isolate = CcTest::i_isolate();
962 961
  Factory* factory = isolate->factory();
963 962
  Zone zone(isolate);
964 963

  
......
1007 1006
TEST(MacroAssemblerNativeBackReferenceUC16) {
1008 1007
  v8::V8::Initialize();
1009 1008
  ContextInitializer initializer;
1010
  Isolate* isolate = Isolate::Current();
1009
  Isolate* isolate = CcTest::i_isolate();
1011 1010
  Factory* factory = isolate->factory();
1012 1011
  Zone zone(isolate);
1013 1012

  
......
1059 1058
TEST(MacroAssemblernativeAtStart) {
1060 1059
  v8::V8::Initialize();
1061 1060
  ContextInitializer initializer;
1062
  Isolate* isolate = Isolate::Current();
1061
  Isolate* isolate = CcTest::i_isolate();
1063 1062
  Factory* factory = isolate->factory();
1064 1063
  Zone zone(isolate);
1065 1064

  
......
1118 1117
TEST(MacroAssemblerNativeBackRefNoCase) {
1119 1118
  v8::V8::Initialize();
1120 1119
  ContextInitializer initializer;
1121
  Isolate* isolate = Isolate::Current();
1120
  Isolate* isolate = CcTest::i_isolate();
1122 1121
  Factory* factory = isolate->factory();
1123 1122
  Zone zone(isolate);
1124 1123

  
......
1177 1176
TEST(MacroAssemblerNativeRegisters) {
1178 1177
  v8::V8::Initialize();
1179 1178
  ContextInitializer initializer;
1180
  Isolate* isolate = Isolate::Current();
1179
  Isolate* isolate = CcTest::i_isolate();
1181 1180
  Factory* factory = isolate->factory();
1182 1181
  Zone zone(isolate);
1183 1182

  
......
1280 1279
TEST(MacroAssemblerStackOverflow) {
1281 1280
  v8::V8::Initialize();
1282 1281
  ContextInitializer initializer;
1283
  Isolate* isolate = Isolate::Current();
1282
  Isolate* isolate = CcTest::i_isolate();
1284 1283
  Factory* factory = isolate->factory();
1285 1284
  Zone zone(isolate);
1286 1285

  
......
1319 1318
TEST(MacroAssemblerNativeLotsOfRegisters) {
1320 1319
  v8::V8::Initialize();
1321 1320
  ContextInitializer initializer;
1322
  Isolate* isolate = Isolate::Current();
1321
  Isolate* isolate = CcTest::i_isolate();
1323 1322
  Factory* factory = isolate->factory();
1324 1323
  Zone zone(isolate);
1325 1324

  
......
1370 1369
TEST(MacroAssembler) {
1371 1370
  V8::Initialize(NULL);
1372 1371
  byte codes[1024];
1373
  Zone zone(Isolate::Current());
1372
  Zone zone(CcTest::i_isolate());
1374 1373
  RegExpMacroAssemblerIrregexp m(Vector<byte>(codes, 1024), &zone);
1375 1374
  // ^f(o)o.
1376 1375
  Label start, fail, backtrack;
......
1403 1402
  m.PopRegister(0);
1404 1403
  m.Fail();
1405 1404

  
1406
  Isolate* isolate = Isolate::Current();
1405
  Isolate* isolate = CcTest::i_isolate();
1407 1406
  Factory* factory = isolate->factory();
1408 1407
  HandleScope scope(isolate);
1409 1408

  
......
1438 1437
  static const int kLimit = 1000;
1439 1438
  static const int kRangeCount = 16;
1440 1439
  for (int t = 0; t < 10; t++) {
1441
    Zone zone(Isolate::Current());
1440
    Zone zone(CcTest::i_isolate());
1442 1441
    ZoneList<CharacterRange>* ranges =
1443 1442
        new(&zone) ZoneList<CharacterRange>(kRangeCount, &zone);
1444 1443
    for (int i = 0; i < kRangeCount; i++) {
......
1459 1458
      CHECK_EQ(is_on, set->Get(0) == false);
1460 1459
    }
1461 1460
  }
1462
  Zone zone(Isolate::Current());
1461
  Zone zone(CcTest::i_isolate());
1463 1462
  ZoneList<CharacterRange>* ranges =
1464 1463
      new(&zone) ZoneList<CharacterRange>(1, &zone);
1465 1464
  ranges->Add(CharacterRange(0xFFF0, 0xFFFE), &zone);
......
1572 1571

  
1573 1572
static void TestRangeCaseIndependence(CharacterRange input,
1574 1573
                                      Vector<CharacterRange> expected) {
1575
  Zone zone(Isolate::Current());
1574
  Zone zone(CcTest::i_isolate());
1576 1575
  int count = expected.length();
1577 1576
  ZoneList<CharacterRange>* list =
1578 1577
      new(&zone) ZoneList<CharacterRange>(count, &zone);
......
1637 1636

  
1638 1637
TEST(CharClassDifference) {
1639 1638
  v8::internal::V8::Initialize(NULL);
1640
  Zone zone(Isolate::Current());
1639
  Zone zone(CcTest::i_isolate());
1641 1640
  ZoneList<CharacterRange>* base =
1642 1641
      new(&zone) ZoneList<CharacterRange>(1, &zone);
1643 1642
  base->Add(CharacterRange::Everything(), &zone);
......
1665 1664

  
1666 1665
TEST(CanonicalizeCharacterSets) {
1667 1666
  v8::internal::V8::Initialize(NULL);
1668
  Zone zone(Isolate::Current());
1667
  Zone zone(CcTest::i_isolate());
1669 1668
  ZoneList<CharacterRange>* list =
1670 1669
      new(&zone) ZoneList<CharacterRange>(4, &zone);
1671 1670
  CharacterSet set(list);
......
1727 1726

  
1728 1727
TEST(CharacterRangeMerge) {
1729 1728
  v8::internal::V8::Initialize(NULL);
1730
  Zone zone(Isolate::Current());
1729
  Zone zone(CcTest::i_isolate());
1731 1730
  ZoneList<CharacterRange> l1(4, &zone);
1732 1731
  ZoneList<CharacterRange> l2(4, &zone);
1733 1732
  // Create all combinations of intersections of ranges, both singletons and

Also available in: Unified diff