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

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

Issue 10836189: Flush monomorphic ICs on context disposal instead of context exit. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address comments Created 8 years, 4 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
« no previous file with comments | « src/objects-visiting-inl.h ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2
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 10758 matching lines...) Expand 10 before | Expand all | Expand 10 after
10770 10771
10771 TEST(DontLeakGlobalObjects) { 10772 TEST(DontLeakGlobalObjects) {
10772 // Regression test for issues 1139850 and 1174891. 10773 // Regression test for issues 1139850 and 1174891.
10773 10774
10774 v8::V8::Initialize(); 10775 v8::V8::Initialize();
10775 10776
10776 for (int i = 0; i < 5; i++) { 10777 for (int i = 0; i < 5; i++) {
10777 { v8::HandleScope scope; 10778 { v8::HandleScope scope;
10778 LocalContext context; 10779 LocalContext context;
10779 } 10780 }
10781 // Fire context disposed notification to force clearing monomorphic ICs.
10782 v8::V8::ContextDisposedNotification();
10780 CheckSurvivingGlobalObjectsCount(0); 10783 CheckSurvivingGlobalObjectsCount(0);
10781 10784
10782 { v8::HandleScope scope; 10785 { v8::HandleScope scope;
10783 LocalContext context; 10786 LocalContext context;
10784 v8_compile("Date")->Run(); 10787 v8_compile("Date")->Run();
10785 } 10788 }
10789 // Fire context disposed notification to force clearing monomorphic ICs.
10790 v8::V8::ContextDisposedNotification();
10786 CheckSurvivingGlobalObjectsCount(0); 10791 CheckSurvivingGlobalObjectsCount(0);
10787 10792
10788 { v8::HandleScope scope; 10793 { v8::HandleScope scope;
10789 LocalContext context; 10794 LocalContext context;
10790 v8_compile("/aaa/")->Run(); 10795 v8_compile("/aaa/")->Run();
10791 } 10796 }
10797 // Fire context disposed notification to force clearing monomorphic ICs.
10798 v8::V8::ContextDisposedNotification();
10792 CheckSurvivingGlobalObjectsCount(0); 10799 CheckSurvivingGlobalObjectsCount(0);
10793 10800
10794 { v8::HandleScope scope; 10801 { v8::HandleScope scope;
10795 const char* extension_list[] = { "v8/gc" }; 10802 const char* extension_list[] = { "v8/gc" };
10796 v8::ExtensionConfiguration extensions(1, extension_list); 10803 v8::ExtensionConfiguration extensions(1, extension_list);
10797 LocalContext context(&extensions); 10804 LocalContext context(&extensions);
10798 v8_compile("gc();")->Run(); 10805 v8_compile("gc();")->Run();
10799 } 10806 }
10807 // Fire context disposed notification to force clearing monomorphic ICs.
10808 v8::V8::ContextDisposedNotification();
10800 CheckSurvivingGlobalObjectsCount(0); 10809 CheckSurvivingGlobalObjectsCount(0);
10801 } 10810 }
10802 } 10811 }
10803 10812
10804 10813
10805 v8::Persistent<v8::Object> some_object; 10814 v8::Persistent<v8::Object> some_object;
10806 v8::Persistent<v8::Object> bad_handle; 10815 v8::Persistent<v8::Object> bad_handle;
10807 10816
10808 void NewPersistentHandleCallback(v8::Persistent<v8::Value> handle, void*) { 10817 void NewPersistentHandleCallback(v8::Persistent<v8::Value> handle, void*) {
10809 v8::HandleScope scope; 10818 v8::HandleScope scope;
(...skipping 3809 matching lines...) Expand 10 before | Expand all | Expand 10 after
14619 context->Enter(); 14628 context->Enter();
14620 v8::TryCatch try_catch; 14629 v8::TryCatch try_catch;
14621 CompileRun(source_exception); 14630 CompileRun(source_exception);
14622 CHECK(try_catch.HasCaught()); 14631 CHECK(try_catch.HasCaught());
14623 v8::Handle<v8::Message> message = try_catch.Message(); 14632 v8::Handle<v8::Message> message = try_catch.Message();
14624 CHECK(!message.IsEmpty()); 14633 CHECK(!message.IsEmpty());
14625 CHECK_EQ(1, message->GetLineNumber()); 14634 CHECK_EQ(1, message->GetLineNumber());
14626 context->Exit(); 14635 context->Exit();
14627 } 14636 }
14628 context.Dispose(); 14637 context.Dispose();
14638 v8::V8::ContextDisposedNotification();
14629 for (gc_count = 1; gc_count < 10; gc_count++) { 14639 for (gc_count = 1; gc_count < 10; gc_count++) {
14630 other_context->Enter(); 14640 other_context->Enter();
14631 CompileRun(source_exception); 14641 CompileRun(source_exception);
14632 other_context->Exit(); 14642 other_context->Exit();
14633 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); 14643 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
14634 if (GetGlobalObjectsCount() == 1) break; 14644 if (GetGlobalObjectsCount() == 1) break;
14635 } 14645 }
14636 CHECK_GE(2, gc_count); 14646 CHECK_GE(2, gc_count);
14637 CHECK_EQ(1, GetGlobalObjectsCount()); 14647 CHECK_EQ(1, GetGlobalObjectsCount());
14638 14648
(...skipping 2469 matching lines...) Expand 10 before | Expand all | Expand 10 after
17108 v8::HandleScope scope; 17118 v8::HandleScope scope;
17109 LocalContext context; 17119 LocalContext context;
17110 17120
17111 // Compile a try-finally clause where the finally block causes a GC 17121 // Compile a try-finally clause where the finally block causes a GC
17112 // while there still is a message pending for external reporting. 17122 // while there still is a message pending for external reporting.
17113 TryCatch try_catch; 17123 TryCatch try_catch;
17114 try_catch.SetVerbose(true); 17124 try_catch.SetVerbose(true);
17115 CompileRun("try { throw new Error(); } finally { gc(); }"); 17125 CompileRun("try { throw new Error(); } finally { gc(); }");
17116 CHECK(try_catch.HasCaught()); 17126 CHECK(try_catch.HasCaught());
17117 } 17127 }
OLDNEW
« no previous file with comments | « src/objects-visiting-inl.h ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698