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

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

Issue 11319: * Add support for positive lookahead assertions and negative... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/regexp2000/
Patch Set: Created 12 years, 1 month 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
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 Re2kAssembler assembler(Vector<byte>(codes, 1024)); 527 Re2kAssembler assembler(Vector<byte>(codes, 1024));
528 #define __ assembler. 528 #define __ assembler.
529 Label advance; 529 Label advance;
530 Label look_for_foo; 530 Label look_for_foo;
531 Label fail; 531 Label fail;
532 __ GoTo(&look_for_foo); 532 __ GoTo(&look_for_foo);
533 __ Bind(&advance); 533 __ Bind(&advance);
534 __ AdvanceCP(1); 534 __ AdvanceCP(1);
535 __ Bind(&look_for_foo); 535 __ Bind(&look_for_foo);
536 __ LoadCurrentChar(0, &fail); 536 __ LoadCurrentChar(0, &fail);
537 __ CheckChar('f', &advance); 537 __ CheckNotCharacter('f', &advance);
538 __ LoadCurrentChar(1, &fail); 538 __ LoadCurrentChar(1, &fail);
539 __ CheckChar('o', &advance); 539 __ CheckNotCharacter('o', &advance);
540 __ LoadCurrentChar(2, &fail); 540 __ LoadCurrentChar(2, &fail);
541 __ CheckChar('o', &advance); 541 __ CheckNotCharacter('o', &advance);
542 __ SetRegisterToCurrentPosition(0); 542 __ WriteCurrentPositionToRegister(0);
543 __ SetRegisterToCurrentPosition(1, 2); 543 __ WriteCurrentPositionToRegister(1, 2);
544 __ Succeed(); 544 __ Succeed();
545 __ Bind(&fail); 545 __ Bind(&fail);
546 __ Fail(); 546 __ Fail();
547 547
548 v8::HandleScope scope; 548 v8::HandleScope scope;
549 Handle<ByteArray> array = Factory::NewByteArray(assembler.length()); 549 Handle<ByteArray> array = Factory::NewByteArray(assembler.length());
550 assembler.Copy(array->GetDataStartAddress()); 550 assembler.Copy(array->GetDataStartAddress());
551 int captures[2]; 551 int captures[2];
552 552
553 Handle<String> f1 = 553 Handle<String> f1 =
(...skipping 23 matching lines...) Expand all
577 // /^.*foo/ 577 // /^.*foo/
578 Label more_dots; 578 Label more_dots;
579 Label unwind_dot; 579 Label unwind_dot;
580 Label failure; 580 Label failure;
581 Label foo; 581 Label foo;
582 Label foo_failed; 582 Label foo_failed;
583 Label dot_match; 583 Label dot_match;
584 // ^ 584 // ^
585 __ PushCurrentPosition(); 585 __ PushCurrentPosition();
586 __ PushRegister(0); 586 __ PushRegister(0);
587 __ SetRegisterToCurrentPosition(0); 587 __ WriteCurrentPositionToRegister(0);
588 __ PushBacktrack(&failure); 588 __ PushBacktrack(&failure);
589 __ GoTo(&dot_match); 589 __ GoTo(&dot_match);
590 // .* 590 // .*
591 __ Bind(&more_dots); 591 __ Bind(&more_dots);
592 __ AdvanceCP(1); 592 __ AdvanceCP(1);
593 __ Bind(&dot_match); 593 __ Bind(&dot_match);
594 __ PushCurrentPosition(); 594 __ PushCurrentPosition();
595 __ PushBacktrack(&unwind_dot); 595 __ PushBacktrack(&unwind_dot);
596 __ LoadCurrentChar(0, &foo); 596 __ LoadCurrentChar(0, &foo);
597 __ CheckChar('\n', &more_dots); 597 __ CheckNotCharacter('\n', &more_dots);
598 // foo 598 // foo
599 __ Bind(&foo); 599 __ Bind(&foo);
600 __ CheckChar('f', &foo_failed); 600 __ CheckNotCharacter('f', &foo_failed);
601 __ LoadCurrentChar(1, &foo_failed); 601 __ LoadCurrentChar(1, &foo_failed);
602 __ CheckChar('o', &foo_failed); 602 __ CheckNotCharacter('o', &foo_failed);
603 __ LoadCurrentChar(2, &foo_failed); 603 __ LoadCurrentChar(2, &foo_failed);
604 __ CheckChar('o', &foo_failed); 604 __ CheckNotCharacter('o', &foo_failed);
605 __ SetRegisterToCurrentPosition(1, 2); 605 __ WriteCurrentPositionToRegister(1, 2);
606 __ Succeed(); 606 __ Succeed();
607 __ Break(); 607 __ Break();
608 608
609 __ Bind(&foo_failed); 609 __ Bind(&foo_failed);
610 __ PopBacktrack(); 610 __ PopBacktrack();
611 __ Break(); 611 __ Break();
612 612
613 __ Bind(&unwind_dot); 613 __ Bind(&unwind_dot);
614 __ PopCurrentPosition(); 614 __ PopCurrentPosition();
615 __ LoadCurrentChar(0, &foo_failed); 615 __ LoadCurrentChar(0, &foo_failed);
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 TEST(SimplePropagation) { 807 TEST(SimplePropagation) {
808 v8::HandleScope scope; 808 v8::HandleScope scope;
809 ZoneScope zone_scope(DELETE_ON_EXIT); 809 ZoneScope zone_scope(DELETE_ON_EXIT);
810 RegExpNode* node = Compile("(a|^b|c)"); 810 RegExpNode* node = Compile("(a|^b|c)");
811 CHECK(node->info()->determine_start); 811 CHECK(node->info()->determine_start);
812 } 812 }
813 813
814 814
815 TEST(Graph) { 815 TEST(Graph) {
816 V8::Initialize(NULL); 816 V8::Initialize(NULL);
817 Execute("(a|^b|c)", "", true); 817 Execute(".*o(?=o)", "", true);
818 } 818 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698