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

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

Issue 1514603008: Revert of [cctest] Add tests for aborting compaction of pages (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 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;
}
« 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