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

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

Issue 14947005: fix nosnapshot test failure in 14793004, do not deprecate function (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 7 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 | « test/cctest/test-hashing.cc ('k') | test/cctest/test-lockers.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 // 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 1643 matching lines...) Expand 10 before | Expand all | Expand 10 after
1654 if (obj->IsGlobalObject()) count++; 1654 if (obj->IsGlobalObject()) count++;
1655 } 1655 }
1656 return count; 1656 return count;
1657 } 1657 }
1658 1658
1659 1659
1660 // Test that we don't embed maps from foreign contexts into 1660 // Test that we don't embed maps from foreign contexts into
1661 // optimized code. 1661 // optimized code.
1662 TEST(LeakNativeContextViaMap) { 1662 TEST(LeakNativeContextViaMap) {
1663 i::FLAG_allow_natives_syntax = true; 1663 i::FLAG_allow_natives_syntax = true;
1664 v8::HandleScope outer_scope(v8::Isolate::GetCurrent()); 1664 v8::Isolate* isolate = v8::Isolate::GetCurrent();
1665 v8::Persistent<v8::Context> ctx1 = v8::Context::New(); 1665 v8::HandleScope outer_scope(isolate);
1666 v8::Persistent<v8::Context> ctx2 = v8::Context::New(); 1666 v8::Persistent<v8::Context> ctx1;
1667 v8::Persistent<v8::Context> ctx2;
1668 {
1669 v8::HandleScope scope(isolate);
1670 ctx1.Reset(isolate, v8::Context::New(isolate));
1671 ctx2.Reset(isolate, v8::Context::New(isolate));
1672 }
1667 ctx1->Enter(); 1673 ctx1->Enter();
1668 1674
1669 HEAP->CollectAllAvailableGarbage(); 1675 HEAP->CollectAllAvailableGarbage();
1670 CHECK_EQ(4, NumberOfGlobalObjects()); 1676 CHECK_EQ(4, NumberOfGlobalObjects());
1671 1677
1672 { 1678 {
1673 v8::HandleScope inner_scope(v8::Isolate::GetCurrent()); 1679 v8::HandleScope inner_scope(v8::Isolate::GetCurrent());
1674 CompileRun("var v = {x: 42}"); 1680 CompileRun("var v = {x: 42}");
1675 v8::Local<v8::Value> v = ctx1->Global()->Get(v8_str("v")); 1681 v8::Local<v8::Value> v = ctx1->Global()->Get(v8_str("v"));
1676 ctx2->Enter(); 1682 ctx2->Enter();
(...skipping 15 matching lines...) Expand all
1692 ctx2.Dispose(ctx2->GetIsolate()); 1698 ctx2.Dispose(ctx2->GetIsolate());
1693 HEAP->CollectAllAvailableGarbage(); 1699 HEAP->CollectAllAvailableGarbage();
1694 CHECK_EQ(0, NumberOfGlobalObjects()); 1700 CHECK_EQ(0, NumberOfGlobalObjects());
1695 } 1701 }
1696 1702
1697 1703
1698 // Test that we don't embed functions from foreign contexts into 1704 // Test that we don't embed functions from foreign contexts into
1699 // optimized code. 1705 // optimized code.
1700 TEST(LeakNativeContextViaFunction) { 1706 TEST(LeakNativeContextViaFunction) {
1701 i::FLAG_allow_natives_syntax = true; 1707 i::FLAG_allow_natives_syntax = true;
1702 v8::HandleScope outer_scope(v8::Isolate::GetCurrent()); 1708 v8::Isolate* isolate = v8::Isolate::GetCurrent();
1703 v8::Persistent<v8::Context> ctx1 = v8::Context::New(); 1709 v8::HandleScope outer_scope(isolate);
1704 v8::Persistent<v8::Context> ctx2 = v8::Context::New(); 1710 v8::Persistent<v8::Context> ctx1;
1711 v8::Persistent<v8::Context> ctx2;
1712 {
1713 v8::HandleScope scope(isolate);
1714 ctx1.Reset(isolate, v8::Context::New(isolate));
1715 ctx2.Reset(isolate, v8::Context::New(isolate));
1716 }
1705 ctx1->Enter(); 1717 ctx1->Enter();
1706 1718
1707 HEAP->CollectAllAvailableGarbage(); 1719 HEAP->CollectAllAvailableGarbage();
1708 CHECK_EQ(4, NumberOfGlobalObjects()); 1720 CHECK_EQ(4, NumberOfGlobalObjects());
1709 1721
1710 { 1722 {
1711 v8::HandleScope inner_scope(v8::Isolate::GetCurrent()); 1723 v8::HandleScope inner_scope(v8::Isolate::GetCurrent());
1712 CompileRun("var v = function() { return 42; }"); 1724 CompileRun("var v = function() { return 42; }");
1713 v8::Local<v8::Value> v = ctx1->Global()->Get(v8_str("v")); 1725 v8::Local<v8::Value> v = ctx1->Global()->Get(v8_str("v"));
1714 ctx2->Enter(); 1726 ctx2->Enter();
(...skipping 13 matching lines...) Expand all
1728 HEAP->CollectAllAvailableGarbage(); 1740 HEAP->CollectAllAvailableGarbage();
1729 CHECK_EQ(2, NumberOfGlobalObjects()); 1741 CHECK_EQ(2, NumberOfGlobalObjects());
1730 ctx2.Dispose(ctx2->GetIsolate()); 1742 ctx2.Dispose(ctx2->GetIsolate());
1731 HEAP->CollectAllAvailableGarbage(); 1743 HEAP->CollectAllAvailableGarbage();
1732 CHECK_EQ(0, NumberOfGlobalObjects()); 1744 CHECK_EQ(0, NumberOfGlobalObjects());
1733 } 1745 }
1734 1746
1735 1747
1736 TEST(LeakNativeContextViaMapKeyed) { 1748 TEST(LeakNativeContextViaMapKeyed) {
1737 i::FLAG_allow_natives_syntax = true; 1749 i::FLAG_allow_natives_syntax = true;
1738 v8::HandleScope outer_scope(v8::Isolate::GetCurrent()); 1750 v8::Isolate* isolate = v8::Isolate::GetCurrent();
1739 v8::Persistent<v8::Context> ctx1 = v8::Context::New(); 1751 v8::HandleScope outer_scope(isolate);
1740 v8::Persistent<v8::Context> ctx2 = v8::Context::New(); 1752 v8::Persistent<v8::Context> ctx1;
1753 v8::Persistent<v8::Context> ctx2;
1754 {
1755 v8::HandleScope scope(isolate);
1756 ctx1.Reset(isolate, v8::Context::New(isolate));
1757 ctx2.Reset(isolate, v8::Context::New(isolate));
1758 }
1741 ctx1->Enter(); 1759 ctx1->Enter();
1742 1760
1743 HEAP->CollectAllAvailableGarbage(); 1761 HEAP->CollectAllAvailableGarbage();
1744 CHECK_EQ(4, NumberOfGlobalObjects()); 1762 CHECK_EQ(4, NumberOfGlobalObjects());
1745 1763
1746 { 1764 {
1747 v8::HandleScope inner_scope(v8::Isolate::GetCurrent()); 1765 v8::HandleScope inner_scope(v8::Isolate::GetCurrent());
1748 CompileRun("var v = [42, 43]"); 1766 CompileRun("var v = [42, 43]");
1749 v8::Local<v8::Value> v = ctx1->Global()->Get(v8_str("v")); 1767 v8::Local<v8::Value> v = ctx1->Global()->Get(v8_str("v"));
1750 ctx2->Enter(); 1768 ctx2->Enter();
(...skipping 13 matching lines...) Expand all
1764 HEAP->CollectAllAvailableGarbage(); 1782 HEAP->CollectAllAvailableGarbage();
1765 CHECK_EQ(2, NumberOfGlobalObjects()); 1783 CHECK_EQ(2, NumberOfGlobalObjects());
1766 ctx2.Dispose(ctx2->GetIsolate()); 1784 ctx2.Dispose(ctx2->GetIsolate());
1767 HEAP->CollectAllAvailableGarbage(); 1785 HEAP->CollectAllAvailableGarbage();
1768 CHECK_EQ(0, NumberOfGlobalObjects()); 1786 CHECK_EQ(0, NumberOfGlobalObjects());
1769 } 1787 }
1770 1788
1771 1789
1772 TEST(LeakNativeContextViaMapProto) { 1790 TEST(LeakNativeContextViaMapProto) {
1773 i::FLAG_allow_natives_syntax = true; 1791 i::FLAG_allow_natives_syntax = true;
1774 v8::HandleScope outer_scope(v8::Isolate::GetCurrent()); 1792 v8::Isolate* isolate = v8::Isolate::GetCurrent();
1775 v8::Persistent<v8::Context> ctx1 = v8::Context::New(); 1793 v8::HandleScope outer_scope(isolate);
1776 v8::Persistent<v8::Context> ctx2 = v8::Context::New(); 1794 v8::Persistent<v8::Context> ctx1;
1795 v8::Persistent<v8::Context> ctx2;
1796 {
1797 v8::HandleScope scope(isolate);
1798 ctx1.Reset(isolate, v8::Context::New(isolate));
1799 ctx2.Reset(isolate, v8::Context::New(isolate));
1800 }
1777 ctx1->Enter(); 1801 ctx1->Enter();
1778 1802
1779 HEAP->CollectAllAvailableGarbage(); 1803 HEAP->CollectAllAvailableGarbage();
1780 CHECK_EQ(4, NumberOfGlobalObjects()); 1804 CHECK_EQ(4, NumberOfGlobalObjects());
1781 1805
1782 { 1806 {
1783 v8::HandleScope inner_scope(v8::Isolate::GetCurrent()); 1807 v8::HandleScope inner_scope(v8::Isolate::GetCurrent());
1784 CompileRun("var v = { y: 42}"); 1808 CompileRun("var v = { y: 42}");
1785 v8::Local<v8::Value> v = ctx1->Global()->Get(v8_str("v")); 1809 v8::Local<v8::Value> v = ctx1->Global()->Get(v8_str("v"));
1786 ctx2->Enter(); 1810 ctx2->Enter();
(...skipping 1278 matching lines...) Expand 10 before | Expand all | Expand 10 after
3065 } 3089 }
3066 // An entire block of handles has been filled. 3090 // An entire block of handles has been filled.
3067 // Next handle would require a new block. 3091 // Next handle would require a new block.
3068 ASSERT(data->next == data->limit); 3092 ASSERT(data->next == data->limit);
3069 3093
3070 DeferredHandleScope deferred(isolate); 3094 DeferredHandleScope deferred(isolate);
3071 DummyVisitor visitor; 3095 DummyVisitor visitor;
3072 isolate->handle_scope_implementer()->Iterate(&visitor); 3096 isolate->handle_scope_implementer()->Iterate(&visitor);
3073 deferred.Detach(); 3097 deferred.Detach();
3074 } 3098 }
OLDNEW
« no previous file with comments | « test/cctest/test-hashing.cc ('k') | test/cctest/test-lockers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698