Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Side by Side Diff: test/cctest/test-api.cc

Issue 11092081: Reland r12342: Flush monomorphic ICs on context disposal instead of context exit. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2
Michael Starzinger 2012/10/12 11:08:07 That looks like a typo?
ulan 2012/10/12 12:23:09 Done.
2 // Redistribution and use in source and binary forms, with or without 3 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 4 // modification, are permitted provided that the following conditions are
4 // met: 5 // met:
5 // 6 //
6 // * Redistributions of source code must retain the above copyright 7 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 8 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 9 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 10 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 11 // disclaimer in the documentation and/or other materials provided
11 // with the distribution. 12 // with the distribution.
(...skipping 10821 matching lines...) Expand 10 before | Expand all | Expand 10 after
10833 10834
10834 TEST(DontLeakGlobalObjects) { 10835 TEST(DontLeakGlobalObjects) {
10835 // Regression test for issues 1139850 and 1174891. 10836 // Regression test for issues 1139850 and 1174891.
10836 10837
10837 v8::V8::Initialize(); 10838 v8::V8::Initialize();
10838 10839
10839 for (int i = 0; i < 5; i++) { 10840 for (int i = 0; i < 5; i++) {
10840 { v8::HandleScope scope; 10841 { v8::HandleScope scope;
10841 LocalContext context; 10842 LocalContext context;
10842 } 10843 }
10844 // Fire context disposed notification to force clearing monomorphic ICs.
Michael Starzinger 2012/10/12 11:08:07 I think we can drop the comment, the method call i
ulan 2012/10/12 12:23:09 Done.
10845 v8::V8::ContextDisposedNotification();
10843 CheckSurvivingGlobalObjectsCount(0); 10846 CheckSurvivingGlobalObjectsCount(0);
10844 10847
10845 { v8::HandleScope scope; 10848 { v8::HandleScope scope;
10846 LocalContext context; 10849 LocalContext context;
10847 v8_compile("Date")->Run(); 10850 v8_compile("Date")->Run();
10848 } 10851 }
10852 // Fire context disposed notification to force clearing monomorphic ICs.
10853 v8::V8::ContextDisposedNotification();
10849 CheckSurvivingGlobalObjectsCount(0); 10854 CheckSurvivingGlobalObjectsCount(0);
10850 10855
10851 { v8::HandleScope scope; 10856 { v8::HandleScope scope;
10852 LocalContext context; 10857 LocalContext context;
10853 v8_compile("/aaa/")->Run(); 10858 v8_compile("/aaa/")->Run();
10854 } 10859 }
10860 // Fire context disposed notification to force clearing monomorphic ICs.
10861 v8::V8::ContextDisposedNotification();
10855 CheckSurvivingGlobalObjectsCount(0); 10862 CheckSurvivingGlobalObjectsCount(0);
10856 10863
10857 { v8::HandleScope scope; 10864 { v8::HandleScope scope;
10858 const char* extension_list[] = { "v8/gc" }; 10865 const char* extension_list[] = { "v8/gc" };
10859 v8::ExtensionConfiguration extensions(1, extension_list); 10866 v8::ExtensionConfiguration extensions(1, extension_list);
10860 LocalContext context(&extensions); 10867 LocalContext context(&extensions);
10861 v8_compile("gc();")->Run(); 10868 v8_compile("gc();")->Run();
10862 } 10869 }
10870 // Fire context disposed notification to force clearing monomorphic ICs.
10871 v8::V8::ContextDisposedNotification();
10863 CheckSurvivingGlobalObjectsCount(0); 10872 CheckSurvivingGlobalObjectsCount(0);
10864 } 10873 }
10865 } 10874 }
10866 10875
10867 10876
10868 v8::Persistent<v8::Object> some_object; 10877 v8::Persistent<v8::Object> some_object;
10869 v8::Persistent<v8::Object> bad_handle; 10878 v8::Persistent<v8::Object> bad_handle;
10870 10879
10871 void NewPersistentHandleCallback(v8::Persistent<v8::Value> handle, void*) { 10880 void NewPersistentHandleCallback(v8::Persistent<v8::Value> handle, void*) {
10872 v8::HandleScope scope; 10881 v8::HandleScope scope;
(...skipping 4126 matching lines...) Expand 10 before | Expand all | Expand 10 after
14999 context->Enter(); 15008 context->Enter();
15000 v8::TryCatch try_catch; 15009 v8::TryCatch try_catch;
15001 CompileRun(source_exception); 15010 CompileRun(source_exception);
15002 CHECK(try_catch.HasCaught()); 15011 CHECK(try_catch.HasCaught());
15003 v8::Handle<v8::Message> message = try_catch.Message(); 15012 v8::Handle<v8::Message> message = try_catch.Message();
15004 CHECK(!message.IsEmpty()); 15013 CHECK(!message.IsEmpty());
15005 CHECK_EQ(1, message->GetLineNumber()); 15014 CHECK_EQ(1, message->GetLineNumber());
15006 context->Exit(); 15015 context->Exit();
15007 } 15016 }
15008 context.Dispose(); 15017 context.Dispose();
15018 v8::V8::ContextDisposedNotification();
15009 for (gc_count = 1; gc_count < 10; gc_count++) { 15019 for (gc_count = 1; gc_count < 10; gc_count++) {
15010 other_context->Enter(); 15020 other_context->Enter();
15011 CompileRun(source_exception); 15021 CompileRun(source_exception);
15012 other_context->Exit(); 15022 other_context->Exit();
15013 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); 15023 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
15014 if (GetGlobalObjectsCount() == 1) break; 15024 if (GetGlobalObjectsCount() == 1) break;
15015 } 15025 }
15016 CHECK_GE(2, gc_count); 15026 CHECK_GE(2, gc_count);
15017 CHECK_EQ(1, GetGlobalObjectsCount()); 15027 CHECK_EQ(1, GetGlobalObjectsCount());
15018 15028
(...skipping 2599 matching lines...) Expand 10 before | Expand all | Expand 10 after
17618 17628
17619 i::Semaphore* sem_; 17629 i::Semaphore* sem_;
17620 volatile int sem_value_; 17630 volatile int sem_value_;
17621 }; 17631 };
17622 17632
17623 17633
17624 THREADED_TEST(SemaphoreInterruption) { 17634 THREADED_TEST(SemaphoreInterruption) {
17625 ThreadInterruptTest().RunTest(); 17635 ThreadInterruptTest().RunTest();
17626 } 17636 }
17627 #endif // WIN32 17637 #endif // WIN32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698