| OLD | NEW |
| 1 // Copyright 2007-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2009 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 1792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1803 constraints.set_max_young_space_size(256 * K); | 1803 constraints.set_max_young_space_size(256 * K); |
| 1804 constraints.set_max_old_space_size(2 * K * K); | 1804 constraints.set_max_old_space_size(2 * K * K); |
| 1805 v8::SetResourceConstraints(&constraints); | 1805 v8::SetResourceConstraints(&constraints); |
| 1806 | 1806 |
| 1807 // Execute a script that causes out of memory. | 1807 // Execute a script that causes out of memory. |
| 1808 v8::V8::IgnoreOutOfMemoryException(); | 1808 v8::V8::IgnoreOutOfMemoryException(); |
| 1809 | 1809 |
| 1810 // Build huge string. This should fail with out of memory exception. | 1810 // Build huge string. This should fail with out of memory exception. |
| 1811 Local<Value> result = CompileRun( | 1811 Local<Value> result = CompileRun( |
| 1812 "var str = Array.prototype.join.call({length: 513}, \"A\").toUpperCase();" | 1812 "var str = Array.prototype.join.call({length: 513}, \"A\").toUpperCase();" |
| 1813 "for (var i = 0; i < 21; i++) { str = str + str; }"); | 1813 "for (var i = 0; i < 22; i++) { str = str + str; }"); |
| 1814 | 1814 |
| 1815 // Check for out of memory state. | 1815 // Check for out of memory state. |
| 1816 CHECK(result.IsEmpty()); | 1816 CHECK(result.IsEmpty()); |
| 1817 CHECK(context->HasOutOfMemoryException()); | 1817 CHECK(context->HasOutOfMemoryException()); |
| 1818 } | 1818 } |
| 1819 | 1819 |
| 1820 | 1820 |
| 1821 THREADED_TEST(ConstructCall) { | 1821 THREADED_TEST(ConstructCall) { |
| 1822 v8::HandleScope scope; | 1822 v8::HandleScope scope; |
| 1823 LocalContext context; | 1823 LocalContext context; |
| (...skipping 6166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7990 env->Global()->Set(v8_str("get_stack_limit"), fun); | 7990 env->Global()->Set(v8_str("get_stack_limit"), fun); |
| 7991 CompileRun("get_stack_limit();"); | 7991 CompileRun("get_stack_limit();"); |
| 7992 | 7992 |
| 7993 CHECK(stack_limit == set_limit); | 7993 CHECK(stack_limit == set_limit); |
| 7994 } | 7994 } |
| 7995 { | 7995 { |
| 7996 v8::Locker locker; | 7996 v8::Locker locker; |
| 7997 CHECK(stack_limit == set_limit); | 7997 CHECK(stack_limit == set_limit); |
| 7998 } | 7998 } |
| 7999 } | 7999 } |
| OLD | NEW |