blob: e03e6fa6e0461df12f6ec8a204a9975b782d09c8 [file] [log] [blame]
Ben Murdoch61f157c2016-09-16 13:49:30 +01001// Copyright 2016 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef HEAP_HEAP_UTILS_H_
6#define HEAP_HEAP_UTILS_H_
7
8#include "src/heap/heap.h"
9
10namespace v8 {
11namespace internal {
12namespace heap {
13
14void SealCurrentObjects(Heap* heap);
15
16int FixedArrayLenFromSize(int size);
17
18std::vector<Handle<FixedArray>> CreatePadding(
19 Heap* heap, int padding_size, PretenureFlag tenure,
20 int object_size = Page::kMaxRegularHeapObjectSize);
21
22void AllocateAllButNBytes(
23 v8::internal::NewSpace* space, int extra_bytes,
24 std::vector<Handle<FixedArray>>* out_handles = nullptr);
25
26void FillCurrentPage(v8::internal::NewSpace* space,
27 std::vector<Handle<FixedArray>>* out_handles = nullptr);
28
29// Helper function that simulates a full new-space in the heap.
30bool FillUpOnePage(v8::internal::NewSpace* space,
31 std::vector<Handle<FixedArray>>* out_handles = nullptr);
32
33void SimulateFullSpace(v8::internal::NewSpace* space,
34 std::vector<Handle<FixedArray>>* out_handles = nullptr);
35
36// Helper function that simulates many incremental marking steps until
37// marking is completed.
38void SimulateIncrementalMarking(i::Heap* heap, bool force_completion = true);
39
40// Helper function that simulates a full old-space in the heap.
41void SimulateFullSpace(v8::internal::PagedSpace* space);
42
43void AbandonCurrentlyFreeMemory(PagedSpace* space);
44
45void GcAndSweep(Heap* heap, AllocationSpace space);
46
47} // namespace heap
48} // namespace internal
49} // namespace v8
50
51#endif // HEAP_HEAP_UTILS_H_