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

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

Issue 7795018: Generated code for substring slices in x64 and arm. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Applied Bill's suggestions. Created 9 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 | « src/x64/macro-assembler-x64.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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"
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 CHECK(!string->IsSlicedString()); 522 CHECK(!string->IsSlicedString());
523 523
524 string = FACTORY->NewSubString(string, 0, 26); 524 string = FACTORY->NewSubString(string, 0, 26);
525 CHECK(!string->IsSlicedString()); 525 CHECK(!string->IsSlicedString());
526 result = CompileRun(crosscheck); 526 result = CompileRun(crosscheck);
527 CHECK(result->IsString()); 527 CHECK(result->IsString());
528 string = v8::Utils::OpenHandle(v8::String::Cast(*result)); 528 string = v8::Utils::OpenHandle(v8::String::Cast(*result));
529 CHECK(string->IsSlicedString()); 529 CHECK(string->IsSlicedString());
530 CHECK_EQ("bcdefghijklmnopqrstuvwxy", *(string->ToCString())); 530 CHECK_EQ("bcdefghijklmnopqrstuvwxy", *(string->ToCString()));
531 } 531 }
532
533
534 TEST(SliceFromSlice) {
535 // This tests whether a slice that contains the entire parent string
536 // actually creates a new string (it should not).
537 FLAG_string_slices = true;
538 InitializeVM();
539 HandleScope scope;
540 v8::Local<v8::Value> result;
541 Handle<String> string;
542 const char* init = "var str = 'abcdefghijklmnopqrstuvwxyz';";
543 const char* slice = "var slice = str.slice(1,-1); slice";
544 const char* slice_from_slice = "slice.slice(1,-1);";
545
546 CompileRun(init);
547 result = CompileRun(slice);
548 CHECK(result->IsString());
549 string = v8::Utils::OpenHandle(v8::String::Cast(*result));
550 CHECK(string->IsSlicedString());
551 CHECK(SlicedString::cast(*string)->parent()->IsSeqString());
552 CHECK_EQ("bcdefghijklmnopqrstuvwxy", *(string->ToCString()));
553
554 result = CompileRun(slice_from_slice);
555 CHECK(result->IsString());
556 string = v8::Utils::OpenHandle(v8::String::Cast(*result));
557 CHECK(string->IsSlicedString());
558 CHECK(SlicedString::cast(*string)->parent()->IsSeqString());
559 CHECK_EQ("cdefghijklmnopqrstuvwx", *(string->ToCString()));
560 }
OLDNEW
« no previous file with comments | « src/x64/macro-assembler-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698