OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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 "test/cctest/heap/heap-utils.h" | 5 #include "test/cctest/heap/heap-utils.h" |
6 | 6 |
7 #include "src/factory.h" | 7 #include "src/factory.h" |
8 #include "src/heap/heap-inl.h" | 8 #include "src/heap/heap-inl.h" |
9 #include "src/heap/incremental-marking.h" | 9 #include "src/heap/incremental-marking.h" |
10 #include "src/heap/mark-compact.h" | 10 #include "src/heap/mark-compact.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 } | 31 } |
32 | 32 |
33 std::vector<Handle<FixedArray>> FillOldSpacePageWithFixedArrays(Heap* heap, | 33 std::vector<Handle<FixedArray>> FillOldSpacePageWithFixedArrays(Heap* heap, |
34 int remainder) { | 34 int remainder) { |
35 std::vector<Handle<FixedArray>> handles; | 35 std::vector<Handle<FixedArray>> handles; |
36 Isolate* isolate = heap->isolate(); | 36 Isolate* isolate = heap->isolate(); |
37 const int kArraySize = 128; | 37 const int kArraySize = 128; |
38 const int kArrayLen = heap::FixedArrayLenFromSize(kArraySize); | 38 const int kArrayLen = heap::FixedArrayLenFromSize(kArraySize); |
39 CHECK_EQ(Page::kAllocatableMemory % kArraySize, 0); | 39 CHECK_EQ(Page::kAllocatableMemory % kArraySize, 0); |
40 Handle<FixedArray> array; | 40 Handle<FixedArray> array; |
41 for (size_t allocated = 0; | 41 for (int allocated = 0; allocated != (Page::kAllocatableMemory - remainder); |
42 allocated != (Page::kAllocatableMemory - remainder); | |
43 allocated += array->Size()) { | 42 allocated += array->Size()) { |
44 if (allocated == (Page::kAllocatableMemory - kArraySize)) { | 43 if (allocated == (Page::kAllocatableMemory - kArraySize)) { |
45 array = isolate->factory()->NewFixedArray( | 44 array = isolate->factory()->NewFixedArray( |
46 heap::FixedArrayLenFromSize(kArraySize - remainder), TENURED); | 45 heap::FixedArrayLenFromSize(kArraySize - remainder), TENURED); |
47 CHECK_EQ(kArraySize - remainder, array->Size()); | 46 CHECK_EQ(kArraySize - remainder, array->Size()); |
48 } else { | 47 } else { |
49 array = isolate->factory()->NewFixedArray(kArrayLen, TENURED); | 48 array = isolate->factory()->NewFixedArray(kArrayLen, TENURED); |
50 CHECK_EQ(kArraySize, array->Size()); | 49 CHECK_EQ(kArraySize, array->Size()); |
51 } | 50 } |
52 if (handles.empty()) { | 51 if (handles.empty()) { |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 int remaining = static_cast<int>(limit - top); | 203 int remaining = static_cast<int>(limit - top); |
205 space->heap()->CreateFillerObjectAt(top, remaining, | 204 space->heap()->CreateFillerObjectAt(top, remaining, |
206 ClearRecordedSlots::kNo); | 205 ClearRecordedSlots::kNo); |
207 space->SetTopAndLimit(nullptr, nullptr); | 206 space->SetTopAndLimit(nullptr, nullptr); |
208 } | 207 } |
209 } | 208 } |
210 | 209 |
211 } // namespace heap | 210 } // namespace heap |
212 } // namespace internal | 211 } // namespace internal |
213 } // namespace v8 | 212 } // namespace v8 |
OLD | NEW |