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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 1.999, | 54 1.999, |
55 Heap::MaxHeapGrowingFactor( | 55 Heap::MaxHeapGrowingFactor( |
56 (Heap::kMaxOldGenerationSize - Heap::kPointerMultiplier) * MB)); | 56 (Heap::kMaxOldGenerationSize - Heap::kPointerMultiplier) * MB)); |
57 CheckEqualRounded(4.0, | 57 CheckEqualRounded(4.0, |
58 Heap::MaxHeapGrowingFactor( | 58 Heap::MaxHeapGrowingFactor( |
59 static_cast<size_t>(Heap::kMaxOldGenerationSize) * MB)); | 59 static_cast<size_t>(Heap::kMaxOldGenerationSize) * MB)); |
60 } | 60 } |
61 | 61 |
62 TEST(Heap, SemiSpaceSize) { | 62 TEST(Heap, SemiSpaceSize) { |
63 uint64_t configurations[][2] = { | 63 uint64_t configurations[][2] = { |
64 {0, 1 * i::Heap::kPointerMultiplier}, | 64 {0, i::Heap::kPointerMultiplier * (Page::kPageSize / KB)}, |
65 {512 * i::MB, 1 * i::Heap::kPointerMultiplier}, | 65 {512 * i::MB, i::Heap::kPointerMultiplier * (Page::kPageSize / KB)}, |
66 {1 * i::GB, 3 * i::Heap::kPointerMultiplier}, | 66 {1 * i::GB, i::Heap::kPointerMultiplier * (6 * Page::kPageSize / KB)}, |
67 {2 * static_cast<uint64_t>(i::GB), i::Heap::kMaxSemiSpaceSize}, | 67 {2 * static_cast<uint64_t>(i::GB), i::Heap::kMaxSemiSpaceSizeInKB}, |
68 {4 * static_cast<uint64_t>(i::GB), i::Heap::kMaxSemiSpaceSize}, | 68 {4 * static_cast<uint64_t>(i::GB), i::Heap::kMaxSemiSpaceSizeInKB}, |
69 {8 * static_cast<uint64_t>(i::GB), i::Heap::kMaxSemiSpaceSize}}; | 69 {8 * static_cast<uint64_t>(i::GB), i::Heap::kMaxSemiSpaceSizeInKB}}; |
70 | 70 |
71 for (auto configuration : configurations) { | 71 for (auto configuration : configurations) { |
72 ASSERT_EQ(configuration[1], | 72 ASSERT_EQ(configuration[1], |
73 static_cast<uint64_t>( | 73 static_cast<uint64_t>( |
74 i::Heap::ComputeMaxSemiSpaceSize(configuration[0]))); | 74 i::Heap::ComputeMaxSemiSpaceSize(configuration[0]))); |
75 } | 75 } |
76 } | 76 } |
77 | 77 |
78 TEST(Heap, OldGenerationSize) { | 78 TEST(Heap, OldGenerationSize) { |
79 uint64_t configurations[][2] = { | 79 uint64_t configurations[][2] = { |
80 {0, i::Heap::kMinOldGenerationSize}, | 80 {0, i::Heap::kMinOldGenerationSize}, |
81 {512, i::Heap::kMinOldGenerationSize}, | 81 {512, i::Heap::kMinOldGenerationSize}, |
82 {1 * i::GB, 256 * i::Heap::kPointerMultiplier}, | 82 {1 * i::GB, 256 * i::Heap::kPointerMultiplier}, |
83 {2 * static_cast<uint64_t>(i::GB), 512 * i::Heap::kPointerMultiplier}, | 83 {2 * static_cast<uint64_t>(i::GB), 512 * i::Heap::kPointerMultiplier}, |
84 {4 * static_cast<uint64_t>(i::GB), i::Heap::kMaxOldGenerationSize}, | 84 {4 * static_cast<uint64_t>(i::GB), i::Heap::kMaxOldGenerationSize}, |
85 {8 * static_cast<uint64_t>(i::GB), i::Heap::kMaxOldGenerationSize}}; | 85 {8 * static_cast<uint64_t>(i::GB), i::Heap::kMaxOldGenerationSize}}; |
86 | 86 |
87 for (auto configuration : configurations) { | 87 for (auto configuration : configurations) { |
88 ASSERT_EQ(configuration[1], | 88 ASSERT_EQ(configuration[1], |
89 static_cast<uint64_t>( | 89 static_cast<uint64_t>( |
90 i::Heap::ComputeMaxOldGenerationSize(configuration[0]))); | 90 i::Heap::ComputeMaxOldGenerationSize(configuration[0]))); |
91 } | 91 } |
92 } | 92 } |
93 | 93 |
94 } // namespace internal | 94 } // namespace internal |
95 } // namespace v8 | 95 } // namespace v8 |
OLD | NEW |