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

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

Issue 119013004: Revert "More API cleanup." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years 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-object-observe.cc ('k') | test/cctest/test-thread-termination.cc » ('j') | 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 942 matching lines...) Expand 10 before | Expand all | Expand 10 after
953 for (int j = 0; j < i; j++) { 953 for (int j = 0; j < i; j++) {
954 ascii[j] = 'a'; 954 ascii[j] = 'a';
955 } 955 }
956 // Terminating '\0' is left out on purpose. It is not required for external 956 // Terminating '\0' is left out on purpose. It is not required for external
957 // string data. 957 // string data.
958 AsciiResource* ascii_resource = 958 AsciiResource* ascii_resource =
959 new(&zone) AsciiResource(Vector<const char>(ascii, i)); 959 new(&zone) AsciiResource(Vector<const char>(ascii, i));
960 v8::Local<v8::String> ascii_external_string = 960 v8::Local<v8::String> ascii_external_string =
961 v8::String::NewExternal(CcTest::isolate(), ascii_resource); 961 v8::String::NewExternal(CcTest::isolate(), ascii_resource);
962 962
963 ascii_external_strings->Set(v8::Integer::New(CcTest::isolate(), i), 963 ascii_external_strings->Set(v8::Integer::New(i), ascii_external_string);
964 ascii_external_string);
965 uc16* non_ascii = zone.NewArray<uc16>(i + 1); 964 uc16* non_ascii = zone.NewArray<uc16>(i + 1);
966 for (int j = 0; j < i; j++) { 965 for (int j = 0; j < i; j++) {
967 non_ascii[j] = 0x1234; 966 non_ascii[j] = 0x1234;
968 } 967 }
969 // Terminating '\0' is left out on purpose. It is not required for external 968 // Terminating '\0' is left out on purpose. It is not required for external
970 // string data. 969 // string data.
971 Resource* resource = new(&zone) Resource(Vector<const uc16>(non_ascii, i)); 970 Resource* resource = new(&zone) Resource(Vector<const uc16>(non_ascii, i));
972 v8::Local<v8::String> non_ascii_external_string = 971 v8::Local<v8::String> non_ascii_external_string =
973 v8::String::NewExternal(CcTest::isolate(), resource); 972 v8::String::NewExternal(CcTest::isolate(), resource);
974 non_ascii_external_strings->Set(v8::Integer::New(CcTest::isolate(), i), 973 non_ascii_external_strings->Set(v8::Integer::New(i),
975 non_ascii_external_string); 974 non_ascii_external_string);
976 } 975 }
977 976
978 // Add the arrays with the short external strings in the global object. 977 // Add the arrays with the short external strings in the global object.
979 v8::Handle<v8::Object> global = context->Global(); 978 v8::Handle<v8::Object> global = context->Global();
980 global->Set(v8_str("external_ascii"), ascii_external_strings); 979 global->Set(v8_str("external_ascii"), ascii_external_strings);
981 global->Set(v8_str("external_non_ascii"), non_ascii_external_strings); 980 global->Set(v8_str("external_non_ascii"), non_ascii_external_strings);
982 global->Set(v8_str("max_length"), 981 global->Set(v8_str("max_length"), v8::Integer::New(kMaxLength));
983 v8::Integer::New(CcTest::isolate(), kMaxLength));
984 982
985 // Add short external ascii and non-ascii strings checking the result. 983 // Add short external ascii and non-ascii strings checking the result.
986 static const char* source = 984 static const char* source =
987 "function test() {" 985 "function test() {"
988 " var ascii_chars = 'aaaaaaaaaaaaaaaaaaaa';" 986 " var ascii_chars = 'aaaaaaaaaaaaaaaaaaaa';"
989 " var non_ascii_chars = '\\u1234\\u1234\\u1234\\u1234\\u1234\\u1234\\u1234\ \u1234\\u1234\\u1234\\u1234\\u1234\\u1234\\u1234\\u1234\\u1234\\u1234\\u1234\\u1 234\\u1234';" //NOLINT 987 " var non_ascii_chars = '\\u1234\\u1234\\u1234\\u1234\\u1234\\u1234\\u1234\ \u1234\\u1234\\u1234\\u1234\\u1234\\u1234\\u1234\\u1234\\u1234\\u1234\\u1234\\u1 234\\u1234';" //NOLINT
990 " if (ascii_chars.length != max_length) return 1;" 988 " if (ascii_chars.length != max_length) return 1;"
991 " if (non_ascii_chars.length != max_length) return 2;" 989 " if (non_ascii_chars.length != max_length) return 2;"
992 " var ascii = Array(max_length + 1);" 990 " var ascii = Array(max_length + 1);"
993 " var non_ascii = Array(max_length + 1);" 991 " var non_ascii = Array(max_length + 1);"
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
1382 CheckCanonicalEquivalence(c, test); 1380 CheckCanonicalEquivalence(c, test);
1383 continue; 1381 continue;
1384 } 1382 }
1385 if (upper != c && lower != c) { 1383 if (upper != c && lower != c) {
1386 CheckCanonicalEquivalence(c, test); 1384 CheckCanonicalEquivalence(c, test);
1387 continue; 1385 continue;
1388 } 1386 }
1389 CHECK_EQ(Min(upper, lower), test); 1387 CHECK_EQ(Min(upper, lower), test);
1390 } 1388 }
1391 } 1389 }
OLDNEW
« no previous file with comments | « test/cctest/test-object-observe.cc ('k') | test/cctest/test-thread-termination.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698