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

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

Issue 1842263004: Large heap collection type hits assertion in Heap::allocationSizeFromSize (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 6 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
« no previous file with comments | « third_party/WebKit/Source/platform/heap/Heap.h ('k') | no next file » | 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 2407 matching lines...) Expand 10 before | Expand all | Expand 10 after
2418 EXPECT_EQ(10, LargeHeapObject::s_destructorCalls); 2418 EXPECT_EQ(10, LargeHeapObject::s_destructorCalls);
2419 } 2419 }
2420 clearOutOldGarbage(); 2420 clearOutOldGarbage();
2421 EXPECT_TRUE(initialObjectPayloadSize == heap.objectPayloadSizeForTesting()); 2421 EXPECT_TRUE(initialObjectPayloadSize == heap.objectPayloadSizeForTesting());
2422 EXPECT_TRUE(initialAllocatedSpace == heap.heapStats().allocatedSpace()); 2422 EXPECT_TRUE(initialAllocatedSpace == heap.heapStats().allocatedSpace());
2423 EXPECT_EQ(11, IntWrapper::s_destructorCalls); 2423 EXPECT_EQ(11, IntWrapper::s_destructorCalls);
2424 EXPECT_EQ(11, LargeHeapObject::s_destructorCalls); 2424 EXPECT_EQ(11, LargeHeapObject::s_destructorCalls);
2425 preciselyCollectGarbage(); 2425 preciselyCollectGarbage();
2426 } 2426 }
2427 2427
2428 TEST(HeapTest, LargeHashMap)
2429 {
2430 clearOutOldGarbage();
2431
2432 size_t size = (1 << 27) / sizeof(int);
2433 Persistent<HeapHashMap<int, Member<IntWrapper>>> map = new HeapHashMap<int, Member<IntWrapper>>();
2434 map->reserveCapacityForSize(size);
2435 EXPECT_LE(size, map->capacity());
2436 }
2437
2438 TEST(HeapTest, LargeVector)
2439 {
2440 clearOutOldGarbage();
2441
2442 size_t size = (1 << 27) / sizeof(int);
2443 Persistent<HeapVector<int>> vector = new HeapVector<int>(size);
2444 EXPECT_LE(size, vector->capacity());
2445 }
2446
2428 typedef std::pair<Member<IntWrapper>, int> PairWrappedUnwrapped; 2447 typedef std::pair<Member<IntWrapper>, int> PairWrappedUnwrapped;
2429 typedef std::pair<int, Member<IntWrapper>> PairUnwrappedWrapped; 2448 typedef std::pair<int, Member<IntWrapper>> PairUnwrappedWrapped;
2430 typedef std::pair<WeakMember<IntWrapper>, Member<IntWrapper>> PairWeakStrong; 2449 typedef std::pair<WeakMember<IntWrapper>, Member<IntWrapper>> PairWeakStrong;
2431 typedef std::pair<Member<IntWrapper>, WeakMember<IntWrapper>> PairStrongWeak; 2450 typedef std::pair<Member<IntWrapper>, WeakMember<IntWrapper>> PairStrongWeak;
2432 typedef std::pair<WeakMember<IntWrapper>, int> PairWeakUnwrapped; 2451 typedef std::pair<WeakMember<IntWrapper>, int> PairWeakUnwrapped;
2433 typedef std::pair<int, WeakMember<IntWrapper>> PairUnwrappedWeak; 2452 typedef std::pair<int, WeakMember<IntWrapper>> PairUnwrappedWeak;
2434 2453
2435 class Container : public GarbageCollected<Container> { 2454 class Container : public GarbageCollected<Container> {
2436 public: 2455 public:
2437 static Container* create() { return new Container(); } 2456 static Container* create() { return new Container(); }
(...skipping 4486 matching lines...) Expand 10 before | Expand all | Expand 10 after
6924 static_assert(WTF::IsGarbageCollectedType<HeapLinkedHashSet<Member<IntWrappe r>>>::value, "HeapLinkedHashSet"); 6943 static_assert(WTF::IsGarbageCollectedType<HeapLinkedHashSet<Member<IntWrappe r>>>::value, "HeapLinkedHashSet");
6925 static_assert(WTF::IsGarbageCollectedType<HeapListHashSet<Member<IntWrapper> >>::value, "HeapListHashSet"); 6944 static_assert(WTF::IsGarbageCollectedType<HeapListHashSet<Member<IntWrapper> >>::value, "HeapListHashSet");
6926 static_assert(WTF::IsGarbageCollectedType<HeapHashCountedSet<Member<IntWrapp er>>>::value, "HeapHashCountedSet"); 6945 static_assert(WTF::IsGarbageCollectedType<HeapHashCountedSet<Member<IntWrapp er>>>::value, "HeapHashCountedSet");
6927 static_assert(WTF::IsGarbageCollectedType<HeapHashMap<int, Member<IntWrapper >>>::value, "HeapHashMap"); 6946 static_assert(WTF::IsGarbageCollectedType<HeapHashMap<int, Member<IntWrapper >>>::value, "HeapHashMap");
6928 static_assert(WTF::IsGarbageCollectedType<HeapVector<Member<IntWrapper>>>::v alue, "HeapVector"); 6947 static_assert(WTF::IsGarbageCollectedType<HeapVector<Member<IntWrapper>>>::v alue, "HeapVector");
6929 static_assert(WTF::IsGarbageCollectedType<HeapDeque<Member<IntWrapper>>>::va lue, "HeapDeque"); 6948 static_assert(WTF::IsGarbageCollectedType<HeapDeque<Member<IntWrapper>>>::va lue, "HeapDeque");
6930 static_assert(WTF::IsGarbageCollectedType<HeapTerminatedArray<Member<IntWrap per>>>::value, "HeapTerminatedArray"); 6949 static_assert(WTF::IsGarbageCollectedType<HeapTerminatedArray<Member<IntWrap per>>>::value, "HeapTerminatedArray");
6931 } 6950 }
6932 6951
6933 } // namespace blink 6952 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/heap/Heap.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698