• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2019 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 V8_HEAP_THIRD_PARTY_HEAP_API_H_
6 #define V8_HEAP_THIRD_PARTY_HEAP_API_H_
7 
8 #include "include/v8.h"
9 #include "src/base/address-region.h"
10 #include "src/heap/heap.h"
11 
12 namespace v8 {
13 namespace internal {
14 namespace third_party_heap {
15 
16 class Heap {
17  public:
18   static std::unique_ptr<Heap> New(v8::internal::Isolate* isolate);
19 
20   static v8::internal::Isolate* GetIsolate(Address address);
21 
22   AllocationResult Allocate(size_t size_in_bytes, AllocationType type,
23                             AllocationAlignment align);
24 
25   Address GetObjectFromInnerPointer(Address inner_pointer);
26 
27   const base::AddressRegion& GetCodeRange();
28 
29   static bool InCodeSpace(Address address);
30 
31   static bool InReadOnlySpace(Address address);
32 
33   static bool InLargeObjectSpace(Address address);
34 
35   static bool IsValidHeapObject(HeapObject object);
36 
37   void ResetIterator();
38   HeapObject NextObject();
39 
40   bool CollectGarbage();
41 };
42 
43 }  // namespace third_party_heap
44 }  // namespace internal
45 }  // namespace v8
46 
47 #endif  // V8_HEAP_THIRD_PARTY_HEAP_API_H_
48