| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 | |
| 3 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 4 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 5 // met: | 4 // met: |
| 6 // | 5 // |
| 7 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 8 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 9 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 10 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 11 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| 12 // with the distribution. | 11 // with the distribution. |
| (...skipping 10793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10806 | 10805 |
| 10807 TEST(DontLeakGlobalObjects) { | 10806 TEST(DontLeakGlobalObjects) { |
| 10808 // Regression test for issues 1139850 and 1174891. | 10807 // Regression test for issues 1139850 and 1174891. |
| 10809 | 10808 |
| 10810 v8::V8::Initialize(); | 10809 v8::V8::Initialize(); |
| 10811 | 10810 |
| 10812 for (int i = 0; i < 5; i++) { | 10811 for (int i = 0; i < 5; i++) { |
| 10813 { v8::HandleScope scope; | 10812 { v8::HandleScope scope; |
| 10814 LocalContext context; | 10813 LocalContext context; |
| 10815 } | 10814 } |
| 10816 // Fire context disposed notification to force clearing monomorphic ICs. | |
| 10817 v8::V8::ContextDisposedNotification(); | |
| 10818 CheckSurvivingGlobalObjectsCount(0); | 10815 CheckSurvivingGlobalObjectsCount(0); |
| 10819 | 10816 |
| 10820 { v8::HandleScope scope; | 10817 { v8::HandleScope scope; |
| 10821 LocalContext context; | 10818 LocalContext context; |
| 10822 v8_compile("Date")->Run(); | 10819 v8_compile("Date")->Run(); |
| 10823 } | 10820 } |
| 10824 // Fire context disposed notification to force clearing monomorphic ICs. | |
| 10825 v8::V8::ContextDisposedNotification(); | |
| 10826 CheckSurvivingGlobalObjectsCount(0); | 10821 CheckSurvivingGlobalObjectsCount(0); |
| 10827 | 10822 |
| 10828 { v8::HandleScope scope; | 10823 { v8::HandleScope scope; |
| 10829 LocalContext context; | 10824 LocalContext context; |
| 10830 v8_compile("/aaa/")->Run(); | 10825 v8_compile("/aaa/")->Run(); |
| 10831 } | 10826 } |
| 10832 // Fire context disposed notification to force clearing monomorphic ICs. | |
| 10833 v8::V8::ContextDisposedNotification(); | |
| 10834 CheckSurvivingGlobalObjectsCount(0); | 10827 CheckSurvivingGlobalObjectsCount(0); |
| 10835 | 10828 |
| 10836 { v8::HandleScope scope; | 10829 { v8::HandleScope scope; |
| 10837 const char* extension_list[] = { "v8/gc" }; | 10830 const char* extension_list[] = { "v8/gc" }; |
| 10838 v8::ExtensionConfiguration extensions(1, extension_list); | 10831 v8::ExtensionConfiguration extensions(1, extension_list); |
| 10839 LocalContext context(&extensions); | 10832 LocalContext context(&extensions); |
| 10840 v8_compile("gc();")->Run(); | 10833 v8_compile("gc();")->Run(); |
| 10841 } | 10834 } |
| 10842 // Fire context disposed notification to force clearing monomorphic ICs. | |
| 10843 v8::V8::ContextDisposedNotification(); | |
| 10844 CheckSurvivingGlobalObjectsCount(0); | 10835 CheckSurvivingGlobalObjectsCount(0); |
| 10845 } | 10836 } |
| 10846 } | 10837 } |
| 10847 | 10838 |
| 10848 | 10839 |
| 10849 v8::Persistent<v8::Object> some_object; | 10840 v8::Persistent<v8::Object> some_object; |
| 10850 v8::Persistent<v8::Object> bad_handle; | 10841 v8::Persistent<v8::Object> bad_handle; |
| 10851 | 10842 |
| 10852 void NewPersistentHandleCallback(v8::Persistent<v8::Value> handle, void*) { | 10843 void NewPersistentHandleCallback(v8::Persistent<v8::Value> handle, void*) { |
| 10853 v8::HandleScope scope; | 10844 v8::HandleScope scope; |
| (...skipping 3811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14665 context->Enter(); | 14656 context->Enter(); |
| 14666 v8::TryCatch try_catch; | 14657 v8::TryCatch try_catch; |
| 14667 CompileRun(source_exception); | 14658 CompileRun(source_exception); |
| 14668 CHECK(try_catch.HasCaught()); | 14659 CHECK(try_catch.HasCaught()); |
| 14669 v8::Handle<v8::Message> message = try_catch.Message(); | 14660 v8::Handle<v8::Message> message = try_catch.Message(); |
| 14670 CHECK(!message.IsEmpty()); | 14661 CHECK(!message.IsEmpty()); |
| 14671 CHECK_EQ(1, message->GetLineNumber()); | 14662 CHECK_EQ(1, message->GetLineNumber()); |
| 14672 context->Exit(); | 14663 context->Exit(); |
| 14673 } | 14664 } |
| 14674 context.Dispose(); | 14665 context.Dispose(); |
| 14675 v8::V8::ContextDisposedNotification(); | |
| 14676 for (gc_count = 1; gc_count < 10; gc_count++) { | 14666 for (gc_count = 1; gc_count < 10; gc_count++) { |
| 14677 other_context->Enter(); | 14667 other_context->Enter(); |
| 14678 CompileRun(source_exception); | 14668 CompileRun(source_exception); |
| 14679 other_context->Exit(); | 14669 other_context->Exit(); |
| 14680 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); | 14670 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); |
| 14681 if (GetGlobalObjectsCount() == 1) break; | 14671 if (GetGlobalObjectsCount() == 1) break; |
| 14682 } | 14672 } |
| 14683 CHECK_GE(2, gc_count); | 14673 CHECK_GE(2, gc_count); |
| 14684 CHECK_EQ(1, GetGlobalObjectsCount()); | 14674 CHECK_EQ(1, GetGlobalObjectsCount()); |
| 14685 | 14675 |
| (...skipping 2571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17257 | 17247 |
| 17258 i::Semaphore* sem_; | 17248 i::Semaphore* sem_; |
| 17259 volatile int sem_value_; | 17249 volatile int sem_value_; |
| 17260 }; | 17250 }; |
| 17261 | 17251 |
| 17262 | 17252 |
| 17263 THREADED_TEST(SemaphoreInterruption) { | 17253 THREADED_TEST(SemaphoreInterruption) { |
| 17264 ThreadInterruptTest().RunTest(); | 17254 ThreadInterruptTest().RunTest(); |
| 17265 } | 17255 } |
| 17266 #endif // WIN32 | 17256 #endif // WIN32 |
| OLD | NEW |