| 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 3697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3708 | 3708 |
| 3709 // These tests run for a long time and prevent us from running tests | 3709 // These tests run for a long time and prevent us from running tests |
| 3710 // that come after them so they cannot run in parallel. | 3710 // that come after them so they cannot run in parallel. |
| 3711 TEST(OutOfMemory) { | 3711 TEST(OutOfMemory) { |
| 3712 // It's not possible to read a snapshot into a heap with different dimensions. | 3712 // It's not possible to read a snapshot into a heap with different dimensions. |
| 3713 if (i::Snapshot::IsEnabled()) return; | 3713 if (i::Snapshot::IsEnabled()) return; |
| 3714 // Set heap limits. | 3714 // Set heap limits. |
| 3715 static const int K = 1024; | 3715 static const int K = 1024; |
| 3716 v8::ResourceConstraints constraints; | 3716 v8::ResourceConstraints constraints; |
| 3717 constraints.set_max_young_space_size(256 * K); | 3717 constraints.set_max_young_space_size(256 * K); |
| 3718 constraints.set_max_old_space_size(4 * K * K); | 3718 constraints.set_max_old_space_size(5 * K * K); |
| 3719 v8::SetResourceConstraints(&constraints); | 3719 v8::SetResourceConstraints(&constraints); |
| 3720 | 3720 |
| 3721 // Execute a script that causes out of memory. | 3721 // Execute a script that causes out of memory. |
| 3722 LocalContext context; | 3722 LocalContext context; |
| 3723 v8::HandleScope scope(context->GetIsolate()); | 3723 v8::HandleScope scope(context->GetIsolate()); |
| 3724 v8::V8::IgnoreOutOfMemoryException(); | 3724 v8::V8::IgnoreOutOfMemoryException(); |
| 3725 Local<Script> script = | 3725 Local<Script> script = |
| 3726 Script::Compile(String::New(js_code_causing_out_of_memory)); | 3726 Script::Compile(String::New(js_code_causing_out_of_memory)); |
| 3727 Local<Value> result = script->Run(); | 3727 Local<Value> result = script->Run(); |
| 3728 | 3728 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 3749 } | 3749 } |
| 3750 | 3750 |
| 3751 | 3751 |
| 3752 TEST(OutOfMemoryNested) { | 3752 TEST(OutOfMemoryNested) { |
| 3753 // It's not possible to read a snapshot into a heap with different dimensions. | 3753 // It's not possible to read a snapshot into a heap with different dimensions. |
| 3754 if (i::Snapshot::IsEnabled()) return; | 3754 if (i::Snapshot::IsEnabled()) return; |
| 3755 // Set heap limits. | 3755 // Set heap limits. |
| 3756 static const int K = 1024; | 3756 static const int K = 1024; |
| 3757 v8::ResourceConstraints constraints; | 3757 v8::ResourceConstraints constraints; |
| 3758 constraints.set_max_young_space_size(256 * K); | 3758 constraints.set_max_young_space_size(256 * K); |
| 3759 constraints.set_max_old_space_size(4 * K * K); | 3759 constraints.set_max_old_space_size(5 * K * K); |
| 3760 v8::SetResourceConstraints(&constraints); | 3760 v8::SetResourceConstraints(&constraints); |
| 3761 | 3761 |
| 3762 v8::HandleScope scope(v8::Isolate::GetCurrent()); | 3762 v8::HandleScope scope(v8::Isolate::GetCurrent()); |
| 3763 Local<ObjectTemplate> templ = ObjectTemplate::New(); | 3763 Local<ObjectTemplate> templ = ObjectTemplate::New(); |
| 3764 templ->Set(v8_str("ProvokeOutOfMemory"), | 3764 templ->Set(v8_str("ProvokeOutOfMemory"), |
| 3765 v8::FunctionTemplate::New(ProvokeOutOfMemory)); | 3765 v8::FunctionTemplate::New(ProvokeOutOfMemory)); |
| 3766 LocalContext context(0, templ); | 3766 LocalContext context(0, templ); |
| 3767 v8::V8::IgnoreOutOfMemoryException(); | 3767 v8::V8::IgnoreOutOfMemoryException(); |
| 3768 Local<Value> result = CompileRun( | 3768 Local<Value> result = CompileRun( |
| 3769 "var thrown = false;" | 3769 "var thrown = false;" |
| (...skipping 15832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 19602 i::Semaphore* sem_; | 19602 i::Semaphore* sem_; |
| 19603 volatile int sem_value_; | 19603 volatile int sem_value_; |
| 19604 }; | 19604 }; |
| 19605 | 19605 |
| 19606 | 19606 |
| 19607 THREADED_TEST(SemaphoreInterruption) { | 19607 THREADED_TEST(SemaphoreInterruption) { |
| 19608 ThreadInterruptTest().RunTest(); | 19608 ThreadInterruptTest().RunTest(); |
| 19609 } | 19609 } |
| 19610 | 19610 |
| 19611 #endif // WIN32 | 19611 #endif // WIN32 |
| OLD | NEW |