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

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

Issue 10534139: One Zone per CompilationInfo. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rename CompilationInfoZone to ZoneWithCompilationInfo Created 8 years, 6 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') | 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 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 private: 75 private:
76 const char* data_; 76 const char* data_;
77 size_t length_; 77 size_t length_;
78 }; 78 };
79 79
80 80
81 static void InitializeBuildingBlocks( 81 static void InitializeBuildingBlocks(
82 Handle<String> building_blocks[NUMBER_OF_BUILDING_BLOCKS]) { 82 Handle<String> building_blocks[NUMBER_OF_BUILDING_BLOCKS]) {
83 // A list of pointers that we don't have any interest in cleaning up. 83 // A list of pointers that we don't have any interest in cleaning up.
84 // If they are reachable from a root then leak detection won't complain. 84 // If they are reachable from a root then leak detection won't complain.
85 Zone* zone = Isolate::Current()->zone(); 85 Zone* zone = Isolate::Current()->runtime_zone();
86 for (int i = 0; i < NUMBER_OF_BUILDING_BLOCKS; i++) { 86 for (int i = 0; i < NUMBER_OF_BUILDING_BLOCKS; i++) {
87 int len = gen() % 16; 87 int len = gen() % 16;
88 if (len > 14) { 88 if (len > 14) {
89 len += 1234; 89 len += 1234;
90 } 90 }
91 switch (gen() % 4) { 91 switch (gen() % 4) {
92 case 0: { 92 case 0: {
93 uc16 buf[2000]; 93 uc16 buf[2000];
94 for (int j = 0; j < len; j++) { 94 for (int j = 0; j < len; j++) {
95 buf[j] = gen() % 65536; 95 buf[j] = gen() % 65536;
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 s1->Get(s1->length() - 1); 227 s1->Get(s1->length() - 1);
228 s2->Get(s2->length() - 1); 228 s2->Get(s2->length() - 1);
229 } 229 }
230 230
231 231
232 TEST(Traverse) { 232 TEST(Traverse) {
233 printf("TestTraverse\n"); 233 printf("TestTraverse\n");
234 InitializeVM(); 234 InitializeVM();
235 v8::HandleScope scope; 235 v8::HandleScope scope;
236 Handle<String> building_blocks[NUMBER_OF_BUILDING_BLOCKS]; 236 Handle<String> building_blocks[NUMBER_OF_BUILDING_BLOCKS];
237 ZoneScope zone(Isolate::Current(), DELETE_ON_EXIT); 237 ZoneScope zone(Isolate::Current()->runtime_zone(), DELETE_ON_EXIT);
238 InitializeBuildingBlocks(building_blocks); 238 InitializeBuildingBlocks(building_blocks);
239 Handle<String> flat = ConstructBalanced(building_blocks); 239 Handle<String> flat = ConstructBalanced(building_blocks);
240 FlattenString(flat); 240 FlattenString(flat);
241 Handle<String> left_asymmetric = ConstructLeft(building_blocks, DEEP_DEPTH); 241 Handle<String> left_asymmetric = ConstructLeft(building_blocks, DEEP_DEPTH);
242 Handle<String> right_asymmetric = ConstructRight(building_blocks, DEEP_DEPTH); 242 Handle<String> right_asymmetric = ConstructRight(building_blocks, DEEP_DEPTH);
243 Handle<String> symmetric = ConstructBalanced(building_blocks); 243 Handle<String> symmetric = ConstructBalanced(building_blocks);
244 printf("1\n"); 244 printf("1\n");
245 Traverse(flat, symmetric); 245 Traverse(flat, symmetric);
246 printf("2\n"); 246 printf("2\n");
247 Traverse(flat, left_asymmetric); 247 Traverse(flat, left_asymmetric);
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 for (int j = 0; j < lengths[i]; j++) 342 for (int j = 0; j < lengths[i]; j++)
343 CHECK_EQ(as_utf8[j], static_cast<unsigned char>(buffer[j])); 343 CHECK_EQ(as_utf8[j], static_cast<unsigned char>(buffer[j]));
344 // Check that the rest of the buffer hasn't been touched 344 // Check that the rest of the buffer hasn't been touched
345 for (int j = lengths[i]; j < 11; j++) 345 for (int j = lengths[i]; j < 11; j++)
346 CHECK_EQ(kNoChar, buffer[j]); 346 CHECK_EQ(kNoChar, buffer[j]);
347 } 347 }
348 } 348 }
349 349
350 350
351 TEST(ExternalShortStringAdd) { 351 TEST(ExternalShortStringAdd) {
352 ZoneScope zonescope(Isolate::Current(), DELETE_ON_EXIT); 352 ZoneScope zonescope(Isolate::Current()->runtime_zone(), DELETE_ON_EXIT);
353 353
354 InitializeVM(); 354 InitializeVM();
355 v8::HandleScope handle_scope; 355 v8::HandleScope handle_scope;
356 Zone* zone = Isolate::Current()->zone(); 356 Zone* zone = Isolate::Current()->runtime_zone();
357 357
358 // Make sure we cover all always-flat lengths and at least one above. 358 // Make sure we cover all always-flat lengths and at least one above.
359 static const int kMaxLength = 20; 359 static const int kMaxLength = 20;
360 CHECK_GT(kMaxLength, i::ConsString::kMinLength); 360 CHECK_GT(kMaxLength, i::ConsString::kMinLength);
361 361
362 // Allocate two JavaScript arrays for holding short strings. 362 // Allocate two JavaScript arrays for holding short strings.
363 v8::Handle<v8::Array> ascii_external_strings = 363 v8::Handle<v8::Array> ascii_external_strings =
364 v8::Array::New(kMaxLength + 1); 364 v8::Array::New(kMaxLength + 1);
365 v8::Handle<v8::Array> non_ascii_external_strings = 365 v8::Handle<v8::Array> non_ascii_external_strings =
366 v8::Array::New(kMaxLength + 1); 366 v8::Array::New(kMaxLength + 1);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 "};" 433 "};"
434 "test()"; 434 "test()";
435 CHECK_EQ(0, CompileRun(source)->Int32Value()); 435 CHECK_EQ(0, CompileRun(source)->Int32Value());
436 } 436 }
437 437
438 438
439 TEST(CachedHashOverflow) { 439 TEST(CachedHashOverflow) {
440 // We incorrectly allowed strings to be tagged as array indices even if their 440 // We incorrectly allowed strings to be tagged as array indices even if their
441 // values didn't fit in the hash field. 441 // values didn't fit in the hash field.
442 // See http://code.google.com/p/v8/issues/detail?id=728 442 // See http://code.google.com/p/v8/issues/detail?id=728
443 ZoneScope zone(Isolate::Current(), DELETE_ON_EXIT); 443 ZoneScope zone(Isolate::Current()->runtime_zone(), DELETE_ON_EXIT);
444 444
445 InitializeVM(); 445 InitializeVM();
446 v8::HandleScope handle_scope; 446 v8::HandleScope handle_scope;
447 // Lines must be executed sequentially. Combining them into one script 447 // Lines must be executed sequentially. Combining them into one script
448 // makes the bug go away. 448 // makes the bug go away.
449 const char* lines[] = { 449 const char* lines[] = {
450 "var x = [];", 450 "var x = [];",
451 "x[4] = 42;", 451 "x[4] = 42;",
452 "var s = \"1073741828\";", 452 "var s = \"1073741828\";",
453 "x[s];", 453 "x[s];",
(...skipping 230 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 }
OLDNEW
« no previous file with comments | « test/cctest/test-regexp.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698