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 10822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10833 | 10833 |
10834 TEST(DontLeakGlobalObjects) { | 10834 TEST(DontLeakGlobalObjects) { |
10835 // Regression test for issues 1139850 and 1174891. | 10835 // Regression test for issues 1139850 and 1174891. |
10836 | 10836 |
10837 v8::V8::Initialize(); | 10837 v8::V8::Initialize(); |
10838 | 10838 |
10839 for (int i = 0; i < 5; i++) { | 10839 for (int i = 0; i < 5; i++) { |
10840 { v8::HandleScope scope; | 10840 { v8::HandleScope scope; |
10841 LocalContext context; | 10841 LocalContext context; |
10842 } | 10842 } |
| 10843 v8::V8::ContextDisposedNotification(); |
10843 CheckSurvivingGlobalObjectsCount(0); | 10844 CheckSurvivingGlobalObjectsCount(0); |
10844 | 10845 |
10845 { v8::HandleScope scope; | 10846 { v8::HandleScope scope; |
10846 LocalContext context; | 10847 LocalContext context; |
10847 v8_compile("Date")->Run(); | 10848 v8_compile("Date")->Run(); |
10848 } | 10849 } |
| 10850 v8::V8::ContextDisposedNotification(); |
10849 CheckSurvivingGlobalObjectsCount(0); | 10851 CheckSurvivingGlobalObjectsCount(0); |
10850 | 10852 |
10851 { v8::HandleScope scope; | 10853 { v8::HandleScope scope; |
10852 LocalContext context; | 10854 LocalContext context; |
10853 v8_compile("/aaa/")->Run(); | 10855 v8_compile("/aaa/")->Run(); |
10854 } | 10856 } |
| 10857 v8::V8::ContextDisposedNotification(); |
10855 CheckSurvivingGlobalObjectsCount(0); | 10858 CheckSurvivingGlobalObjectsCount(0); |
10856 | 10859 |
10857 { v8::HandleScope scope; | 10860 { v8::HandleScope scope; |
10858 const char* extension_list[] = { "v8/gc" }; | 10861 const char* extension_list[] = { "v8/gc" }; |
10859 v8::ExtensionConfiguration extensions(1, extension_list); | 10862 v8::ExtensionConfiguration extensions(1, extension_list); |
10860 LocalContext context(&extensions); | 10863 LocalContext context(&extensions); |
10861 v8_compile("gc();")->Run(); | 10864 v8_compile("gc();")->Run(); |
10862 } | 10865 } |
| 10866 v8::V8::ContextDisposedNotification(); |
10863 CheckSurvivingGlobalObjectsCount(0); | 10867 CheckSurvivingGlobalObjectsCount(0); |
10864 } | 10868 } |
10865 } | 10869 } |
10866 | 10870 |
10867 | 10871 |
10868 v8::Persistent<v8::Object> some_object; | 10872 v8::Persistent<v8::Object> some_object; |
10869 v8::Persistent<v8::Object> bad_handle; | 10873 v8::Persistent<v8::Object> bad_handle; |
10870 | 10874 |
10871 void NewPersistentHandleCallback(v8::Persistent<v8::Value> handle, void*) { | 10875 void NewPersistentHandleCallback(v8::Persistent<v8::Value> handle, void*) { |
10872 v8::HandleScope scope; | 10876 v8::HandleScope scope; |
(...skipping 4126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14999 context->Enter(); | 15003 context->Enter(); |
15000 v8::TryCatch try_catch; | 15004 v8::TryCatch try_catch; |
15001 CompileRun(source_exception); | 15005 CompileRun(source_exception); |
15002 CHECK(try_catch.HasCaught()); | 15006 CHECK(try_catch.HasCaught()); |
15003 v8::Handle<v8::Message> message = try_catch.Message(); | 15007 v8::Handle<v8::Message> message = try_catch.Message(); |
15004 CHECK(!message.IsEmpty()); | 15008 CHECK(!message.IsEmpty()); |
15005 CHECK_EQ(1, message->GetLineNumber()); | 15009 CHECK_EQ(1, message->GetLineNumber()); |
15006 context->Exit(); | 15010 context->Exit(); |
15007 } | 15011 } |
15008 context.Dispose(); | 15012 context.Dispose(); |
| 15013 v8::V8::ContextDisposedNotification(); |
15009 for (gc_count = 1; gc_count < 10; gc_count++) { | 15014 for (gc_count = 1; gc_count < 10; gc_count++) { |
15010 other_context->Enter(); | 15015 other_context->Enter(); |
15011 CompileRun(source_exception); | 15016 CompileRun(source_exception); |
15012 other_context->Exit(); | 15017 other_context->Exit(); |
15013 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); | 15018 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); |
15014 if (GetGlobalObjectsCount() == 1) break; | 15019 if (GetGlobalObjectsCount() == 1) break; |
15015 } | 15020 } |
15016 CHECK_GE(2, gc_count); | 15021 CHECK_GE(2, gc_count); |
15017 CHECK_EQ(1, GetGlobalObjectsCount()); | 15022 CHECK_EQ(1, GetGlobalObjectsCount()); |
15018 | 15023 |
(...skipping 2599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
17618 | 17623 |
17619 i::Semaphore* sem_; | 17624 i::Semaphore* sem_; |
17620 volatile int sem_value_; | 17625 volatile int sem_value_; |
17621 }; | 17626 }; |
17622 | 17627 |
17623 | 17628 |
17624 THREADED_TEST(SemaphoreInterruption) { | 17629 THREADED_TEST(SemaphoreInterruption) { |
17625 ThreadInterruptTest().RunTest(); | 17630 ThreadInterruptTest().RunTest(); |
17626 } | 17631 } |
17627 #endif // WIN32 | 17632 #endif // WIN32 |
OLD | NEW |