| 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 1209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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'];" |
| 1227 "for (var i = 1; i <= two_14; i++) a.push(s);" | 1227 "for (var i = 1; i <= two_14; i++) a.push(s);" |
| 1228 "a.join("");"; | 1228 "a.join("");"; |
| 1229 | 1229 |
| 1230 v8::HandleScope scope(v8::Isolate::GetCurrent()); | 1230 v8::HandleScope scope(CcTest::isolate()); |
| 1231 LocalContext context; | 1231 LocalContext context; |
| 1232 v8::V8::IgnoreOutOfMemoryException(); | 1232 v8::V8::IgnoreOutOfMemoryException(); |
| 1233 v8::Local<v8::Script> script = | 1233 v8::Local<v8::Script> script = |
| 1234 v8::Script::Compile(v8::String::New(join_causing_out_of_memory)); | 1234 v8::Script::Compile(v8::String::New(join_causing_out_of_memory)); |
| 1235 v8::Local<v8::Value> result = script->Run(); | 1235 v8::Local<v8::Value> result = script->Run(); |
| 1236 | 1236 |
| 1237 // Check for out of memory state. | 1237 // Check for out of memory state. |
| 1238 CHECK(result.IsEmpty()); | 1238 CHECK(result.IsEmpty()); |
| 1239 CHECK(context->HasOutOfMemoryException()); | 1239 CHECK(context->HasOutOfMemoryException()); |
| 1240 } | 1240 } |
| (...skipping 138 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 |