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

Unified Diff: test/cctest/heap/utils-inl.h

Issue 1511933002: [cctest] Add tests for aborting compaction of pages (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Workaround FLAG_concurrent_sweeping not being respected after heap initialization Created 5 years 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/test-compaction.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/heap/utils-inl.h
diff --git a/test/cctest/heap/utils-inl.h b/test/cctest/heap/utils-inl.h
index 8c2508fcb608b6ac1de2bb3d0094439f3544c56a..9c29920272bbd25fd4c41a14f8b60ff01908fdb6 100644
--- a/test/cctest/heap/utils-inl.h
+++ b/test/cctest/heap/utils-inl.h
@@ -16,16 +16,15 @@ namespace v8 {
namespace internal {
static int LenFromSize(int size) {
- return (size - i::FixedArray::kHeaderSize) / i::kPointerSize;
+ return (size - FixedArray::kHeaderSize) / kPointerSize;
}
-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();
+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();
int allocate_memory;
int length;
int free_memory = padding_size;
@@ -41,9 +40,10 @@ static inline void CreatePadding(i::Heap* heap, int padding_size,
*heap->new_space()->allocation_top_address());
CHECK(padding_size <= current_free_memory || current_free_memory == 0);
}
- for (int i = 0; i < max_number_of_objects && free_memory > 0; i++) {
- if (free_memory > i::Page::kMaxRegularHeapObjectSize) {
- allocate_memory = i::Page::kMaxRegularHeapObjectSize;
+ 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;
length = LenFromSize(allocate_memory);
} else {
allocate_memory = free_memory;
@@ -55,11 +55,12 @@ static inline void CreatePadding(i::Heap* heap, int padding_size,
break;
}
}
- 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])));
+ handles.push_back(isolate->factory()->NewFixedArray(length, tenure));
+ CHECK((tenure == NOT_TENURED && heap->InNewSpace(*handles.back())) ||
+ (tenure == TENURED && heap->InOldSpace(*handles.back())));
free_memory -= allocate_memory;
}
+ return handles;
}
« no previous file with comments | « test/cctest/heap/test-compaction.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698