| 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 1195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1206 CHECK_EQ("cdefghijklmnopqrstuvwx", *(string->ToCString())); | 1206 CHECK_EQ("cdefghijklmnopqrstuvwx", *(string->ToCString())); |
| 1207 } | 1207 } |
| 1208 | 1208 |
| 1209 | 1209 |
| 1210 TEST(AsciiArrayJoin) { | 1210 TEST(AsciiArrayJoin) { |
| 1211 // Set heap limits. | 1211 // Set heap limits. |
| 1212 static const int K = 1024; | 1212 static const int K = 1024; |
| 1213 v8::ResourceConstraints constraints; | 1213 v8::ResourceConstraints constraints; |
| 1214 constraints.set_max_young_space_size(256 * K); | 1214 constraints.set_max_young_space_size(256 * K); |
| 1215 constraints.set_max_old_space_size(4 * K * K); | 1215 constraints.set_max_old_space_size(4 * K * K); |
| 1216 v8::SetResourceConstraints(&constraints); | 1216 v8::SetResourceConstraints(CcTest::isolate(), &constraints); |
| 1217 | 1217 |
| 1218 // String s is made of 2^17 = 131072 'c' characters and a is an array | 1218 // String s is made of 2^17 = 131072 'c' characters and a is an array |
| 1219 // starting with 'bad', followed by 2^14 times the string s. That means the | 1219 // starting with 'bad', followed by 2^14 times the string s. That means the |
| 1220 // total length of the concatenated strings is 2^31 + 3. So on 32bit systems | 1220 // total length of the concatenated strings is 2^31 + 3. So on 32bit systems |
| 1221 // summing the lengths of the strings (as Smis) overflows and wraps. | 1221 // summing the lengths of the strings (as Smis) overflows and wraps. |
| 1222 static const char* join_causing_out_of_memory = | 1222 static const char* join_causing_out_of_memory = |
| 1223 "var two_14 = Math.pow(2, 14);" | 1223 "var two_14 = Math.pow(2, 14);" |
| 1224 "var two_17 = Math.pow(2, 17);" | 1224 "var two_17 = Math.pow(2, 17);" |
| 1225 "var s = Array(two_17 + 1).join('c');" | 1225 "var s = Array(two_17 + 1).join('c');" |
| 1226 "var a = ['bad'];" | 1226 "var a = ['bad'];" |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1379 CheckCanonicalEquivalence(c, test); | 1379 CheckCanonicalEquivalence(c, test); |
| 1380 continue; | 1380 continue; |
| 1381 } | 1381 } |
| 1382 if (upper != c && lower != c) { | 1382 if (upper != c && lower != c) { |
| 1383 CheckCanonicalEquivalence(c, test); | 1383 CheckCanonicalEquivalence(c, test); |
| 1384 continue; | 1384 continue; |
| 1385 } | 1385 } |
| 1386 CHECK_EQ(Min(upper, lower), test); | 1386 CHECK_EQ(Min(upper, lower), test); |
| 1387 } | 1387 } |
| 1388 } | 1388 } |
| OLD | NEW |