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 1194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1205 CHECK(string->IsSlicedString()); | 1205 CHECK(string->IsSlicedString()); |
1206 CHECK(SlicedString::cast(*string)->parent()->IsSeqString()); | 1206 CHECK(SlicedString::cast(*string)->parent()->IsSeqString()); |
1207 CHECK_EQ("cdefghijklmnopqrstuvwx", string->ToCString().get()); | 1207 CHECK_EQ("cdefghijklmnopqrstuvwx", string->ToCString().get()); |
1208 } | 1208 } |
1209 | 1209 |
1210 | 1210 |
1211 TEST(AsciiArrayJoin) { | 1211 TEST(AsciiArrayJoin) { |
1212 // Set heap limits. | 1212 // Set heap limits. |
1213 static const int K = 1024; | 1213 static const int K = 1024; |
1214 v8::ResourceConstraints constraints; | 1214 v8::ResourceConstraints constraints; |
1215 constraints.set_max_young_space_size(256 * K); | 1215 constraints.set_max_new_space_size(256 * K); |
1216 constraints.set_max_old_space_size(4 * K * K); | 1216 constraints.set_max_old_space_size(4 * K * K); |
1217 v8::SetResourceConstraints(CcTest::isolate(), &constraints); | 1217 v8::SetResourceConstraints(CcTest::isolate(), &constraints); |
1218 | 1218 |
1219 // String s is made of 2^17 = 131072 'c' characters and a is an array | 1219 // String s is made of 2^17 = 131072 'c' characters and a is an array |
1220 // starting with 'bad', followed by 2^14 times the string s. That means the | 1220 // starting with 'bad', followed by 2^14 times the string s. That means the |
1221 // total length of the concatenated strings is 2^31 + 3. So on 32bit systems | 1221 // total length of the concatenated strings is 2^31 + 3. So on 32bit systems |
1222 // summing the lengths of the strings (as Smis) overflows and wraps. | 1222 // summing the lengths of the strings (as Smis) overflows and wraps. |
1223 LocalContext context; | 1223 LocalContext context; |
1224 v8::HandleScope scope(CcTest::isolate()); | 1224 v8::HandleScope scope(CcTest::isolate()); |
1225 v8::TryCatch try_catch; | 1225 v8::TryCatch try_catch; |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1415 dummy.Dispose(); \ | 1415 dummy.Dispose(); \ |
1416 } | 1416 } |
1417 | 1417 |
1418 INVALID_STRING_TEST(NewStringFromAscii, char) | 1418 INVALID_STRING_TEST(NewStringFromAscii, char) |
1419 INVALID_STRING_TEST(NewStringFromUtf8, char) | 1419 INVALID_STRING_TEST(NewStringFromUtf8, char) |
1420 INVALID_STRING_TEST(NewStringFromOneByte, uint8_t) | 1420 INVALID_STRING_TEST(NewStringFromOneByte, uint8_t) |
1421 INVALID_STRING_TEST(InternalizeOneByteString, uint8_t) | 1421 INVALID_STRING_TEST(InternalizeOneByteString, uint8_t) |
1422 INVALID_STRING_TEST(InternalizeUtf8String, char) | 1422 INVALID_STRING_TEST(InternalizeUtf8String, char) |
1423 | 1423 |
1424 #undef INVALID_STRING_TEST | 1424 #undef INVALID_STRING_TEST |
OLD | NEW |