OLD | NEW |
1 // Copyright 2007-2008 Google Inc. All Rights Reserved. | 1 // Copyright 2007-2008 Google Inc. 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 1409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1420 CHECK_EQ(10.11, a4->Get(v8::Integer::New(3))->NumberValue()); | 1420 CHECK_EQ(10.11, a4->Get(v8::Integer::New(3))->NumberValue()); |
1421 } | 1421 } |
1422 | 1422 |
1423 | 1423 |
1424 static const char* js_code_causing_out_of_memory = | 1424 static const char* js_code_causing_out_of_memory = |
1425 "var a = new Array(); while(true) a.push(a);"; | 1425 "var a = new Array(); while(true) a.push(a);"; |
1426 | 1426 |
1427 | 1427 |
1428 // These tests run for a long time and prevent us from running tests | 1428 // These tests run for a long time and prevent us from running tests |
1429 // that come after them so they cannot run in parallel. | 1429 // that come after them so they cannot run in parallel. |
1430 TEST(OutOfMemory) { | 1430 DISABLED_TEST(OutOfMemory) { |
1431 // It's not possible to read a snapshot into a heap with different dimensions. | 1431 // It's not possible to read a snapshot into a heap with different dimensions. |
1432 v8::internal::Snapshot::DisableInternal(); | 1432 v8::internal::Snapshot::DisableInternal(); |
1433 // Set heap limits. | 1433 // Set heap limits. |
1434 static const int K = 1024; | 1434 static const int K = 1024; |
1435 v8::ResourceConstraints constraints; | 1435 v8::ResourceConstraints constraints; |
1436 constraints.set_max_young_space_size(256 * K); | 1436 constraints.set_max_young_space_size(256 * K); |
1437 constraints.set_max_old_space_size(2 * K * K); | 1437 constraints.set_max_old_space_size(2 * K * K); |
1438 v8::SetResourceConstraints(&constraints); | 1438 v8::SetResourceConstraints(&constraints); |
1439 | 1439 |
1440 // Execute a script that causes out of memory. | 1440 // Execute a script that causes out of memory. |
(...skipping 20 matching lines...) Expand all Loading... |
1461 Local<Value> result = script->Run(); | 1461 Local<Value> result = script->Run(); |
1462 | 1462 |
1463 // Check for out of memory state. | 1463 // Check for out of memory state. |
1464 CHECK(result.IsEmpty()); | 1464 CHECK(result.IsEmpty()); |
1465 CHECK(context->HasOutOfMemoryException()); | 1465 CHECK(context->HasOutOfMemoryException()); |
1466 | 1466 |
1467 return result; | 1467 return result; |
1468 } | 1468 } |
1469 | 1469 |
1470 | 1470 |
1471 TEST(OutOfMemoryNested) { | 1471 DISABLED_TEST(OutOfMemoryNested) { |
1472 // It's not possible to read a snapshot into a heap with different dimensions. | 1472 // It's not possible to read a snapshot into a heap with different dimensions. |
1473 v8::internal::Snapshot::DisableInternal(); | 1473 v8::internal::Snapshot::DisableInternal(); |
1474 // Set heap limits. | 1474 // Set heap limits. |
1475 static const int K = 1024; | 1475 static const int K = 1024; |
1476 v8::ResourceConstraints constraints; | 1476 v8::ResourceConstraints constraints; |
1477 constraints.set_max_young_space_size(256 * K); | 1477 constraints.set_max_young_space_size(256 * K); |
1478 constraints.set_max_old_space_size(2 * K * K); | 1478 constraints.set_max_old_space_size(2 * K * K); |
1479 v8::SetResourceConstraints(&constraints); | 1479 v8::SetResourceConstraints(&constraints); |
1480 | 1480 |
1481 v8::HandleScope scope; | 1481 v8::HandleScope scope; |
(...skipping 3328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4810 THREADED_TEST(DisposeEnteredContext) { | 4810 THREADED_TEST(DisposeEnteredContext) { |
4811 v8::HandleScope scope; | 4811 v8::HandleScope scope; |
4812 LocalContext outer; | 4812 LocalContext outer; |
4813 { v8::Persistent<v8::Context> inner = v8::Context::New(); | 4813 { v8::Persistent<v8::Context> inner = v8::Context::New(); |
4814 inner->Enter(); | 4814 inner->Enter(); |
4815 inner.Dispose(); | 4815 inner.Dispose(); |
4816 inner.Clear(); | 4816 inner.Clear(); |
4817 inner->Exit(); | 4817 inner->Exit(); |
4818 } | 4818 } |
4819 } | 4819 } |
OLD | NEW |