Index: test/cctest/heap/utils-inl.h |
diff --git a/test/cctest/heap/utils-inl.h b/test/cctest/heap/utils-inl.h |
index 9c29920272bbd25fd4c41a14f8b60ff01908fdb6..8c2508fcb608b6ac1de2bb3d0094439f3544c56a 100644 |
--- a/test/cctest/heap/utils-inl.h |
+++ b/test/cctest/heap/utils-inl.h |
@@ -16,15 +16,16 @@ |
namespace internal { |
static int LenFromSize(int size) { |
- return (size - FixedArray::kHeaderSize) / kPointerSize; |
+ return (size - i::FixedArray::kHeaderSize) / i::kPointerSize; |
} |
-static inline std::vector<Handle<FixedArray>> CreatePadding( |
- Heap* heap, int padding_size, PretenureFlag tenure, |
- int object_size = Page::kMaxRegularHeapObjectSize) { |
- std::vector<Handle<FixedArray>> handles; |
- Isolate* isolate = heap->isolate(); |
+static inline void CreatePadding(i::Heap* heap, int padding_size, |
+ i::PretenureFlag tenure) { |
+ const int max_number_of_objects = 20; |
+ v8::internal::Handle<v8::internal::FixedArray> |
+ big_objects[max_number_of_objects]; |
+ i::Isolate* isolate = heap->isolate(); |
int allocate_memory; |
int length; |
int free_memory = padding_size; |
@@ -40,10 +41,9 @@ |
*heap->new_space()->allocation_top_address()); |
CHECK(padding_size <= current_free_memory || current_free_memory == 0); |
} |
- while (free_memory > 0) { |
- // for (int i = 0; i < max_number_of_objects && free_memory > 0; i++) { |
- if (free_memory > object_size) { |
- allocate_memory = object_size; |
+ for (int i = 0; i < max_number_of_objects && free_memory > 0; i++) { |
+ if (free_memory > i::Page::kMaxRegularHeapObjectSize) { |
+ allocate_memory = i::Page::kMaxRegularHeapObjectSize; |
length = LenFromSize(allocate_memory); |
} else { |
allocate_memory = free_memory; |
@@ -55,12 +55,11 @@ |
break; |
} |
} |
- handles.push_back(isolate->factory()->NewFixedArray(length, tenure)); |
- CHECK((tenure == NOT_TENURED && heap->InNewSpace(*handles.back())) || |
- (tenure == TENURED && heap->InOldSpace(*handles.back()))); |
+ big_objects[i] = isolate->factory()->NewFixedArray(length, tenure); |
+ CHECK((tenure == i::NOT_TENURED && heap->InNewSpace(*big_objects[i])) || |
+ (tenure == i::TENURED && heap->InOldSpace(*big_objects[i]))); |
free_memory -= allocate_memory; |
} |
- return handles; |
} |