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

Side by Side Diff: test/cctest/test-regexp.cc

Issue 23534067: bulk replace Isolate::Current in tests (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « test/cctest/test-random.cc ('k') | test/cctest/test-serialize.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 #include "ia32/regexp-macro-assembler-ia32.h" 65 #include "ia32/regexp-macro-assembler-ia32.h"
66 #endif 66 #endif
67 #endif // V8_INTERPRETED_REGEXP 67 #endif // V8_INTERPRETED_REGEXP
68 68
69 using namespace v8::internal; 69 using namespace v8::internal;
70 70
71 71
72 static bool CheckParse(const char* input) { 72 static bool CheckParse(const char* input) {
73 V8::Initialize(NULL); 73 V8::Initialize(NULL);
74 v8::HandleScope scope(CcTest::isolate()); 74 v8::HandleScope scope(CcTest::isolate());
75 Zone zone(Isolate::Current()); 75 Zone zone(CcTest::i_isolate());
76 FlatStringReader reader(Isolate::Current(), CStrVector(input)); 76 FlatStringReader reader(CcTest::i_isolate(), CStrVector(input));
77 RegExpCompileData result; 77 RegExpCompileData result;
78 return v8::internal::RegExpParser::ParseRegExp( 78 return v8::internal::RegExpParser::ParseRegExp(
79 &reader, false, &result, &zone); 79 &reader, false, &result, &zone);
80 } 80 }
81 81
82 82
83 static SmartArrayPointer<const char> Parse(const char* input) { 83 static SmartArrayPointer<const char> Parse(const char* input) {
84 V8::Initialize(NULL); 84 V8::Initialize(NULL);
85 v8::HandleScope scope(CcTest::isolate()); 85 v8::HandleScope scope(CcTest::isolate());
86 Zone zone(Isolate::Current()); 86 Zone zone(CcTest::i_isolate());
87 FlatStringReader reader(Isolate::Current(), CStrVector(input)); 87 FlatStringReader reader(CcTest::i_isolate(), CStrVector(input));
88 RegExpCompileData result; 88 RegExpCompileData result;
89 CHECK(v8::internal::RegExpParser::ParseRegExp( 89 CHECK(v8::internal::RegExpParser::ParseRegExp(
90 &reader, false, &result, &zone)); 90 &reader, false, &result, &zone));
91 CHECK(result.tree != NULL); 91 CHECK(result.tree != NULL);
92 CHECK(result.error.is_null()); 92 CHECK(result.error.is_null());
93 SmartArrayPointer<const char> output = result.tree->ToString(&zone); 93 SmartArrayPointer<const char> output = result.tree->ToString(&zone);
94 return output; 94 return output;
95 } 95 }
96 96
97 97
98 static bool CheckSimple(const char* input) { 98 static bool CheckSimple(const char* input) {
99 V8::Initialize(NULL); 99 V8::Initialize(NULL);
100 v8::HandleScope scope(CcTest::isolate()); 100 v8::HandleScope scope(CcTest::isolate());
101 Zone zone(Isolate::Current()); 101 Zone zone(CcTest::i_isolate());
102 FlatStringReader reader(Isolate::Current(), CStrVector(input)); 102 FlatStringReader reader(CcTest::i_isolate(), CStrVector(input));
103 RegExpCompileData result; 103 RegExpCompileData result;
104 CHECK(v8::internal::RegExpParser::ParseRegExp( 104 CHECK(v8::internal::RegExpParser::ParseRegExp(
105 &reader, false, &result, &zone)); 105 &reader, false, &result, &zone));
106 CHECK(result.tree != NULL); 106 CHECK(result.tree != NULL);
107 CHECK(result.error.is_null()); 107 CHECK(result.error.is_null());
108 return result.simple; 108 return result.simple;
109 } 109 }
110 110
111 struct MinMaxPair { 111 struct MinMaxPair {
112 int min_match; 112 int min_match;
113 int max_match; 113 int max_match;
114 }; 114 };
115 115
116 116
117 static MinMaxPair CheckMinMaxMatch(const char* input) { 117 static MinMaxPair CheckMinMaxMatch(const char* input) {
118 V8::Initialize(NULL); 118 V8::Initialize(NULL);
119 v8::HandleScope scope(CcTest::isolate()); 119 v8::HandleScope scope(CcTest::isolate());
120 Zone zone(Isolate::Current()); 120 Zone zone(CcTest::i_isolate());
121 FlatStringReader reader(Isolate::Current(), CStrVector(input)); 121 FlatStringReader reader(CcTest::i_isolate(), CStrVector(input));
122 RegExpCompileData result; 122 RegExpCompileData result;
123 CHECK(v8::internal::RegExpParser::ParseRegExp( 123 CHECK(v8::internal::RegExpParser::ParseRegExp(
124 &reader, false, &result, &zone)); 124 &reader, false, &result, &zone));
125 CHECK(result.tree != NULL); 125 CHECK(result.tree != NULL);
126 CHECK(result.error.is_null()); 126 CHECK(result.error.is_null());
127 int min_match = result.tree->min_match(); 127 int min_match = result.tree->min_match();
128 int max_match = result.tree->max_match(); 128 int max_match = result.tree->max_match();
129 MinMaxPair pair = { min_match, max_match }; 129 MinMaxPair pair = { min_match, max_match };
130 return pair; 130 return pair;
131 } 131 }
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 CHECK_PARSE_EQ("[A-Z$-][x]", "(! [A-Z $ -] [x])"); 384 CHECK_PARSE_EQ("[A-Z$-][x]", "(! [A-Z $ -] [x])");
385 CHECK_PARSE_EQ("a{3,4*}", "(: 'a{3,' (# 0 - g '4') '}')"); 385 CHECK_PARSE_EQ("a{3,4*}", "(: 'a{3,' (# 0 - g '4') '}')");
386 CHECK_PARSE_EQ("{", "'{'"); 386 CHECK_PARSE_EQ("{", "'{'");
387 CHECK_PARSE_EQ("a|", "(| 'a' %)"); 387 CHECK_PARSE_EQ("a|", "(| 'a' %)");
388 } 388 }
389 389
390 static void ExpectError(const char* input, 390 static void ExpectError(const char* input,
391 const char* expected) { 391 const char* expected) {
392 V8::Initialize(NULL); 392 V8::Initialize(NULL);
393 v8::HandleScope scope(CcTest::isolate()); 393 v8::HandleScope scope(CcTest::isolate());
394 Zone zone(Isolate::Current()); 394 Zone zone(CcTest::i_isolate());
395 FlatStringReader reader(Isolate::Current(), CStrVector(input)); 395 FlatStringReader reader(CcTest::i_isolate(), CStrVector(input));
396 RegExpCompileData result; 396 RegExpCompileData result;
397 CHECK(!v8::internal::RegExpParser::ParseRegExp( 397 CHECK(!v8::internal::RegExpParser::ParseRegExp(
398 &reader, false, &result, &zone)); 398 &reader, false, &result, &zone));
399 CHECK(result.tree == NULL); 399 CHECK(result.tree == NULL);
400 CHECK(!result.error.is_null()); 400 CHECK(!result.error.is_null());
401 SmartArrayPointer<char> str = result.error->ToCString(ALLOW_NULLS); 401 SmartArrayPointer<char> str = result.error->ToCString(ALLOW_NULLS);
402 CHECK_EQ(expected, *str); 402 CHECK_EQ(expected, *str);
403 } 403 }
404 404
405 405
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 return !IsWhiteSpace(c); 468 return !IsWhiteSpace(c);
469 } 469 }
470 470
471 471
472 static bool NotWord(uc16 c) { 472 static bool NotWord(uc16 c) {
473 return !IsRegExpWord(c); 473 return !IsRegExpWord(c);
474 } 474 }
475 475
476 476
477 static void TestCharacterClassEscapes(uc16 c, bool (pred)(uc16 c)) { 477 static void TestCharacterClassEscapes(uc16 c, bool (pred)(uc16 c)) {
478 Zone zone(Isolate::Current()); 478 Zone zone(CcTest::i_isolate());
479 ZoneList<CharacterRange>* ranges = 479 ZoneList<CharacterRange>* ranges =
480 new(&zone) ZoneList<CharacterRange>(2, &zone); 480 new(&zone) ZoneList<CharacterRange>(2, &zone);
481 CharacterRange::AddClassEscape(c, ranges, &zone); 481 CharacterRange::AddClassEscape(c, ranges, &zone);
482 for (unsigned i = 0; i < (1 << 16); i++) { 482 for (unsigned i = 0; i < (1 << 16); i++) {
483 bool in_class = false; 483 bool in_class = false;
484 for (int j = 0; !in_class && j < ranges->length(); j++) { 484 for (int j = 0; !in_class && j < ranges->length(); j++) {
485 CharacterRange& range = ranges->at(j); 485 CharacterRange& range = ranges->at(j);
486 in_class = (range.from() <= i && i <= range.to()); 486 in_class = (range.from() <= i && i <= range.to());
487 } 487 }
488 CHECK_EQ(pred(i), in_class); 488 CHECK_EQ(pred(i), in_class);
(...skipping 11 matching lines...) Expand all
500 TestCharacterClassEscapes('w', IsRegExpWord); 500 TestCharacterClassEscapes('w', IsRegExpWord);
501 TestCharacterClassEscapes('W', NotWord); 501 TestCharacterClassEscapes('W', NotWord);
502 } 502 }
503 503
504 504
505 static RegExpNode* Compile(const char* input, 505 static RegExpNode* Compile(const char* input,
506 bool multiline, 506 bool multiline,
507 bool is_ascii, 507 bool is_ascii,
508 Zone* zone) { 508 Zone* zone) {
509 V8::Initialize(NULL); 509 V8::Initialize(NULL);
510 Isolate* isolate = Isolate::Current(); 510 Isolate* isolate = CcTest::i_isolate();
511 FlatStringReader reader(isolate, CStrVector(input)); 511 FlatStringReader reader(isolate, CStrVector(input));
512 RegExpCompileData compile_data; 512 RegExpCompileData compile_data;
513 if (!v8::internal::RegExpParser::ParseRegExp(&reader, multiline, 513 if (!v8::internal::RegExpParser::ParseRegExp(&reader, multiline,
514 &compile_data, zone)) 514 &compile_data, zone))
515 return NULL; 515 return NULL;
516 Handle<String> pattern = isolate->factory()-> 516 Handle<String> pattern = isolate->factory()->
517 NewStringFromUtf8(CStrVector(input)); 517 NewStringFromUtf8(CStrVector(input));
518 Handle<String> sample_subject = 518 Handle<String> sample_subject =
519 isolate->factory()->NewStringFromUtf8(CStrVector("")); 519 isolate->factory()->NewStringFromUtf8(CStrVector(""));
520 RegExpEngine::Compile(&compile_data, 520 RegExpEngine::Compile(&compile_data,
521 false, 521 false,
522 false, 522 false,
523 multiline, 523 multiline,
524 pattern, 524 pattern,
525 sample_subject, 525 sample_subject,
526 is_ascii, 526 is_ascii,
527 zone); 527 zone);
528 return compile_data.node; 528 return compile_data.node;
529 } 529 }
530 530
531 531
532 static void Execute(const char* input, 532 static void Execute(const char* input,
533 bool multiline, 533 bool multiline,
534 bool is_ascii, 534 bool is_ascii,
535 bool dot_output = false) { 535 bool dot_output = false) {
536 v8::HandleScope scope(CcTest::isolate()); 536 v8::HandleScope scope(CcTest::isolate());
537 Zone zone(Isolate::Current()); 537 Zone zone(CcTest::i_isolate());
538 RegExpNode* node = Compile(input, multiline, is_ascii, &zone); 538 RegExpNode* node = Compile(input, multiline, is_ascii, &zone);
539 USE(node); 539 USE(node);
540 #ifdef DEBUG 540 #ifdef DEBUG
541 if (dot_output) { 541 if (dot_output) {
542 RegExpEngine::DotPrint(input, node, false); 542 RegExpEngine::DotPrint(input, node, false);
543 exit(0); 543 exit(0);
544 } 544 }
545 #endif // DEBUG 545 #endif // DEBUG
546 } 546 }
547 547
(...skipping 19 matching lines...) Expand all
567 567
568 568
569 static unsigned PseudoRandom(int i, int j) { 569 static unsigned PseudoRandom(int i, int j) {
570 return ~(~((i * 781) ^ (j * 329))); 570 return ~(~((i * 781) ^ (j * 329)));
571 } 571 }
572 572
573 573
574 TEST(SplayTreeSimple) { 574 TEST(SplayTreeSimple) {
575 v8::internal::V8::Initialize(NULL); 575 v8::internal::V8::Initialize(NULL);
576 static const unsigned kLimit = 1000; 576 static const unsigned kLimit = 1000;
577 Zone zone(Isolate::Current()); 577 Zone zone(CcTest::i_isolate());
578 ZoneSplayTree<TestConfig> tree(&zone); 578 ZoneSplayTree<TestConfig> tree(&zone);
579 bool seen[kLimit]; 579 bool seen[kLimit];
580 for (unsigned i = 0; i < kLimit; i++) seen[i] = false; 580 for (unsigned i = 0; i < kLimit; i++) seen[i] = false;
581 #define CHECK_MAPS_EQUAL() do { \ 581 #define CHECK_MAPS_EQUAL() do { \
582 for (unsigned k = 0; k < kLimit; k++) \ 582 for (unsigned k = 0; k < kLimit; k++) \
583 CHECK_EQ(seen[k], tree.Find(k, &loc)); \ 583 CHECK_EQ(seen[k], tree.Find(k, &loc)); \
584 } while (false) 584 } while (false)
585 for (int i = 0; i < 50; i++) { 585 for (int i = 0; i < 50; i++) {
586 for (int j = 0; j < 50; j++) { 586 for (int j = 0; j < 50; j++) {
587 unsigned next = PseudoRandom(i, j) % kLimit; 587 unsigned next = PseudoRandom(i, j) % kLimit;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 Vector<uc16> range(ranges[i], 2 * kRangeSize); 635 Vector<uc16> range(ranges[i], 2 * kRangeSize);
636 for (int j = 0; j < 2 * kRangeSize; j++) { 636 for (int j = 0; j < 2 * kRangeSize; j++) {
637 range[j] = PseudoRandom(i + 25, j + 87) % kLimit; 637 range[j] = PseudoRandom(i + 25, j + 87) % kLimit;
638 } 638 }
639 range.Sort(); 639 range.Sort();
640 for (int j = 1; j < 2 * kRangeSize; j++) { 640 for (int j = 1; j < 2 * kRangeSize; j++) {
641 CHECK(range[j-1] <= range[j]); 641 CHECK(range[j-1] <= range[j]);
642 } 642 }
643 } 643 }
644 // Enter test data into dispatch table. 644 // Enter test data into dispatch table.
645 Zone zone(Isolate::Current()); 645 Zone zone(CcTest::i_isolate());
646 DispatchTable table(&zone); 646 DispatchTable table(&zone);
647 for (int i = 0; i < kRangeCount; i++) { 647 for (int i = 0; i < kRangeCount; i++) {
648 uc16* range = ranges[i]; 648 uc16* range = ranges[i];
649 for (int j = 0; j < 2 * kRangeSize; j += 2) 649 for (int j = 0; j < 2 * kRangeSize; j += 2)
650 table.AddRange(CharacterRange(range[j], range[j + 1]), i, &zone); 650 table.AddRange(CharacterRange(range[j], range[j + 1]), i, &zone);
651 } 651 }
652 // Check that the table looks as we would expect 652 // Check that the table looks as we would expect
653 for (int p = 0; p < kLimit; p++) { 653 for (int p = 0; p < kLimit; p++) {
654 OutSet* outs = table.Get(p); 654 OutSet* outs = table.Get(p);
655 for (int j = 0; j < kRangeCount; j++) { 655 for (int j = 0; j < kRangeCount; j++) {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 const byte* input_end, 730 const byte* input_end,
731 int* captures) { 731 int* captures) {
732 return NativeRegExpMacroAssembler::Execute( 732 return NativeRegExpMacroAssembler::Execute(
733 code, 733 code,
734 input, 734 input,
735 start_offset, 735 start_offset,
736 input_start, 736 input_start,
737 input_end, 737 input_end,
738 captures, 738 captures,
739 0, 739 0,
740 Isolate::Current()); 740 CcTest::i_isolate());
741 } 741 }
742 742
743 743
744 TEST(MacroAssemblerNativeSuccess) { 744 TEST(MacroAssemblerNativeSuccess) {
745 v8::V8::Initialize(); 745 v8::V8::Initialize();
746 ContextInitializer initializer; 746 ContextInitializer initializer;
747 Isolate* isolate = Isolate::Current(); 747 Isolate* isolate = CcTest::i_isolate();
748 Factory* factory = isolate->factory(); 748 Factory* factory = isolate->factory();
749 Zone zone(isolate); 749 Zone zone(isolate);
750 750
751 ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 4, &zone); 751 ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 4, &zone);
752 752
753 m.Succeed(); 753 m.Succeed();
754 754
755 Handle<String> source = factory->NewStringFromAscii(CStrVector("")); 755 Handle<String> source = factory->NewStringFromAscii(CStrVector(""));
756 Handle<Object> code_object = m.GetCode(source); 756 Handle<Object> code_object = m.GetCode(source);
757 Handle<Code> code = Handle<Code>::cast(code_object); 757 Handle<Code> code = Handle<Code>::cast(code_object);
(...skipping 16 matching lines...) Expand all
774 CHECK_EQ(-1, captures[0]); 774 CHECK_EQ(-1, captures[0]);
775 CHECK_EQ(-1, captures[1]); 775 CHECK_EQ(-1, captures[1]);
776 CHECK_EQ(-1, captures[2]); 776 CHECK_EQ(-1, captures[2]);
777 CHECK_EQ(-1, captures[3]); 777 CHECK_EQ(-1, captures[3]);
778 } 778 }
779 779
780 780
781 TEST(MacroAssemblerNativeSimple) { 781 TEST(MacroAssemblerNativeSimple) {
782 v8::V8::Initialize(); 782 v8::V8::Initialize();
783 ContextInitializer initializer; 783 ContextInitializer initializer;
784 Isolate* isolate = Isolate::Current(); 784 Isolate* isolate = CcTest::i_isolate();
785 Factory* factory = isolate->factory(); 785 Factory* factory = isolate->factory();
786 Zone zone(isolate); 786 Zone zone(isolate);
787 787
788 ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 4, &zone); 788 ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 4, &zone);
789 789
790 Label fail, backtrack; 790 Label fail, backtrack;
791 m.PushBacktrack(&fail); 791 m.PushBacktrack(&fail);
792 m.CheckNotAtStart(NULL); 792 m.CheckNotAtStart(NULL);
793 m.LoadCurrentCharacter(2, NULL); 793 m.LoadCurrentCharacter(2, NULL);
794 m.CheckNotCharacter('o', NULL); 794 m.CheckNotCharacter('o', NULL);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
840 start_adr + input->length(), 840 start_adr + input->length(),
841 captures); 841 captures);
842 842
843 CHECK_EQ(NativeRegExpMacroAssembler::FAILURE, result); 843 CHECK_EQ(NativeRegExpMacroAssembler::FAILURE, result);
844 } 844 }
845 845
846 846
847 TEST(MacroAssemblerNativeSimpleUC16) { 847 TEST(MacroAssemblerNativeSimpleUC16) {
848 v8::V8::Initialize(); 848 v8::V8::Initialize();
849 ContextInitializer initializer; 849 ContextInitializer initializer;
850 Isolate* isolate = Isolate::Current(); 850 Isolate* isolate = CcTest::i_isolate();
851 Factory* factory = isolate->factory(); 851 Factory* factory = isolate->factory();
852 Zone zone(isolate); 852 Zone zone(isolate);
853 853
854 ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::UC16, 4, &zone); 854 ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::UC16, 4, &zone);
855 855
856 Label fail, backtrack; 856 Label fail, backtrack;
857 m.PushBacktrack(&fail); 857 m.PushBacktrack(&fail);
858 m.CheckNotAtStart(NULL); 858 m.CheckNotAtStart(NULL);
859 m.LoadCurrentCharacter(2, NULL); 859 m.LoadCurrentCharacter(2, NULL);
860 m.CheckNotCharacter('o', NULL); 860 m.CheckNotCharacter('o', NULL);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
911 start_adr + input->length() * 2, 911 start_adr + input->length() * 2,
912 captures); 912 captures);
913 913
914 CHECK_EQ(NativeRegExpMacroAssembler::FAILURE, result); 914 CHECK_EQ(NativeRegExpMacroAssembler::FAILURE, result);
915 } 915 }
916 916
917 917
918 TEST(MacroAssemblerNativeBacktrack) { 918 TEST(MacroAssemblerNativeBacktrack) {
919 v8::V8::Initialize(); 919 v8::V8::Initialize();
920 ContextInitializer initializer; 920 ContextInitializer initializer;
921 Isolate* isolate = Isolate::Current(); 921 Isolate* isolate = CcTest::i_isolate();
922 Factory* factory = isolate->factory(); 922 Factory* factory = isolate->factory();
923 Zone zone(isolate); 923 Zone zone(isolate);
924 924
925 ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 0, &zone); 925 ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 0, &zone);
926 926
927 Label fail; 927 Label fail;
928 Label backtrack; 928 Label backtrack;
929 m.LoadCurrentCharacter(10, &fail); 929 m.LoadCurrentCharacter(10, &fail);
930 m.Succeed(); 930 m.Succeed();
931 m.Bind(&fail); 931 m.Bind(&fail);
(...skipping 19 matching lines...) Expand all
951 start_adr + input->length(), 951 start_adr + input->length(),
952 NULL); 952 NULL);
953 953
954 CHECK_EQ(NativeRegExpMacroAssembler::FAILURE, result); 954 CHECK_EQ(NativeRegExpMacroAssembler::FAILURE, result);
955 } 955 }
956 956
957 957
958 TEST(MacroAssemblerNativeBackReferenceASCII) { 958 TEST(MacroAssemblerNativeBackReferenceASCII) {
959 v8::V8::Initialize(); 959 v8::V8::Initialize();
960 ContextInitializer initializer; 960 ContextInitializer initializer;
961 Isolate* isolate = Isolate::Current(); 961 Isolate* isolate = CcTest::i_isolate();
962 Factory* factory = isolate->factory(); 962 Factory* factory = isolate->factory();
963 Zone zone(isolate); 963 Zone zone(isolate);
964 964
965 ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 4, &zone); 965 ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 4, &zone);
966 966
967 m.WriteCurrentPositionToRegister(0, 0); 967 m.WriteCurrentPositionToRegister(0, 0);
968 m.AdvanceCurrentPosition(2); 968 m.AdvanceCurrentPosition(2);
969 m.WriteCurrentPositionToRegister(1, 0); 969 m.WriteCurrentPositionToRegister(1, 0);
970 Label nomatch; 970 Label nomatch;
971 m.CheckNotBackReference(0, &nomatch); 971 m.CheckNotBackReference(0, &nomatch);
(...skipping 28 matching lines...) Expand all
1000 CHECK_EQ(0, output[0]); 1000 CHECK_EQ(0, output[0]);
1001 CHECK_EQ(2, output[1]); 1001 CHECK_EQ(2, output[1]);
1002 CHECK_EQ(6, output[2]); 1002 CHECK_EQ(6, output[2]);
1003 CHECK_EQ(-1, output[3]); 1003 CHECK_EQ(-1, output[3]);
1004 } 1004 }
1005 1005
1006 1006
1007 TEST(MacroAssemblerNativeBackReferenceUC16) { 1007 TEST(MacroAssemblerNativeBackReferenceUC16) {
1008 v8::V8::Initialize(); 1008 v8::V8::Initialize();
1009 ContextInitializer initializer; 1009 ContextInitializer initializer;
1010 Isolate* isolate = Isolate::Current(); 1010 Isolate* isolate = CcTest::i_isolate();
1011 Factory* factory = isolate->factory(); 1011 Factory* factory = isolate->factory();
1012 Zone zone(isolate); 1012 Zone zone(isolate);
1013 1013
1014 ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::UC16, 4, &zone); 1014 ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::UC16, 4, &zone);
1015 1015
1016 m.WriteCurrentPositionToRegister(0, 0); 1016 m.WriteCurrentPositionToRegister(0, 0);
1017 m.AdvanceCurrentPosition(2); 1017 m.AdvanceCurrentPosition(2);
1018 m.WriteCurrentPositionToRegister(1, 0); 1018 m.WriteCurrentPositionToRegister(1, 0);
1019 Label nomatch; 1019 Label nomatch;
1020 m.CheckNotBackReference(0, &nomatch); 1020 m.CheckNotBackReference(0, &nomatch);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1052 CHECK_EQ(2, output[1]); 1052 CHECK_EQ(2, output[1]);
1053 CHECK_EQ(6, output[2]); 1053 CHECK_EQ(6, output[2]);
1054 CHECK_EQ(-1, output[3]); 1054 CHECK_EQ(-1, output[3]);
1055 } 1055 }
1056 1056
1057 1057
1058 1058
1059 TEST(MacroAssemblernativeAtStart) { 1059 TEST(MacroAssemblernativeAtStart) {
1060 v8::V8::Initialize(); 1060 v8::V8::Initialize();
1061 ContextInitializer initializer; 1061 ContextInitializer initializer;
1062 Isolate* isolate = Isolate::Current(); 1062 Isolate* isolate = CcTest::i_isolate();
1063 Factory* factory = isolate->factory(); 1063 Factory* factory = isolate->factory();
1064 Zone zone(isolate); 1064 Zone zone(isolate);
1065 1065
1066 ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 0, &zone); 1066 ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 0, &zone);
1067 1067
1068 Label not_at_start, newline, fail; 1068 Label not_at_start, newline, fail;
1069 m.CheckNotAtStart(&not_at_start); 1069 m.CheckNotAtStart(&not_at_start);
1070 // Check that prevchar = '\n' and current = 'f'. 1070 // Check that prevchar = '\n' and current = 'f'.
1071 m.CheckCharacter('\n', &newline); 1071 m.CheckCharacter('\n', &newline);
1072 m.Bind(&fail); 1072 m.Bind(&fail);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1111 start_adr + input->length(), 1111 start_adr + input->length(),
1112 NULL); 1112 NULL);
1113 1113
1114 CHECK_EQ(NativeRegExpMacroAssembler::SUCCESS, result); 1114 CHECK_EQ(NativeRegExpMacroAssembler::SUCCESS, result);
1115 } 1115 }
1116 1116
1117 1117
1118 TEST(MacroAssemblerNativeBackRefNoCase) { 1118 TEST(MacroAssemblerNativeBackRefNoCase) {
1119 v8::V8::Initialize(); 1119 v8::V8::Initialize();
1120 ContextInitializer initializer; 1120 ContextInitializer initializer;
1121 Isolate* isolate = Isolate::Current(); 1121 Isolate* isolate = CcTest::i_isolate();
1122 Factory* factory = isolate->factory(); 1122 Factory* factory = isolate->factory();
1123 Zone zone(isolate); 1123 Zone zone(isolate);
1124 1124
1125 ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 4, &zone); 1125 ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 4, &zone);
1126 1126
1127 Label fail, succ; 1127 Label fail, succ;
1128 1128
1129 m.WriteCurrentPositionToRegister(0, 0); 1129 m.WriteCurrentPositionToRegister(0, 0);
1130 m.WriteCurrentPositionToRegister(2, 0); 1130 m.WriteCurrentPositionToRegister(2, 0);
1131 m.AdvanceCurrentPosition(3); 1131 m.AdvanceCurrentPosition(3);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1170 CHECK_EQ(12, output[1]); 1170 CHECK_EQ(12, output[1]);
1171 CHECK_EQ(0, output[2]); 1171 CHECK_EQ(0, output[2]);
1172 CHECK_EQ(3, output[3]); 1172 CHECK_EQ(3, output[3]);
1173 } 1173 }
1174 1174
1175 1175
1176 1176
1177 TEST(MacroAssemblerNativeRegisters) { 1177 TEST(MacroAssemblerNativeRegisters) {
1178 v8::V8::Initialize(); 1178 v8::V8::Initialize();
1179 ContextInitializer initializer; 1179 ContextInitializer initializer;
1180 Isolate* isolate = Isolate::Current(); 1180 Isolate* isolate = CcTest::i_isolate();
1181 Factory* factory = isolate->factory(); 1181 Factory* factory = isolate->factory();
1182 Zone zone(isolate); 1182 Zone zone(isolate);
1183 1183
1184 ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 6, &zone); 1184 ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 6, &zone);
1185 1185
1186 uc16 foo_chars[3] = {'f', 'o', 'o'}; 1186 uc16 foo_chars[3] = {'f', 'o', 'o'};
1187 Vector<const uc16> foo(foo_chars, 3); 1187 Vector<const uc16> foo(foo_chars, 3);
1188 1188
1189 enum registers { out1, out2, out3, out4, out5, out6, sp, loop_cnt }; 1189 enum registers { out1, out2, out3, out4, out5, out6, sp, loop_cnt };
1190 Label fail; 1190 Label fail;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
1273 CHECK_EQ(6, output[2]); 1273 CHECK_EQ(6, output[2]);
1274 CHECK_EQ(9, output[3]); 1274 CHECK_EQ(9, output[3]);
1275 CHECK_EQ(9, output[4]); 1275 CHECK_EQ(9, output[4]);
1276 CHECK_EQ(-1, output[5]); 1276 CHECK_EQ(-1, output[5]);
1277 } 1277 }
1278 1278
1279 1279
1280 TEST(MacroAssemblerStackOverflow) { 1280 TEST(MacroAssemblerStackOverflow) {
1281 v8::V8::Initialize(); 1281 v8::V8::Initialize();
1282 ContextInitializer initializer; 1282 ContextInitializer initializer;
1283 Isolate* isolate = Isolate::Current(); 1283 Isolate* isolate = CcTest::i_isolate();
1284 Factory* factory = isolate->factory(); 1284 Factory* factory = isolate->factory();
1285 Zone zone(isolate); 1285 Zone zone(isolate);
1286 1286
1287 ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 0, &zone); 1287 ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 0, &zone);
1288 1288
1289 Label loop; 1289 Label loop;
1290 m.Bind(&loop); 1290 m.Bind(&loop);
1291 m.PushBacktrack(&loop); 1291 m.PushBacktrack(&loop);
1292 m.GoTo(&loop); 1292 m.GoTo(&loop);
1293 1293
(...skipping 18 matching lines...) Expand all
1312 1312
1313 CHECK_EQ(NativeRegExpMacroAssembler::EXCEPTION, result); 1313 CHECK_EQ(NativeRegExpMacroAssembler::EXCEPTION, result);
1314 CHECK(isolate->has_pending_exception()); 1314 CHECK(isolate->has_pending_exception());
1315 isolate->clear_pending_exception(); 1315 isolate->clear_pending_exception();
1316 } 1316 }
1317 1317
1318 1318
1319 TEST(MacroAssemblerNativeLotsOfRegisters) { 1319 TEST(MacroAssemblerNativeLotsOfRegisters) {
1320 v8::V8::Initialize(); 1320 v8::V8::Initialize();
1321 ContextInitializer initializer; 1321 ContextInitializer initializer;
1322 Isolate* isolate = Isolate::Current(); 1322 Isolate* isolate = CcTest::i_isolate();
1323 Factory* factory = isolate->factory(); 1323 Factory* factory = isolate->factory();
1324 Zone zone(isolate); 1324 Zone zone(isolate);
1325 1325
1326 ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 2, &zone); 1326 ArchRegExpMacroAssembler m(NativeRegExpMacroAssembler::ASCII, 2, &zone);
1327 1327
1328 // At least 2048, to ensure the allocated space for registers 1328 // At least 2048, to ensure the allocated space for registers
1329 // span one full page. 1329 // span one full page.
1330 const int large_number = 8000; 1330 const int large_number = 8000;
1331 m.WriteCurrentPositionToRegister(large_number, 42); 1331 m.WriteCurrentPositionToRegister(large_number, 42);
1332 m.WriteCurrentPositionToRegister(0, 0); 1332 m.WriteCurrentPositionToRegister(0, 0);
(...skipping 30 matching lines...) Expand all
1363 CHECK_EQ(42, captures[1]); 1363 CHECK_EQ(42, captures[1]);
1364 1364
1365 isolate->clear_pending_exception(); 1365 isolate->clear_pending_exception();
1366 } 1366 }
1367 1367
1368 #else // V8_INTERPRETED_REGEXP 1368 #else // V8_INTERPRETED_REGEXP
1369 1369
1370 TEST(MacroAssembler) { 1370 TEST(MacroAssembler) {
1371 V8::Initialize(NULL); 1371 V8::Initialize(NULL);
1372 byte codes[1024]; 1372 byte codes[1024];
1373 Zone zone(Isolate::Current()); 1373 Zone zone(CcTest::i_isolate());
1374 RegExpMacroAssemblerIrregexp m(Vector<byte>(codes, 1024), &zone); 1374 RegExpMacroAssemblerIrregexp m(Vector<byte>(codes, 1024), &zone);
1375 // ^f(o)o. 1375 // ^f(o)o.
1376 Label start, fail, backtrack; 1376 Label start, fail, backtrack;
1377 1377
1378 m.SetRegister(4, 42); 1378 m.SetRegister(4, 42);
1379 m.PushRegister(4, RegExpMacroAssembler::kNoStackLimitCheck); 1379 m.PushRegister(4, RegExpMacroAssembler::kNoStackLimitCheck);
1380 m.AdvanceRegister(4, 42); 1380 m.AdvanceRegister(4, 42);
1381 m.GoTo(&start); 1381 m.GoTo(&start);
1382 m.Fail(); 1382 m.Fail();
1383 m.Bind(&start); 1383 m.Bind(&start);
(...skipping 12 matching lines...) Expand all
1396 m.AdvanceCurrentPosition(3); 1396 m.AdvanceCurrentPosition(3);
1397 m.PushBacktrack(&backtrack); 1397 m.PushBacktrack(&backtrack);
1398 m.Succeed(); 1398 m.Succeed();
1399 m.Bind(&backtrack); 1399 m.Bind(&backtrack);
1400 m.ClearRegisters(2, 3); 1400 m.ClearRegisters(2, 3);
1401 m.Backtrack(); 1401 m.Backtrack();
1402 m.Bind(&fail); 1402 m.Bind(&fail);
1403 m.PopRegister(0); 1403 m.PopRegister(0);
1404 m.Fail(); 1404 m.Fail();
1405 1405
1406 Isolate* isolate = Isolate::Current(); 1406 Isolate* isolate = CcTest::i_isolate();
1407 Factory* factory = isolate->factory(); 1407 Factory* factory = isolate->factory();
1408 HandleScope scope(isolate); 1408 HandleScope scope(isolate);
1409 1409
1410 Handle<String> source = factory->NewStringFromAscii(CStrVector("^f(o)o")); 1410 Handle<String> source = factory->NewStringFromAscii(CStrVector("^f(o)o"));
1411 Handle<ByteArray> array = Handle<ByteArray>::cast(m.GetCode(source)); 1411 Handle<ByteArray> array = Handle<ByteArray>::cast(m.GetCode(source));
1412 int captures[5]; 1412 int captures[5];
1413 1413
1414 const uc16 str1[] = {'f', 'o', 'o', 'b', 'a', 'r'}; 1414 const uc16 str1[] = {'f', 'o', 'o', 'b', 'a', 'r'};
1415 Handle<String> f1_16 = 1415 Handle<String> f1_16 =
1416 factory->NewStringFromTwoByte(Vector<const uc16>(str1, 6)); 1416 factory->NewStringFromTwoByte(Vector<const uc16>(str1, 6));
(...skipping 14 matching lines...) Expand all
1431 } 1431 }
1432 1432
1433 #endif // V8_INTERPRETED_REGEXP 1433 #endif // V8_INTERPRETED_REGEXP
1434 1434
1435 1435
1436 TEST(AddInverseToTable) { 1436 TEST(AddInverseToTable) {
1437 v8::internal::V8::Initialize(NULL); 1437 v8::internal::V8::Initialize(NULL);
1438 static const int kLimit = 1000; 1438 static const int kLimit = 1000;
1439 static const int kRangeCount = 16; 1439 static const int kRangeCount = 16;
1440 for (int t = 0; t < 10; t++) { 1440 for (int t = 0; t < 10; t++) {
1441 Zone zone(Isolate::Current()); 1441 Zone zone(CcTest::i_isolate());
1442 ZoneList<CharacterRange>* ranges = 1442 ZoneList<CharacterRange>* ranges =
1443 new(&zone) ZoneList<CharacterRange>(kRangeCount, &zone); 1443 new(&zone) ZoneList<CharacterRange>(kRangeCount, &zone);
1444 for (int i = 0; i < kRangeCount; i++) { 1444 for (int i = 0; i < kRangeCount; i++) {
1445 int from = PseudoRandom(t + 87, i + 25) % kLimit; 1445 int from = PseudoRandom(t + 87, i + 25) % kLimit;
1446 int to = from + (PseudoRandom(i + 87, t + 25) % (kLimit / 20)); 1446 int to = from + (PseudoRandom(i + 87, t + 25) % (kLimit / 20));
1447 if (to > kLimit) to = kLimit; 1447 if (to > kLimit) to = kLimit;
1448 ranges->Add(CharacterRange(from, to), &zone); 1448 ranges->Add(CharacterRange(from, to), &zone);
1449 } 1449 }
1450 DispatchTable table(&zone); 1450 DispatchTable table(&zone);
1451 DispatchTableConstructor cons(&table, false, &zone); 1451 DispatchTableConstructor cons(&table, false, &zone);
1452 cons.set_choice_index(0); 1452 cons.set_choice_index(0);
1453 cons.AddInverse(ranges); 1453 cons.AddInverse(ranges);
1454 for (int i = 0; i < kLimit; i++) { 1454 for (int i = 0; i < kLimit; i++) {
1455 bool is_on = false; 1455 bool is_on = false;
1456 for (int j = 0; !is_on && j < kRangeCount; j++) 1456 for (int j = 0; !is_on && j < kRangeCount; j++)
1457 is_on = ranges->at(j).Contains(i); 1457 is_on = ranges->at(j).Contains(i);
1458 OutSet* set = table.Get(i); 1458 OutSet* set = table.Get(i);
1459 CHECK_EQ(is_on, set->Get(0) == false); 1459 CHECK_EQ(is_on, set->Get(0) == false);
1460 } 1460 }
1461 } 1461 }
1462 Zone zone(Isolate::Current()); 1462 Zone zone(CcTest::i_isolate());
1463 ZoneList<CharacterRange>* ranges = 1463 ZoneList<CharacterRange>* ranges =
1464 new(&zone) ZoneList<CharacterRange>(1, &zone); 1464 new(&zone) ZoneList<CharacterRange>(1, &zone);
1465 ranges->Add(CharacterRange(0xFFF0, 0xFFFE), &zone); 1465 ranges->Add(CharacterRange(0xFFF0, 0xFFFE), &zone);
1466 DispatchTable table(&zone); 1466 DispatchTable table(&zone);
1467 DispatchTableConstructor cons(&table, false, &zone); 1467 DispatchTableConstructor cons(&table, false, &zone);
1468 cons.set_choice_index(0); 1468 cons.set_choice_index(0);
1469 cons.AddInverse(ranges); 1469 cons.AddInverse(ranges);
1470 CHECK(!table.Get(0xFFFE)->Get(0)); 1470 CHECK(!table.Get(0xFFFE)->Get(0));
1471 CHECK(table.Get(0xFFFF)->Get(0)); 1471 CHECK(table.Get(0xFFFF)->Get(0));
1472 } 1472 }
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
1565 CHECK_EQ(length, length2); 1565 CHECK_EQ(length, length2);
1566 for (int k = 0; k < length; k++) 1566 for (int k = 0; k < length; k++)
1567 CHECK_EQ(static_cast<int>(chars[k]), static_cast<int>(chars2[k])); 1567 CHECK_EQ(static_cast<int>(chars[k]), static_cast<int>(chars2[k]));
1568 } 1568 }
1569 } 1569 }
1570 } 1570 }
1571 1571
1572 1572
1573 static void TestRangeCaseIndependence(CharacterRange input, 1573 static void TestRangeCaseIndependence(CharacterRange input,
1574 Vector<CharacterRange> expected) { 1574 Vector<CharacterRange> expected) {
1575 Zone zone(Isolate::Current()); 1575 Zone zone(CcTest::i_isolate());
1576 int count = expected.length(); 1576 int count = expected.length();
1577 ZoneList<CharacterRange>* list = 1577 ZoneList<CharacterRange>* list =
1578 new(&zone) ZoneList<CharacterRange>(count, &zone); 1578 new(&zone) ZoneList<CharacterRange>(count, &zone);
1579 input.AddCaseEquivalents(list, false, &zone); 1579 input.AddCaseEquivalents(list, false, &zone);
1580 CHECK_EQ(count, list->length()); 1580 CHECK_EQ(count, list->length());
1581 for (int i = 0; i < list->length(); i++) { 1581 for (int i = 0; i < list->length(); i++) {
1582 CHECK_EQ(expected[i].from(), list->at(i).from()); 1582 CHECK_EQ(expected[i].from(), list->at(i).from());
1583 CHECK_EQ(expected[i].to(), list->at(i).to()); 1583 CHECK_EQ(expected[i].to(), list->at(i).to());
1584 } 1584 }
1585 } 1585 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1630 CharacterRange range = ranges->at(i); 1630 CharacterRange range = ranges->at(i);
1631 if (range.from() <= c && c <= range.to()) 1631 if (range.from() <= c && c <= range.to())
1632 return true; 1632 return true;
1633 } 1633 }
1634 return false; 1634 return false;
1635 } 1635 }
1636 1636
1637 1637
1638 TEST(CharClassDifference) { 1638 TEST(CharClassDifference) {
1639 v8::internal::V8::Initialize(NULL); 1639 v8::internal::V8::Initialize(NULL);
1640 Zone zone(Isolate::Current()); 1640 Zone zone(CcTest::i_isolate());
1641 ZoneList<CharacterRange>* base = 1641 ZoneList<CharacterRange>* base =
1642 new(&zone) ZoneList<CharacterRange>(1, &zone); 1642 new(&zone) ZoneList<CharacterRange>(1, &zone);
1643 base->Add(CharacterRange::Everything(), &zone); 1643 base->Add(CharacterRange::Everything(), &zone);
1644 Vector<const int> overlay = CharacterRange::GetWordBounds(); 1644 Vector<const int> overlay = CharacterRange::GetWordBounds();
1645 ZoneList<CharacterRange>* included = NULL; 1645 ZoneList<CharacterRange>* included = NULL;
1646 ZoneList<CharacterRange>* excluded = NULL; 1646 ZoneList<CharacterRange>* excluded = NULL;
1647 CharacterRange::Split(base, overlay, &included, &excluded, &zone); 1647 CharacterRange::Split(base, overlay, &included, &excluded, &zone);
1648 for (int i = 0; i < (1 << 16); i++) { 1648 for (int i = 0; i < (1 << 16); i++) {
1649 bool in_base = InClass(i, base); 1649 bool in_base = InClass(i, base);
1650 if (in_base) { 1650 if (in_base) {
1651 bool in_overlay = false; 1651 bool in_overlay = false;
1652 for (int j = 0; !in_overlay && j < overlay.length(); j += 2) { 1652 for (int j = 0; !in_overlay && j < overlay.length(); j += 2) {
1653 if (overlay[j] <= i && i < overlay[j+1]) 1653 if (overlay[j] <= i && i < overlay[j+1])
1654 in_overlay = true; 1654 in_overlay = true;
1655 } 1655 }
1656 CHECK_EQ(in_overlay, InClass(i, included)); 1656 CHECK_EQ(in_overlay, InClass(i, included));
1657 CHECK_EQ(!in_overlay, InClass(i, excluded)); 1657 CHECK_EQ(!in_overlay, InClass(i, excluded));
1658 } else { 1658 } else {
1659 CHECK(!InClass(i, included)); 1659 CHECK(!InClass(i, included));
1660 CHECK(!InClass(i, excluded)); 1660 CHECK(!InClass(i, excluded));
1661 } 1661 }
1662 } 1662 }
1663 } 1663 }
1664 1664
1665 1665
1666 TEST(CanonicalizeCharacterSets) { 1666 TEST(CanonicalizeCharacterSets) {
1667 v8::internal::V8::Initialize(NULL); 1667 v8::internal::V8::Initialize(NULL);
1668 Zone zone(Isolate::Current()); 1668 Zone zone(CcTest::i_isolate());
1669 ZoneList<CharacterRange>* list = 1669 ZoneList<CharacterRange>* list =
1670 new(&zone) ZoneList<CharacterRange>(4, &zone); 1670 new(&zone) ZoneList<CharacterRange>(4, &zone);
1671 CharacterSet set(list); 1671 CharacterSet set(list);
1672 1672
1673 list->Add(CharacterRange(10, 20), &zone); 1673 list->Add(CharacterRange(10, 20), &zone);
1674 list->Add(CharacterRange(30, 40), &zone); 1674 list->Add(CharacterRange(30, 40), &zone);
1675 list->Add(CharacterRange(50, 60), &zone); 1675 list->Add(CharacterRange(50, 60), &zone);
1676 set.Canonicalize(); 1676 set.Canonicalize();
1677 ASSERT_EQ(3, list->length()); 1677 ASSERT_EQ(3, list->length());
1678 ASSERT_EQ(10, list->at(0).from()); 1678 ASSERT_EQ(10, list->at(0).from());
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1720 list->Add(CharacterRange(20, 20), &zone); 1720 list->Add(CharacterRange(20, 20), &zone);
1721 set.Canonicalize(); 1721 set.Canonicalize();
1722 ASSERT_EQ(1, list->length()); 1722 ASSERT_EQ(1, list->length());
1723 ASSERT_EQ(10, list->at(0).from()); 1723 ASSERT_EQ(10, list->at(0).from());
1724 ASSERT_EQ(30, list->at(0).to()); 1724 ASSERT_EQ(30, list->at(0).to());
1725 } 1725 }
1726 1726
1727 1727
1728 TEST(CharacterRangeMerge) { 1728 TEST(CharacterRangeMerge) {
1729 v8::internal::V8::Initialize(NULL); 1729 v8::internal::V8::Initialize(NULL);
1730 Zone zone(Isolate::Current()); 1730 Zone zone(CcTest::i_isolate());
1731 ZoneList<CharacterRange> l1(4, &zone); 1731 ZoneList<CharacterRange> l1(4, &zone);
1732 ZoneList<CharacterRange> l2(4, &zone); 1732 ZoneList<CharacterRange> l2(4, &zone);
1733 // Create all combinations of intersections of ranges, both singletons and 1733 // Create all combinations of intersections of ranges, both singletons and
1734 // longer. 1734 // longer.
1735 1735
1736 int offset = 0; 1736 int offset = 0;
1737 1737
1738 // The five kinds of singleton intersections: 1738 // The five kinds of singleton intersections:
1739 // X 1739 // X
1740 // Y - outside before 1740 // Y - outside before
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1810 ZoneList<CharacterRange> first_only(4, &zone); 1810 ZoneList<CharacterRange> first_only(4, &zone);
1811 ZoneList<CharacterRange> second_only(4, &zone); 1811 ZoneList<CharacterRange> second_only(4, &zone);
1812 ZoneList<CharacterRange> both(4, &zone); 1812 ZoneList<CharacterRange> both(4, &zone);
1813 } 1813 }
1814 1814
1815 1815
1816 TEST(Graph) { 1816 TEST(Graph) {
1817 V8::Initialize(NULL); 1817 V8::Initialize(NULL);
1818 Execute("\\b\\w+\\b", false, true, true); 1818 Execute("\\b\\w+\\b", false, true, true);
1819 } 1819 }
OLDNEW
« no previous file with comments | « test/cctest/test-random.cc ('k') | test/cctest/test-serialize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698