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

Unified Diff: test/cctest/heap/heap-utils.cc

Issue 2278653003: Reland of "[heap] Switch to 500k pages" (Closed)
Patch Set: Rebase Created 4 years, 4 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
« no previous file with comments | « test/cctest/heap/heap-utils.h ('k') | test/cctest/heap/test-heap.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/heap/heap-utils.cc
diff --git a/test/cctest/heap/heap-utils.cc b/test/cctest/heap/heap-utils.cc
index 7d4d4bf40dc31d4d267ab6df5c3e7f18354a2078..e1ed8ff15e56cae6a97a323f88ce745680b3bd79 100644
--- a/test/cctest/heap/heap-utils.cc
+++ b/test/cctest/heap/heap-utils.cc
@@ -28,6 +28,35 @@ int FixedArrayLenFromSize(int size) {
return (size - FixedArray::kHeaderSize) / kPointerSize;
}
+std::vector<Handle<FixedArray>> FillOldSpacePageWithFixedArrays(Heap* heap,
+ int remainder) {
+ std::vector<Handle<FixedArray>> handles;
+ Isolate* isolate = heap->isolate();
+ const int kArraySize = 128;
+ const int kArrayLen = heap::FixedArrayLenFromSize(kArraySize);
+ CHECK_EQ(Page::kAllocatableMemory % kArraySize, 0);
+ Handle<FixedArray> array;
+ for (size_t allocated = 0;
+ allocated != (Page::kAllocatableMemory - remainder);
+ allocated += array->Size()) {
+ if (allocated == (Page::kAllocatableMemory - kArraySize)) {
+ array = isolate->factory()->NewFixedArray(
+ heap::FixedArrayLenFromSize(kArraySize - remainder), TENURED);
+ CHECK_EQ(kArraySize - remainder, array->Size());
+ } else {
+ array = isolate->factory()->NewFixedArray(kArrayLen, TENURED);
+ CHECK_EQ(kArraySize, array->Size());
+ }
+ if (handles.empty()) {
+ // Check that allocations started on a new page.
+ CHECK_EQ(array->address(),
+ Page::FromAddress(array->address())->area_start());
+ }
+ handles.push_back(array);
+ }
+ return handles;
+}
+
std::vector<Handle<FixedArray>> CreatePadding(Heap* heap, int padding_size,
PretenureFlag tenure,
int object_size) {
« no previous file with comments | « test/cctest/heap/heap-utils.h ('k') | test/cctest/heap/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698