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

Side by Side Diff: Source/platform/heap/HeapTest.cpp

Issue 398793002: Oilpan: Remove support for tracing of off-heap ListHashSets. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix number in test. Created 6 years, 5 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 | « Source/core/html/forms/FormController.cpp ('k') | Source/platform/heap/Visitor.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 1999 matching lines...) Expand 10 before | Expand all | Expand 10 after
2010 explicit ShouldBeTraced(IntWrapper* wrapper) : m_wrapper(wrapper) { } 2010 explicit ShouldBeTraced(IntWrapper* wrapper) : m_wrapper(wrapper) { }
2011 void trace(Visitor* visitor) { visitor->trace(m_wrapper); } 2011 void trace(Visitor* visitor) { visitor->trace(m_wrapper); }
2012 Member<IntWrapper> m_wrapper; 2012 Member<IntWrapper> m_wrapper;
2013 }; 2013 };
2014 2014
2015 class OffHeapContainer : public GarbageCollectedFinalized<OffHeapContainer> { 2015 class OffHeapContainer : public GarbageCollectedFinalized<OffHeapContainer> {
2016 public: 2016 public:
2017 static OffHeapContainer* create() { return new OffHeapContainer(); } 2017 static OffHeapContainer* create() { return new OffHeapContainer(); }
2018 2018
2019 static const int iterations = 300; 2019 static const int iterations = 300;
2020 static const int deadWrappers = 2400; 2020 static const int deadWrappers = 2100;
2021 2021
2022 OffHeapContainer() 2022 OffHeapContainer()
2023 { 2023 {
2024 for (int i = 0; i < iterations; i++) { 2024 for (int i = 0; i < iterations; i++) {
2025 m_deque1.append(ShouldBeTraced(IntWrapper::create(i))); 2025 m_deque1.append(ShouldBeTraced(IntWrapper::create(i)));
2026 m_vector1.append(ShouldBeTraced(IntWrapper::create(i))); 2026 m_vector1.append(ShouldBeTraced(IntWrapper::create(i)));
2027 m_deque2.append(IntWrapper::create(i)); 2027 m_deque2.append(IntWrapper::create(i));
2028 m_vector2.append(IntWrapper::create(i)); 2028 m_vector2.append(IntWrapper::create(i));
2029 m_hashSet.add(IntWrapper::create(i)); 2029 m_hashSet.add(IntWrapper::create(i));
2030 m_hashMap.add(i + 103, IntWrapper::create(i)); 2030 m_hashMap.add(i + 103, IntWrapper::create(i));
2031 m_listHashSet.add(IntWrapper::create(i));
2032 m_ownedVector.append(adoptPtr(new ShouldBeTraced(IntWrapper::create( i)))); 2031 m_ownedVector.append(adoptPtr(new ShouldBeTraced(IntWrapper::create( i))));
2033 } 2032 }
2034 2033
2035 Deque<ShouldBeTraced>::iterator d1Iterator(m_deque1.begin()); 2034 Deque<ShouldBeTraced>::iterator d1Iterator(m_deque1.begin());
2036 Vector<ShouldBeTraced>::iterator v1Iterator(m_vector1.begin()); 2035 Vector<ShouldBeTraced>::iterator v1Iterator(m_vector1.begin());
2037 Deque<Member<IntWrapper> >::iterator d2Iterator(m_deque2.begin()); 2036 Deque<Member<IntWrapper> >::iterator d2Iterator(m_deque2.begin());
2038 Vector<Member<IntWrapper> >::iterator v2Iterator(m_vector2.begin()); 2037 Vector<Member<IntWrapper> >::iterator v2Iterator(m_vector2.begin());
2039 HashSet<Member<IntWrapper> >::iterator setIterator(m_hashSet.begin()); 2038 HashSet<Member<IntWrapper> >::iterator setIterator(m_hashSet.begin());
2040 HashMap<int, Member<IntWrapper> >::iterator mapIterator(m_hashMap.begin( )); 2039 HashMap<int, Member<IntWrapper> >::iterator mapIterator(m_hashMap.begin( ));
2041 ListHashSet<Member<IntWrapper> >::iterator listSetIterator(m_listHashSet .begin());
2042 Vector<OwnPtr<ShouldBeTraced> >::iterator ownedVectorIterator(m_ownedVec tor.begin()); 2040 Vector<OwnPtr<ShouldBeTraced> >::iterator ownedVectorIterator(m_ownedVec tor.begin());
2043 2041
2044 for (int i = 0; i < iterations; i++) { 2042 for (int i = 0; i < iterations; i++) {
2045 EXPECT_EQ(i, m_vector1[i].m_wrapper->value()); 2043 EXPECT_EQ(i, m_vector1[i].m_wrapper->value());
2046 EXPECT_EQ(i, m_vector2[i]->value()); 2044 EXPECT_EQ(i, m_vector2[i]->value());
2047 EXPECT_EQ(i, d1Iterator->m_wrapper->value()); 2045 EXPECT_EQ(i, d1Iterator->m_wrapper->value());
2048 EXPECT_EQ(i, v1Iterator->m_wrapper->value()); 2046 EXPECT_EQ(i, v1Iterator->m_wrapper->value());
2049 EXPECT_EQ(i, d2Iterator->get()->value()); 2047 EXPECT_EQ(i, d2Iterator->get()->value());
2050 EXPECT_EQ(i, v2Iterator->get()->value()); 2048 EXPECT_EQ(i, v2Iterator->get()->value());
2051 EXPECT_EQ(i, listSetIterator->get()->value());
2052 EXPECT_EQ(i, ownedVectorIterator->get()->m_wrapper->value()); 2049 EXPECT_EQ(i, ownedVectorIterator->get()->m_wrapper->value());
2053 int value = setIterator->get()->value(); 2050 int value = setIterator->get()->value();
2054 EXPECT_LE(0, value); 2051 EXPECT_LE(0, value);
2055 EXPECT_GT(iterations, value); 2052 EXPECT_GT(iterations, value);
2056 value = mapIterator->value.get()->value(); 2053 value = mapIterator->value.get()->value();
2057 EXPECT_LE(0, value); 2054 EXPECT_LE(0, value);
2058 EXPECT_GT(iterations, value); 2055 EXPECT_GT(iterations, value);
2059 ++d1Iterator; 2056 ++d1Iterator;
2060 ++v1Iterator; 2057 ++v1Iterator;
2061 ++d2Iterator; 2058 ++d2Iterator;
2062 ++v2Iterator; 2059 ++v2Iterator;
2063 ++setIterator; 2060 ++setIterator;
2064 ++mapIterator; 2061 ++mapIterator;
2065 ++listSetIterator;
2066 ++ownedVectorIterator; 2062 ++ownedVectorIterator;
2067 } 2063 }
2068 EXPECT_EQ(d1Iterator, m_deque1.end()); 2064 EXPECT_EQ(d1Iterator, m_deque1.end());
2069 EXPECT_EQ(v1Iterator, m_vector1.end()); 2065 EXPECT_EQ(v1Iterator, m_vector1.end());
2070 EXPECT_EQ(d2Iterator, m_deque2.end()); 2066 EXPECT_EQ(d2Iterator, m_deque2.end());
2071 EXPECT_EQ(v2Iterator, m_vector2.end()); 2067 EXPECT_EQ(v2Iterator, m_vector2.end());
2072 EXPECT_EQ(setIterator, m_hashSet.end()); 2068 EXPECT_EQ(setIterator, m_hashSet.end());
2073 EXPECT_EQ(mapIterator, m_hashMap.end()); 2069 EXPECT_EQ(mapIterator, m_hashMap.end());
2074 EXPECT_EQ(listSetIterator, m_listHashSet.end());
2075 EXPECT_EQ(ownedVectorIterator, m_ownedVector.end()); 2070 EXPECT_EQ(ownedVectorIterator, m_ownedVector.end());
2076 } 2071 }
2077 2072
2078 void trace(Visitor* visitor) 2073 void trace(Visitor* visitor)
2079 { 2074 {
2080 visitor->trace(m_deque1); 2075 visitor->trace(m_deque1);
2081 visitor->trace(m_vector1); 2076 visitor->trace(m_vector1);
2082 visitor->trace(m_deque2); 2077 visitor->trace(m_deque2);
2083 visitor->trace(m_vector2); 2078 visitor->trace(m_vector2);
2084 visitor->trace(m_hashSet); 2079 visitor->trace(m_hashSet);
2085 visitor->trace(m_hashMap); 2080 visitor->trace(m_hashMap);
2086 visitor->trace(m_listHashSet);
2087 visitor->trace(m_listHashSet);
2088 visitor->trace(m_ownedVector); 2081 visitor->trace(m_ownedVector);
2089 } 2082 }
2090 2083
2091 Deque<ShouldBeTraced> m_deque1; 2084 Deque<ShouldBeTraced> m_deque1;
2092 Vector<ShouldBeTraced> m_vector1; 2085 Vector<ShouldBeTraced> m_vector1;
2093 Deque<Member<IntWrapper> > m_deque2; 2086 Deque<Member<IntWrapper> > m_deque2;
2094 Vector<Member<IntWrapper> > m_vector2; 2087 Vector<Member<IntWrapper> > m_vector2;
2095 HashSet<Member<IntWrapper> > m_hashSet; 2088 HashSet<Member<IntWrapper> > m_hashSet;
2096 HashMap<int, Member<IntWrapper> > m_hashMap; 2089 HashMap<int, Member<IntWrapper> > m_hashMap;
2097 ListHashSet<Member<IntWrapper> > m_listHashSet;
2098 Vector<OwnPtr<ShouldBeTraced> > m_ownedVector; 2090 Vector<OwnPtr<ShouldBeTraced> > m_ownedVector;
2099 }; 2091 };
2100 2092
2101 const int OffHeapContainer::iterations; 2093 const int OffHeapContainer::iterations;
2102 const int OffHeapContainer::deadWrappers; 2094 const int OffHeapContainer::deadWrappers;
2103 2095
2104 // These class definitions test compile-time asserts with transition 2096 // These class definitions test compile-time asserts with transition
2105 // types. They are therefore unused in test code and just need to 2097 // types. They are therefore unused in test code and just need to
2106 // compile. This is intentional; do not delete the A and B classes below. 2098 // compile. This is intentional; do not delete the A and B classes below.
2107 class A : public WillBeGarbageCollectedMixin { 2099 class A : public WillBeGarbageCollectedMixin {
(...skipping 2744 matching lines...) Expand 10 before | Expand all | Expand 10 after
4852 }; 4844 };
4853 4845
4854 volatile uintptr_t DeadBitTester::s_workerObjectPointer = 0; 4846 volatile uintptr_t DeadBitTester::s_workerObjectPointer = 0;
4855 4847
4856 TEST(HeapTest, ObjectDeadBit) 4848 TEST(HeapTest, ObjectDeadBit)
4857 { 4849 {
4858 DeadBitTester::test(); 4850 DeadBitTester::test();
4859 } 4851 }
4860 4852
4861 } // WebCore namespace 4853 } // WebCore namespace
OLDNEW
« no previous file with comments | « Source/core/html/forms/FormController.cpp ('k') | Source/platform/heap/Visitor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698