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

Unified Diff: test/cctest/cctest.h

Issue 1512553002: [cctest] Move most heap related tests to test/cctest/heap and clean wrt IWYU (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixed compile time error due to missing header file 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 | « no previous file | test/cctest/cctest.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/cctest.h
diff --git a/test/cctest/cctest.h b/test/cctest/cctest.h
index 6806ca6e665f4906f1af6b9cc2c30ca708201939..0def37546f4241c71456874452e0d6dbe9aed474 100644
--- a/test/cctest/cctest.h
+++ b/test/cctest/cctest.h
@@ -557,124 +557,6 @@ static inline void CheckDoubleEquals(double expected, double actual) {
}
-static int LenFromSize(int size) {
- return (size - i::FixedArray::kHeaderSize) / i::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();
- int allocate_memory;
- int length;
- int free_memory = padding_size;
- if (tenure == i::TENURED) {
- int current_free_memory =
- static_cast<int>(*heap->old_space()->allocation_limit_address() -
- *heap->old_space()->allocation_top_address());
- CHECK(padding_size <= current_free_memory || current_free_memory == 0);
- } else {
- heap->new_space()->DisableInlineAllocationSteps();
- int current_free_memory =
- static_cast<int>(*heap->new_space()->allocation_limit_address() -
- *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;
- length = LenFromSize(allocate_memory);
- } else {
- allocate_memory = free_memory;
- length = LenFromSize(allocate_memory);
- if (length <= 0) {
- // Not enough room to create another fixed array. Let's create a filler.
- heap->CreateFillerObjectAt(*heap->old_space()->allocation_top_address(),
- free_memory);
- 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])));
- free_memory -= allocate_memory;
- }
-}
-
-
-// Helper function that simulates a full new-space in the heap.
-static inline bool FillUpOnePage(v8::internal::NewSpace* space) {
- space->DisableInlineAllocationSteps();
- int space_remaining = static_cast<int>(*space->allocation_limit_address() -
- *space->allocation_top_address());
- if (space_remaining == 0) return false;
- CreatePadding(space->heap(), space_remaining, i::NOT_TENURED);
- return true;
-}
-
-
-// Helper function that simulates a fill new-space in the heap.
-static inline void AllocateAllButNBytes(v8::internal::NewSpace* space,
- int extra_bytes) {
- space->DisableInlineAllocationSteps();
- int space_remaining = static_cast<int>(*space->allocation_limit_address() -
- *space->allocation_top_address());
- CHECK(space_remaining >= extra_bytes);
- int new_linear_size = space_remaining - extra_bytes;
- if (new_linear_size == 0) return;
- CreatePadding(space->heap(), new_linear_size, i::NOT_TENURED);
-}
-
-
-static inline void FillCurrentPage(v8::internal::NewSpace* space) {
- AllocateAllButNBytes(space, 0);
-}
-
-
-static inline void SimulateFullSpace(v8::internal::NewSpace* space) {
- FillCurrentPage(space);
- while (FillUpOnePage(space)) {
- }
-}
-
-
-// Helper function that simulates a full old-space in the heap.
-static inline void SimulateFullSpace(v8::internal::PagedSpace* space) {
- space->EmptyAllocationInfo();
- space->ResetFreeList();
- space->ClearStats();
-}
-
-
-// Helper function that simulates many incremental marking steps until
-// marking is completed.
-static inline void SimulateIncrementalMarking(i::Heap* heap,
- bool force_completion = true) {
- i::MarkCompactCollector* collector = heap->mark_compact_collector();
- i::IncrementalMarking* marking = heap->incremental_marking();
- if (collector->sweeping_in_progress()) {
- collector->EnsureSweepingCompleted();
- }
- CHECK(marking->IsMarking() || marking->IsStopped());
- if (marking->IsStopped()) {
- heap->StartIncrementalMarking();
- }
- CHECK(marking->IsMarking());
- if (!force_completion) return;
-
- while (!marking->IsComplete()) {
- marking->Step(i::MB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD);
- if (marking->IsReadyToOverApproximateWeakClosure()) {
- marking->FinalizeIncrementally();
- }
- }
- CHECK(marking->IsComplete());
-}
-
-
static void DummyDebugEventListener(
const v8::Debug::EventDetails& event_details) {}
« no previous file with comments | « no previous file | test/cctest/cctest.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698