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 2679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2690 } | 2690 } |
2691 | 2691 |
2692 | 2692 |
2693 TEST(HugeConsStringOutOfMemory) { | 2693 TEST(HugeConsStringOutOfMemory) { |
2694 // It's not possible to read a snapshot into a heap with different dimensions. | 2694 // It's not possible to read a snapshot into a heap with different dimensions. |
2695 if (i::Snapshot::IsEnabled()) return; | 2695 if (i::Snapshot::IsEnabled()) return; |
2696 // Set heap limits. | 2696 // Set heap limits. |
2697 static const int K = 1024; | 2697 static const int K = 1024; |
2698 v8::ResourceConstraints constraints; | 2698 v8::ResourceConstraints constraints; |
2699 constraints.set_max_young_space_size(256 * K); | 2699 constraints.set_max_young_space_size(256 * K); |
2700 constraints.set_max_old_space_size(2 * K * K); | 2700 constraints.set_max_old_space_size(3 * K * K); |
2701 v8::SetResourceConstraints(&constraints); | 2701 v8::SetResourceConstraints(&constraints); |
2702 | 2702 |
2703 // Execute a script that causes out of memory. | 2703 // Execute a script that causes out of memory. |
2704 v8::V8::IgnoreOutOfMemoryException(); | 2704 v8::V8::IgnoreOutOfMemoryException(); |
2705 | 2705 |
2706 v8::HandleScope scope; | 2706 v8::HandleScope scope; |
2707 LocalContext context; | 2707 LocalContext context; |
2708 | 2708 |
2709 // Build huge string. This should fail with out of memory exception. | 2709 // Build huge string. This should fail with out of memory exception. |
2710 Local<Value> result = CompileRun( | 2710 Local<Value> result = CompileRun( |
(...skipping 14093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16804 " x++; \n" | 16804 " x++; \n" |
16805 " throw new Error('again'); \n" // This is the new uncaught error. | 16805 " throw new Error('again'); \n" // This is the new uncaught error. |
16806 "} \n"; | 16806 "} \n"; |
16807 CompileRun(throw_again); | 16807 CompileRun(throw_again); |
16808 CHECK(try_catch.HasCaught()); | 16808 CHECK(try_catch.HasCaught()); |
16809 Local<Message> message = try_catch.Message(); | 16809 Local<Message> message = try_catch.Message(); |
16810 CHECK(!message.IsEmpty()); | 16810 CHECK(!message.IsEmpty()); |
16811 CHECK_EQ(6, message->GetLineNumber()); | 16811 CHECK_EQ(6, message->GetLineNumber()); |
16812 } | 16812 } |
16813 } | 16813 } |
OLD | NEW |