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

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

Issue 7066004: Inline more zone stuff. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 7 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 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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 s1->Get(s1->length() - 1); 226 s1->Get(s1->length() - 1);
227 s2->Get(s2->length() - 1); 227 s2->Get(s2->length() - 1);
228 } 228 }
229 229
230 230
231 TEST(Traverse) { 231 TEST(Traverse) {
232 printf("TestTraverse\n"); 232 printf("TestTraverse\n");
233 InitializeVM(); 233 InitializeVM();
234 v8::HandleScope scope; 234 v8::HandleScope scope;
235 Handle<String> building_blocks[NUMBER_OF_BUILDING_BLOCKS]; 235 Handle<String> building_blocks[NUMBER_OF_BUILDING_BLOCKS];
236 ZoneScope zone(DELETE_ON_EXIT); 236 ZoneScope zone(Isolate::Current(), DELETE_ON_EXIT);
237 InitializeBuildingBlocks(building_blocks); 237 InitializeBuildingBlocks(building_blocks);
238 Handle<String> flat = ConstructBalanced(building_blocks); 238 Handle<String> flat = ConstructBalanced(building_blocks);
239 FlattenString(flat); 239 FlattenString(flat);
240 Handle<String> left_asymmetric = ConstructLeft(building_blocks, DEEP_DEPTH); 240 Handle<String> left_asymmetric = ConstructLeft(building_blocks, DEEP_DEPTH);
241 Handle<String> right_asymmetric = ConstructRight(building_blocks, DEEP_DEPTH); 241 Handle<String> right_asymmetric = ConstructRight(building_blocks, DEEP_DEPTH);
242 Handle<String> symmetric = ConstructBalanced(building_blocks); 242 Handle<String> symmetric = ConstructBalanced(building_blocks);
243 printf("1\n"); 243 printf("1\n");
244 Traverse(flat, symmetric); 244 Traverse(flat, symmetric);
245 printf("2\n"); 245 printf("2\n");
246 Traverse(flat, left_asymmetric); 246 Traverse(flat, left_asymmetric);
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 for (int j = 0; j < lengths[i]; j++) 341 for (int j = 0; j < lengths[i]; j++)
342 CHECK_EQ(as_utf8[j], static_cast<unsigned char>(buffer[j])); 342 CHECK_EQ(as_utf8[j], static_cast<unsigned char>(buffer[j]));
343 // Check that the rest of the buffer hasn't been touched 343 // Check that the rest of the buffer hasn't been touched
344 for (int j = lengths[i]; j < 11; j++) 344 for (int j = lengths[i]; j < 11; j++)
345 CHECK_EQ(kNoChar, buffer[j]); 345 CHECK_EQ(kNoChar, buffer[j]);
346 } 346 }
347 } 347 }
348 348
349 349
350 TEST(ExternalShortStringAdd) { 350 TEST(ExternalShortStringAdd) {
351 ZoneScope zone(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::String::kMinNonFlatLength);
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 =
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 "test()"; 432 "test()";
433 CHECK_EQ(0, 433 CHECK_EQ(0,
434 v8::Script::Compile(v8::String::New(source))->Run()->Int32Value()); 434 v8::Script::Compile(v8::String::New(source))->Run()->Int32Value());
435 } 435 }
436 436
437 437
438 TEST(CachedHashOverflow) { 438 TEST(CachedHashOverflow) {
439 // We incorrectly allowed strings to be tagged as array indices even if their 439 // We incorrectly allowed strings to be tagged as array indices even if their
440 // values didn't fit in the hash field. 440 // values didn't fit in the hash field.
441 // See http://code.google.com/p/v8/issues/detail?id=728 441 // See http://code.google.com/p/v8/issues/detail?id=728
442 ZoneScope zone(DELETE_ON_EXIT); 442 ZoneScope zone(Isolate::Current(), DELETE_ON_EXIT);
443 443
444 InitializeVM(); 444 InitializeVM();
445 v8::HandleScope handle_scope; 445 v8::HandleScope handle_scope;
446 // Lines must be executed sequentially. Combining them into one script 446 // Lines must be executed sequentially. Combining them into one script
447 // makes the bug go away. 447 // makes the bug go away.
448 const char* lines[] = { 448 const char* lines[] = {
449 "var x = [];", 449 "var x = [];",
450 "x[4] = 42;", 450 "x[4] = 42;",
451 "var s = \"1073741828\";", 451 "var s = \"1073741828\";",
452 "x[s];", 452 "x[s];",
(...skipping 21 matching lines...) Expand all
474 v8::Local<v8::Value> result = 474 v8::Local<v8::Value> result =
475 v8::Script::Compile(v8::String::New(line))->Run(); 475 v8::Script::Compile(v8::String::New(line))->Run();
476 CHECK_EQ(results[i]->IsUndefined(), result->IsUndefined()); 476 CHECK_EQ(results[i]->IsUndefined(), result->IsUndefined());
477 CHECK_EQ(results[i]->IsNumber(), result->IsNumber()); 477 CHECK_EQ(results[i]->IsNumber(), result->IsNumber());
478 if (result->IsNumber()) { 478 if (result->IsNumber()) {
479 CHECK_EQ(Smi::cast(results[i]->ToSmi()->ToObjectChecked())->value(), 479 CHECK_EQ(Smi::cast(results[i]->ToSmi()->ToObjectChecked())->value(),
480 result->ToInt32()->Value()); 480 result->ToInt32()->Value());
481 } 481 }
482 } 482 }
483 } 483 }
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