OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <cmath> | 5 #include <cmath> |
6 #include <iostream> | 6 #include <iostream> |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "src/objects.h" | 9 #include "src/objects.h" |
10 #include "src/objects-inl.h" | 10 #include "src/objects-inl.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 CheckEqualRounded(2.830, Heap::HeapGrowingFactor(50, 1)); | 38 CheckEqualRounded(2.830, Heap::HeapGrowingFactor(50, 1)); |
39 CheckEqualRounded(1.478, Heap::HeapGrowingFactor(100, 1)); | 39 CheckEqualRounded(1.478, Heap::HeapGrowingFactor(100, 1)); |
40 CheckEqualRounded(1.193, Heap::HeapGrowingFactor(200, 1)); | 40 CheckEqualRounded(1.193, Heap::HeapGrowingFactor(200, 1)); |
41 CheckEqualRounded(1.121, Heap::HeapGrowingFactor(300, 1)); | 41 CheckEqualRounded(1.121, Heap::HeapGrowingFactor(300, 1)); |
42 CheckEqualRounded(Heap::HeapGrowingFactor(300, 1), | 42 CheckEqualRounded(Heap::HeapGrowingFactor(300, 1), |
43 Heap::HeapGrowingFactor(600, 2)); | 43 Heap::HeapGrowingFactor(600, 2)); |
44 CheckEqualRounded(Heap::kMinHeapGrowingFactor, | 44 CheckEqualRounded(Heap::kMinHeapGrowingFactor, |
45 Heap::HeapGrowingFactor(400, 1)); | 45 Heap::HeapGrowingFactor(400, 1)); |
46 } | 46 } |
47 | 47 |
| 48 TEST(Heap, SemiSpaceSize) { |
| 49 uint64_t configurations[][2] = { |
| 50 {0, 1 * i::Heap::kPointerMultiplier}, |
| 51 {512 * i::MB, 1 * i::Heap::kPointerMultiplier}, |
| 52 {1 * i::GB, 3 * i::Heap::kPointerMultiplier}, |
| 53 {2 * static_cast<uint64_t>(i::GB), i::Heap::kMaxSemiSpaceSize}, |
| 54 {4 * static_cast<uint64_t>(i::GB), i::Heap::kMaxSemiSpaceSize}, |
| 55 {8 * static_cast<uint64_t>(i::GB), i::Heap::kMaxSemiSpaceSize}}; |
| 56 |
| 57 for (auto configuration : configurations) { |
| 58 ASSERT_EQ(configuration[1], |
| 59 static_cast<uint64_t>( |
| 60 i::Heap::ComputeMaxSemiSpaceSize(configuration[0]))); |
| 61 } |
| 62 } |
| 63 |
| 64 TEST(Heap, OldGenerationSize) { |
| 65 uint64_t configurations[][2] = { |
| 66 {0, i::Heap::kMinOldSpaceSize}, |
| 67 {512, i::Heap::kMinOldSpaceSize}, |
| 68 {1 * i::GB, 256 * i::Heap::kPointerMultiplier}, |
| 69 {2 * static_cast<uint64_t>(i::GB), 512 * i::Heap::kPointerMultiplier}, |
| 70 {4 * static_cast<uint64_t>(i::GB), i::Heap::kMaxOldSpaceSize}, |
| 71 {8 * static_cast<uint64_t>(i::GB), i::Heap::kMaxOldSpaceSize}}; |
| 72 |
| 73 for (auto configuration : configurations) { |
| 74 ASSERT_EQ(configuration[1], |
| 75 static_cast<uint64_t>( |
| 76 i::Heap::ComputeMaxOldGenerationSize(configuration[0]))); |
| 77 } |
| 78 } |
| 79 |
48 } // namespace internal | 80 } // namespace internal |
49 } // namespace v8 | 81 } // namespace v8 |
OLD | NEW |