OLD | NEW |
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 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1196 CHECK(string->IsSlicedString()); | 1196 CHECK(string->IsSlicedString()); |
1197 CHECK(SlicedString::cast(*string)->parent()->IsSeqString()); | 1197 CHECK(SlicedString::cast(*string)->parent()->IsSeqString()); |
1198 CHECK_EQ("cdefghijklmnopqrstuvwx", string->ToCString().get()); | 1198 CHECK_EQ("cdefghijklmnopqrstuvwx", string->ToCString().get()); |
1199 } | 1199 } |
1200 | 1200 |
1201 | 1201 |
1202 TEST(AsciiArrayJoin) { | 1202 TEST(AsciiArrayJoin) { |
1203 // Set heap limits. | 1203 // Set heap limits. |
1204 static const int K = 1024; | 1204 static const int K = 1024; |
1205 v8::ResourceConstraints constraints; | 1205 v8::ResourceConstraints constraints; |
1206 constraints.set_max_new_space_size(256 * K); | 1206 constraints.set_max_new_space_size(2 * K * K); |
1207 constraints.set_max_old_space_size(4 * K * K); | 1207 constraints.set_max_old_space_size(4 * K * K); |
1208 v8::SetResourceConstraints(CcTest::isolate(), &constraints); | 1208 v8::SetResourceConstraints(CcTest::isolate(), &constraints); |
1209 | 1209 |
1210 // String s is made of 2^17 = 131072 'c' characters and a is an array | 1210 // String s is made of 2^17 = 131072 'c' characters and a is an array |
1211 // starting with 'bad', followed by 2^14 times the string s. That means the | 1211 // starting with 'bad', followed by 2^14 times the string s. That means the |
1212 // total length of the concatenated strings is 2^31 + 3. So on 32bit systems | 1212 // total length of the concatenated strings is 2^31 + 3. So on 32bit systems |
1213 // summing the lengths of the strings (as Smis) overflows and wraps. | 1213 // summing the lengths of the strings (as Smis) overflows and wraps. |
1214 LocalContext context; | 1214 LocalContext context; |
1215 v8::HandleScope scope(CcTest::isolate()); | 1215 v8::HandleScope scope(CcTest::isolate()); |
1216 v8::TryCatch try_catch; | 1216 v8::TryCatch try_catch; |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1404 CHECK(isolate->has_pending_exception()); \ | 1404 CHECK(isolate->has_pending_exception()); \ |
1405 isolate->clear_pending_exception(); \ | 1405 isolate->clear_pending_exception(); \ |
1406 dummy.Dispose(); \ | 1406 dummy.Dispose(); \ |
1407 } | 1407 } |
1408 | 1408 |
1409 INVALID_STRING_TEST(NewStringFromAscii, char) | 1409 INVALID_STRING_TEST(NewStringFromAscii, char) |
1410 INVALID_STRING_TEST(NewStringFromUtf8, char) | 1410 INVALID_STRING_TEST(NewStringFromUtf8, char) |
1411 INVALID_STRING_TEST(NewStringFromOneByte, uint8_t) | 1411 INVALID_STRING_TEST(NewStringFromOneByte, uint8_t) |
1412 | 1412 |
1413 #undef INVALID_STRING_TEST | 1413 #undef INVALID_STRING_TEST |
OLD | NEW |