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

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

Issue 17826004: Get rid of the ZoneScopeMode. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 } 563 }
564 s1->Get(s1->length() - 1); 564 s1->Get(s1->length() - 1);
565 s2->Get(s2->length() - 1); 565 s2->Get(s2->length() - 1);
566 } 566 }
567 567
568 568
569 TEST(Traverse) { 569 TEST(Traverse) {
570 printf("TestTraverse\n"); 570 printf("TestTraverse\n");
571 CcTest::InitializeVM(); 571 CcTest::InitializeVM();
572 v8::HandleScope scope(CcTest::isolate()); 572 v8::HandleScope scope(CcTest::isolate());
573 ZoneScope zone(Isolate::Current()->runtime_zone(), DELETE_ON_EXIT); 573 ZoneScope zone(Isolate::Current()->runtime_zone());
574 ConsStringGenerationData data(false); 574 ConsStringGenerationData data(false);
575 Handle<String> flat = ConstructBalanced(&data); 575 Handle<String> flat = ConstructBalanced(&data);
576 FlattenString(flat); 576 FlattenString(flat);
577 Handle<String> left_asymmetric = ConstructLeft(&data, DEEP_DEPTH); 577 Handle<String> left_asymmetric = ConstructLeft(&data, DEEP_DEPTH);
578 Handle<String> right_asymmetric = ConstructRight(&data, DEEP_DEPTH); 578 Handle<String> right_asymmetric = ConstructRight(&data, DEEP_DEPTH);
579 Handle<String> symmetric = ConstructBalanced(&data); 579 Handle<String> symmetric = ConstructBalanced(&data);
580 printf("1\n"); 580 printf("1\n");
581 Traverse(flat, symmetric); 581 Traverse(flat, symmetric);
582 printf("2\n"); 582 printf("2\n");
583 Traverse(flat, left_asymmetric); 583 Traverse(flat, left_asymmetric);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 "early_terminations", data.early_terminations_); 653 "early_terminations", data.early_terminations_);
654 #endif 654 #endif
655 } 655 }
656 656
657 657
658 template<typename BuildString> 658 template<typename BuildString>
659 void TestStringCharacterStream(BuildString build, int test_cases) { 659 void TestStringCharacterStream(BuildString build, int test_cases) {
660 CcTest::InitializeVM(); 660 CcTest::InitializeVM();
661 Isolate* isolate = Isolate::Current(); 661 Isolate* isolate = Isolate::Current();
662 HandleScope outer_scope(isolate); 662 HandleScope outer_scope(isolate);
663 ZoneScope zone(Isolate::Current()->runtime_zone(), DELETE_ON_EXIT); 663 ZoneScope zone(Isolate::Current()->runtime_zone());
664 ConsStringGenerationData data(true); 664 ConsStringGenerationData data(true);
665 for (int i = 0; i < test_cases; i++) { 665 for (int i = 0; i < test_cases; i++) {
666 printf("%d\n", i); 666 printf("%d\n", i);
667 HandleScope inner_scope(isolate); 667 HandleScope inner_scope(isolate);
668 AlwaysAllocateScope always_allocate; 668 AlwaysAllocateScope always_allocate;
669 // Build flat version of cons string. 669 // Build flat version of cons string.
670 Handle<String> flat_string = build(i, &data); 670 Handle<String> flat_string = build(i, &data);
671 ConsStringStats flat_string_stats; 671 ConsStringStats flat_string_stats;
672 AccumulateStats(flat_string, &flat_string_stats); 672 AccumulateStats(flat_string, &flat_string_stats);
673 // Flatten string. 673 // Flatten string.
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
922 for (int j = 0; j < lengths[i]; j++) 922 for (int j = 0; j < lengths[i]; j++)
923 CHECK_EQ(as_utf8[j], static_cast<unsigned char>(buffer[j])); 923 CHECK_EQ(as_utf8[j], static_cast<unsigned char>(buffer[j]));
924 // Check that the rest of the buffer hasn't been touched 924 // Check that the rest of the buffer hasn't been touched
925 for (int j = lengths[i]; j < 11; j++) 925 for (int j = lengths[i]; j < 11; j++)
926 CHECK_EQ(kNoChar, buffer[j]); 926 CHECK_EQ(kNoChar, buffer[j]);
927 } 927 }
928 } 928 }
929 929
930 930
931 TEST(ExternalShortStringAdd) { 931 TEST(ExternalShortStringAdd) {
932 ZoneScope zonescope(Isolate::Current()->runtime_zone(), DELETE_ON_EXIT); 932 ZoneScope zonescope(Isolate::Current()->runtime_zone());
933 933
934 CcTest::InitializeVM(); 934 CcTest::InitializeVM();
935 v8::HandleScope handle_scope(CcTest::isolate()); 935 v8::HandleScope handle_scope(CcTest::isolate());
936 Zone* zone = Isolate::Current()->runtime_zone(); 936 Zone* zone = Isolate::Current()->runtime_zone();
937 937
938 // Make sure we cover all always-flat lengths and at least one above. 938 // Make sure we cover all always-flat lengths and at least one above.
939 static const int kMaxLength = 20; 939 static const int kMaxLength = 20;
940 CHECK_GT(kMaxLength, i::ConsString::kMinLength); 940 CHECK_GT(kMaxLength, i::ConsString::kMinLength);
941 941
942 // Allocate two JavaScript arrays for holding short strings. 942 // Allocate two JavaScript arrays for holding short strings.
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1014 "test()"; 1014 "test()";
1015 CHECK_EQ(0, CompileRun(source)->Int32Value()); 1015 CHECK_EQ(0, CompileRun(source)->Int32Value());
1016 } 1016 }
1017 1017
1018 1018
1019 TEST(CachedHashOverflow) { 1019 TEST(CachedHashOverflow) {
1020 // We incorrectly allowed strings to be tagged as array indices even if their 1020 // We incorrectly allowed strings to be tagged as array indices even if their
1021 // values didn't fit in the hash field. 1021 // values didn't fit in the hash field.
1022 // See http://code.google.com/p/v8/issues/detail?id=728 1022 // See http://code.google.com/p/v8/issues/detail?id=728
1023 Isolate* isolate = Isolate::Current(); 1023 Isolate* isolate = Isolate::Current();
1024 ZoneScope zone(isolate->runtime_zone(), DELETE_ON_EXIT); 1024 ZoneScope zone(isolate->runtime_zone());
1025 1025
1026 CcTest::InitializeVM(); 1026 CcTest::InitializeVM();
1027 v8::HandleScope handle_scope(CcTest::isolate()); 1027 v8::HandleScope handle_scope(CcTest::isolate());
1028 // Lines must be executed sequentially. Combining them into one script 1028 // Lines must be executed sequentially. Combining them into one script
1029 // makes the bug go away. 1029 // makes the bug go away.
1030 const char* lines[] = { 1030 const char* lines[] = {
1031 "var x = [];", 1031 "var x = [];",
1032 "x[4] = 42;", 1032 "x[4] = 42;",
1033 "var s = \"1073741828\";", 1033 "var s = \"1073741828\";",
1034 "x[s];", 1034 "x[s];",
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
1348 CheckCanonicalEquivalence(c, test); 1348 CheckCanonicalEquivalence(c, test);
1349 continue; 1349 continue;
1350 } 1350 }
1351 if (upper != c && lower != c) { 1351 if (upper != c && lower != c) {
1352 CheckCanonicalEquivalence(c, test); 1352 CheckCanonicalEquivalence(c, test);
1353 continue; 1353 continue;
1354 } 1354 }
1355 CHECK_EQ(Min(upper, lower), test); 1355 CHECK_EQ(Min(upper, lower), test);
1356 } 1356 }
1357 } 1357 }
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