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

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

Issue 10872010: Reland regexp global optimizations. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 4 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-regexp.cc ('k') | test/mjsunit/regexp-global.js » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 2
3 // Check that we can traverse very deep stacks of ConsStrings using 3 // Check that we can traverse very deep stacks of ConsStrings using
4 // StringInputBuffer. Check that Get(int) works on very deep stacks 4 // StringInputBuffer. Check that Get(int) works on very deep stacks
5 // of ConsStrings. These operations may not be very fast, but they 5 // of ConsStrings. These operations may not be very fast, but they
6 // should be possible without getting errors due to too deep recursion. 6 // should be possible without getting errors due to too deep recursion.
7 7
8 #include <stdlib.h> 8 #include <stdlib.h>
9 9
10 #include "v8.h" 10 #include "v8.h"
11 11
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 v8::V8::IgnoreOutOfMemoryException(); 684 v8::V8::IgnoreOutOfMemoryException();
685 v8::Local<v8::Value> result = CompileRun( 685 v8::Local<v8::Value> result = CompileRun(
686 "var a = 'a'; " 686 "var a = 'a'; "
687 "for (var i = 0; i < 16; i++) { " 687 "for (var i = 0; i < 16; i++) { "
688 " a += a; " 688 " a += a; "
689 "} " 689 "} "
690 "a.replace(/a/g, a); "); 690 "a.replace(/a/g, a); ");
691 CHECK(result.IsEmpty()); 691 CHECK(result.IsEmpty());
692 CHECK(context->HasOutOfMemoryException()); 692 CHECK(context->HasOutOfMemoryException());
693 } 693 }
694
695
696 TEST(StringReplaceAtomTwoByteResult) {
697 InitializeVM();
698 HandleScope scope;
699 LocalContext context;
700 v8::Local<v8::Value> result = CompileRun(
701 "var subject = 'ascii~only~string~'; "
702 "var replace = '\x80'; "
703 "subject.replace(/~/g, replace); ");
704 CHECK(result->IsString());
705 Handle<String> string = v8::Utils::OpenHandle(v8::String::Cast(*result));
706 CHECK(string->IsSeqTwoByteString());
707
708 v8::Local<v8::String> expected = v8_str("ascii\x80only\x80string\x80");
709 CHECK(expected->Equals(result));
710 }
OLDNEW
« no previous file with comments | « test/cctest/test-regexp.cc ('k') | test/mjsunit/regexp-global.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698