OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "src/globals.h" | 7 #include "src/globals.h" |
8 #include "src/heap/heap.h" | 8 #include "src/heap/heap.h" |
9 #include "src/heap/spaces.h" | 9 #include "src/heap/spaces.h" |
10 #include "src/heap/spaces-inl.h" | 10 #include "src/heap/spaces-inl.h" |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 CHECK_EQ(kLabSize - sum, 0); | 163 CHECK_EQ(kLabSize - sum, 0); |
164 } | 164 } |
165 VerifyIterable(base, limit, expected_sizes); | 165 VerifyIterable(base, limit, expected_sizes); |
166 } | 166 } |
167 | 167 |
168 | 168 |
169 TEST(MergeSuccessful) { | 169 TEST(MergeSuccessful) { |
170 CcTest::InitializeVM(); | 170 CcTest::InitializeVM(); |
171 Heap* heap = CcTest::heap(); | 171 Heap* heap = CcTest::heap(); |
172 const int kLabSize = 2 * KB; | 172 const int kLabSize = 2 * KB; |
173 Address base1 = AllocateLabBackingStore(heap, kLabSize); | 173 Address base1 = AllocateLabBackingStore(heap, 2 * kLabSize); |
174 Address limit1 = base1 + kLabSize; | 174 Address limit1 = base1 + kLabSize; |
175 Address base2 = limit1; | 175 Address base2 = limit1; |
176 Address limit2 = base2 + kLabSize; | 176 Address limit2 = base2 + kLabSize; |
177 | 177 |
178 intptr_t sizes1_raw[4] = {512, 512, 512, 256}; | 178 intptr_t sizes1_raw[4] = {512, 512, 512, 256}; |
179 intptr_t expected_sizes1_raw[5] = {512, 512, 512, 256, 256}; | 179 intptr_t expected_sizes1_raw[5] = {512, 512, 512, 256, 256}; |
180 std::vector<intptr_t> sizes1(sizes1_raw, sizes1_raw + 4); | 180 std::vector<intptr_t> sizes1(sizes1_raw, sizes1_raw + 4); |
181 std::vector<intptr_t> expected_sizes1(expected_sizes1_raw, | 181 std::vector<intptr_t> expected_sizes1(expected_sizes1_raw, |
182 expected_sizes1_raw + 5); | 182 expected_sizes1_raw + 5); |
183 | 183 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 } | 219 } |
220 VerifyIterable(base1, limit1, expected_sizes1); | 220 VerifyIterable(base1, limit1, expected_sizes1); |
221 VerifyIterable(base1, limit2, expected_sizes2); | 221 VerifyIterable(base1, limit2, expected_sizes2); |
222 } | 222 } |
223 | 223 |
224 | 224 |
225 TEST(MergeFailed) { | 225 TEST(MergeFailed) { |
226 CcTest::InitializeVM(); | 226 CcTest::InitializeVM(); |
227 Heap* heap = CcTest::heap(); | 227 Heap* heap = CcTest::heap(); |
228 const int kLabSize = 2 * KB; | 228 const int kLabSize = 2 * KB; |
229 Address base1 = AllocateLabBackingStore(heap, kLabSize); | 229 Address base1 = AllocateLabBackingStore(heap, 3 * kLabSize); |
230 Address base2 = base1 + kLabSize; | 230 Address base2 = base1 + kLabSize; |
231 Address base3 = base2 + kLabSize; | 231 Address base3 = base2 + kLabSize; |
232 | 232 |
233 { | 233 { |
234 AllocationResult lab_backing_store1(HeapObject::FromAddress(base1)); | 234 AllocationResult lab_backing_store1(HeapObject::FromAddress(base1)); |
235 LocalAllocationBuffer lab1 = | 235 LocalAllocationBuffer lab1 = |
236 LocalAllocationBuffer::FromResult(heap, lab_backing_store1, kLabSize); | 236 LocalAllocationBuffer::FromResult(heap, lab_backing_store1, kLabSize); |
237 CHECK(lab1.IsValid()); | 237 CHECK(lab1.IsValid()); |
238 | 238 |
239 AllocationResult lab_backing_store2(HeapObject::FromAddress(base2)); | 239 AllocationResult lab_backing_store2(HeapObject::FromAddress(base2)); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 break; | 276 break; |
277 } | 277 } |
278 } | 278 } |
279 } | 279 } |
280 VerifyIterable(base, limit, expected_sizes); | 280 VerifyIterable(base, limit, expected_sizes); |
281 } | 281 } |
282 #endif // V8_HOST_ARCH_32_BIT | 282 #endif // V8_HOST_ARCH_32_BIT |
283 | 283 |
284 } // namespace internal | 284 } // namespace internal |
285 } // namespace v8 | 285 } // namespace v8 |
OLD | NEW |