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

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

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