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

Unified Diff: test/unittests/heap/heap-unittest.cc

Issue 2919023003: [heap] Scale max heap growing factor. (Closed)
Patch Set: rename Created 3 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 side-by-side diff with in-line comments
Download patch
« src/heap/heap.cc ('K') | « src/heap/heap.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/unittests/heap/heap-unittest.cc
diff --git a/test/unittests/heap/heap-unittest.cc b/test/unittests/heap/heap-unittest.cc
index d378782fbb723b99a96f9f3ff6df36e48f30209d..221d46a02496deed274ad80e2915b33c95d5be65 100644
--- a/test/unittests/heap/heap-unittest.cc
+++ b/test/unittests/heap/heap-unittest.cc
@@ -33,16 +33,28 @@ void CheckEqualRounded(double expected, double actual) {
TEST(Heap, HeapGrowingFactor) {
CheckEqualRounded(Heap::kMaxHeapGrowingFactor,
- Heap::HeapGrowingFactor(34, 1));
- CheckEqualRounded(3.553, Heap::HeapGrowingFactor(45, 1));
- CheckEqualRounded(2.830, Heap::HeapGrowingFactor(50, 1));
- CheckEqualRounded(1.478, Heap::HeapGrowingFactor(100, 1));
- CheckEqualRounded(1.193, Heap::HeapGrowingFactor(200, 1));
- CheckEqualRounded(1.121, Heap::HeapGrowingFactor(300, 1));
- CheckEqualRounded(Heap::HeapGrowingFactor(300, 1),
- Heap::HeapGrowingFactor(600, 2));
+ Heap::HeapGrowingFactor(34, 1, 4.0));
+ CheckEqualRounded(3.553, Heap::HeapGrowingFactor(45, 1, 4.0));
+ CheckEqualRounded(2.830, Heap::HeapGrowingFactor(50, 1, 4.0));
+ CheckEqualRounded(1.478, Heap::HeapGrowingFactor(100, 1, 4.0));
+ CheckEqualRounded(1.193, Heap::HeapGrowingFactor(200, 1, 4.0));
+ CheckEqualRounded(1.121, Heap::HeapGrowingFactor(300, 1, 4.0));
+ CheckEqualRounded(Heap::HeapGrowingFactor(300, 1, 4.0),
+ Heap::HeapGrowingFactor(600, 2, 4.0));
CheckEqualRounded(Heap::kMinHeapGrowingFactor,
- Heap::HeapGrowingFactor(400, 1));
+ Heap::HeapGrowingFactor(400, 1, 4.0));
+}
+
+TEST(Heap, MaxHeapGrowingFactor) {
+ CheckEqualRounded(
+ 1.3, Heap::MaxHeapGrowingFactor(Heap::kMinOldGenerationSize * MB));
+ CheckEqualRounded(1.6, Heap::MaxHeapGrowingFactor(
+ ((Heap::kMaxOldGenerationSize - 1) / 2) * MB));
+ CheckEqualRounded(
+ 2.0, Heap::MaxHeapGrowingFactor((Heap::kMaxOldGenerationSize - 1) * MB));
+ CheckEqualRounded(4.0,
+ Heap::MaxHeapGrowingFactor(
+ static_cast<size_t>(Heap::kMaxOldGenerationSize) * MB));
}
TEST(Heap, SemiSpaceSize) {
@@ -63,12 +75,12 @@ TEST(Heap, SemiSpaceSize) {
TEST(Heap, OldGenerationSize) {
uint64_t configurations[][2] = {
- {0, i::Heap::kMinOldSpaceSize},
- {512, i::Heap::kMinOldSpaceSize},
+ {0, i::Heap::kMinOldGenerationSize},
+ {512, i::Heap::kMinOldGenerationSize},
{1 * i::GB, 256 * i::Heap::kPointerMultiplier},
{2 * static_cast<uint64_t>(i::GB), 512 * i::Heap::kPointerMultiplier},
- {4 * static_cast<uint64_t>(i::GB), i::Heap::kMaxOldSpaceSize},
- {8 * static_cast<uint64_t>(i::GB), i::Heap::kMaxOldSpaceSize}};
+ {4 * static_cast<uint64_t>(i::GB), i::Heap::kMaxOldGenerationSize},
+ {8 * static_cast<uint64_t>(i::GB), i::Heap::kMaxOldGenerationSize}};
for (auto configuration : configurations) {
ASSERT_EQ(configuration[1],
« src/heap/heap.cc ('K') | « src/heap/heap.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698