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

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

Issue 1864923002: Revert of Large heap collection type hits assertion in Heap::allocationSizeFromSize (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 2353 matching lines...) Expand 10 before | Expand all | Expand 10 after
2364 EXPECT_EQ(10, LargeHeapObject::s_destructorCalls); 2364 EXPECT_EQ(10, LargeHeapObject::s_destructorCalls);
2365 } 2365 }
2366 clearOutOldGarbage(); 2366 clearOutOldGarbage();
2367 EXPECT_TRUE(initialObjectPayloadSize == Heap::objectPayloadSizeForTesting()) ; 2367 EXPECT_TRUE(initialObjectPayloadSize == Heap::objectPayloadSizeForTesting()) ;
2368 EXPECT_TRUE(initialAllocatedSpace == Heap::allocatedSpace()); 2368 EXPECT_TRUE(initialAllocatedSpace == Heap::allocatedSpace());
2369 EXPECT_EQ(11, IntWrapper::s_destructorCalls); 2369 EXPECT_EQ(11, IntWrapper::s_destructorCalls);
2370 EXPECT_EQ(11, LargeHeapObject::s_destructorCalls); 2370 EXPECT_EQ(11, LargeHeapObject::s_destructorCalls);
2371 preciselyCollectGarbage(); 2371 preciselyCollectGarbage();
2372 } 2372 }
2373 2373
2374 TEST(HeapTest, LargeHashMap)
2375 {
2376 clearOutOldGarbage();
2377
2378 size_t size = (1 << 27) / sizeof(int);
2379 Persistent<HeapHashMap<int, int>> map = new HeapHashMap<int, int>();
2380 map->reserveCapacityForSize(size);
2381 EXPECT_LE(size, map->capacity());
2382 }
2383
2384 TEST(HeapTest, LargeVector)
2385 {
2386 clearOutOldGarbage();
2387
2388 size_t size = (1 << 27) / sizeof(int);
2389 Persistent<HeapVector<int>> vector = new HeapVector<int>(size);
2390 EXPECT_LE(size, vector->capacity());
2391 }
2392
2393 typedef std::pair<Member<IntWrapper>, int> PairWrappedUnwrapped; 2374 typedef std::pair<Member<IntWrapper>, int> PairWrappedUnwrapped;
2394 typedef std::pair<int, Member<IntWrapper>> PairUnwrappedWrapped; 2375 typedef std::pair<int, Member<IntWrapper>> PairUnwrappedWrapped;
2395 typedef std::pair<WeakMember<IntWrapper>, Member<IntWrapper>> PairWeakStrong; 2376 typedef std::pair<WeakMember<IntWrapper>, Member<IntWrapper>> PairWeakStrong;
2396 typedef std::pair<Member<IntWrapper>, WeakMember<IntWrapper>> PairStrongWeak; 2377 typedef std::pair<Member<IntWrapper>, WeakMember<IntWrapper>> PairStrongWeak;
2397 typedef std::pair<WeakMember<IntWrapper>, int> PairWeakUnwrapped; 2378 typedef std::pair<WeakMember<IntWrapper>, int> PairWeakUnwrapped;
2398 typedef std::pair<int, WeakMember<IntWrapper>> PairUnwrappedWeak; 2379 typedef std::pair<int, WeakMember<IntWrapper>> PairUnwrappedWeak;
2399 2380
2400 class Container : public GarbageCollected<Container> { 2381 class Container : public GarbageCollected<Container> {
2401 public: 2382 public:
2402 static Container* create() { return new Container(); } 2383 static Container* create() { return new Container(); }
(...skipping 4099 matching lines...) Expand 10 before | Expand all | Expand 10 after
6502 EXPECT_EQ(1u, vector2.size()); 6483 EXPECT_EQ(1u, vector2.size());
6503 // TODO(Oilpan): when Vector.h's contiguous container support no longer disables 6484 // TODO(Oilpan): when Vector.h's contiguous container support no longer disables
6504 // Vector<>s with inline capacity, remove. 6485 // Vector<>s with inline capacity, remove.
6505 #if !defined(ANNOTATE_CONTIGUOUS_CONTAINER) 6486 #if !defined(ANNOTATE_CONTIGUOUS_CONTAINER)
6506 EXPECT_EQ(16u, vector1.capacity()); 6487 EXPECT_EQ(16u, vector1.capacity());
6507 EXPECT_EQ(16u, vector2.capacity()); 6488 EXPECT_EQ(16u, vector2.capacity());
6508 #endif 6489 #endif
6509 } 6490 }
6510 6491
6511 } // namespace blink 6492 } // 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