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

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

Issue 9231017: Recursion limit for one-char string replace and retire String::kMinNonFlatLength. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 11 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
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 348
349 349
350 TEST(ExternalShortStringAdd) { 350 TEST(ExternalShortStringAdd) {
351 ZoneScope zone(Isolate::Current(), DELETE_ON_EXIT); 351 ZoneScope zone(Isolate::Current(), DELETE_ON_EXIT);
352 352
353 InitializeVM(); 353 InitializeVM();
354 v8::HandleScope handle_scope; 354 v8::HandleScope handle_scope;
355 355
356 // Make sure we cover all always-flat lengths and at least one above. 356 // Make sure we cover all always-flat lengths and at least one above.
357 static const int kMaxLength = 20; 357 static const int kMaxLength = 20;
358 CHECK_GT(kMaxLength, i::String::kMinNonFlatLength); 358 CHECK_GT(kMaxLength, i::ConsString::kMinLength);
359 359
360 // Allocate two JavaScript arrays for holding short strings. 360 // Allocate two JavaScript arrays for holding short strings.
361 v8::Handle<v8::Array> ascii_external_strings = 361 v8::Handle<v8::Array> ascii_external_strings =
362 v8::Array::New(kMaxLength + 1); 362 v8::Array::New(kMaxLength + 1);
363 v8::Handle<v8::Array> non_ascii_external_strings = 363 v8::Handle<v8::Array> non_ascii_external_strings =
364 v8::Array::New(kMaxLength + 1); 364 v8::Array::New(kMaxLength + 1);
365 365
366 // Generate short ascii and non-ascii external strings. 366 // Generate short ascii and non-ascii external strings.
367 for (int i = 0; i <= kMaxLength; i++) { 367 for (int i = 0; i <= kMaxLength; i++) {
368 char* ascii = ZONE->NewArray<char>(i + 1); 368 char* ascii = ZONE->NewArray<char>(i + 1);
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 CHECK(SlicedString::cast(*string)->parent()->IsSeqString()); 580 CHECK(SlicedString::cast(*string)->parent()->IsSeqString());
581 CHECK_EQ("bcdefghijklmnopqrstuvwxy", *(string->ToCString())); 581 CHECK_EQ("bcdefghijklmnopqrstuvwxy", *(string->ToCString()));
582 582
583 result = CompileRun(slice_from_slice); 583 result = CompileRun(slice_from_slice);
584 CHECK(result->IsString()); 584 CHECK(result->IsString());
585 string = v8::Utils::OpenHandle(v8::String::Cast(*result)); 585 string = v8::Utils::OpenHandle(v8::String::Cast(*result));
586 CHECK(string->IsSlicedString()); 586 CHECK(string->IsSlicedString());
587 CHECK(SlicedString::cast(*string)->parent()->IsSeqString()); 587 CHECK(SlicedString::cast(*string)->parent()->IsSeqString());
588 CHECK_EQ("cdefghijklmnopqrstuvwx", *(string->ToCString())); 588 CHECK_EQ("cdefghijklmnopqrstuvwx", *(string->ToCString()));
589 } 589 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698