summaryrefslogtreecommitdiff
path: root/deps/v8/src/heap/third-party/heap-api.h
blob: c4712b988e91d70ce96b86b80838f466fb83c286 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Copyright 2019 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef V8_HEAP_THIRD_PARTY_HEAP_API_H_
#define V8_HEAP_THIRD_PARTY_HEAP_API_H_

#include "include/v8.h"
#include "src/base/address-region.h"
#include "src/heap/heap.h"

namespace v8 {
namespace internal {
namespace third_party_heap {

class Heap {
 public:
  static std::unique_ptr<Heap> New(v8::internal::Isolate* isolate);

  static v8::internal::Isolate* GetIsolate(Address address);

  AllocationResult Allocate(size_t size_in_bytes, AllocationType type,
                            AllocationAlignment align);

  Address GetObjectFromInnerPointer(Address inner_pointer);

  const base::AddressRegion& GetCodeRange();

  static bool InCodeSpace(Address address);

  static bool InReadOnlySpace(Address address);

  static bool InLargeObjectSpace(Address address);

  static bool IsValidHeapObject(HeapObject object);

  void ResetIterator();
  HeapObject NextObject();

  bool CollectGarbage();
};

}  // namespace third_party_heap
}  // namespace internal
}  // namespace v8

#endif  // V8_HEAP_THIRD_PARTY_HEAP_API_H_