5#ifndef V8_SANDBOX_CODE_POINTER_TABLE_H_
6#define V8_SANDBOX_CODE_POINTER_TABLE_H_
15#ifdef V8_COMPRESS_POINTERS
29struct CodePointerTableEntry {
32 static constexpr bool IsWriteProtected =
true;
36 inline void MakeCodePointerEntry(Address code, Address entrypoint,
37 CodeEntrypointTag tag,
bool mark_as_alive);
41 inline void MakeFreelistEntry(uint32_t next_entry_index);
45 inline Address GetEntrypoint(CodeEntrypointTag tag)
const;
49 inline void SetEntrypoint(Address value, CodeEntrypointTag tag);
53 inline Address GetCodeObject()
const;
57 inline void SetCodeObject(Address value);
60 inline bool IsFreelistEntry()
const;
66 inline uint32_t GetNextFreelistEntryIndex()
const;
75 inline bool IsMarked()
const;
78 friend class CodePointerTable;
85 static constexpr Address kMarkingBit = 1;
87 std::atomic<Address> entrypoint_;
96 std::atomic<Address>
code_;
119 :
public ExternalEntityTable<CodePointerTableEntry,
120 kCodePointerTableReservationSize> {
121 using Base = ExternalEntityTable<CodePointerTableEntry,
126 static_assert(!kSupportsCompaction);
128 CodePointerTable() =
default;
129 CodePointerTable(
const CodePointerTable&) =
delete;
130 CodePointerTable& operator=(
const CodePointerTable&) =
delete;
133 using Space = Base::SpaceWithBlackAllocationSupport;
138 inline Address GetEntrypoint(CodePointerHandle handle,
139 CodeEntrypointTag tag)
const;
144 inline Address GetCodeObject(CodePointerHandle handle)
const;
149 inline void SetEntrypoint(CodePointerHandle handle, Address value,
150 CodeEntrypointTag tag);
155 inline void SetCodeObject(CodePointerHandle handle, Address value);
163 CodeEntrypointTag tag);
168 inline void Mark(Space* space, CodePointerHandle handle);
176 uint32_t Sweep(Space* space, Counters* counters);
183 template <
typename Callback>
184 void IterateActiveEntriesIn(Space* space, Callback
callback);
190 inline uint32_t HandleToIndex(CodePointerHandle handle)
const;
ZoneList< RegExpInstruction > code_
@ kFreeCodePointerTableEntryTag
IndirectPointerHandle CodePointerHandle
constexpr size_t kCodePointerTableReservationSize
constexpr size_t kMaxCodePointers
constexpr int kCodePointerTableEntrySize
#define V8_EXPORT_PRIVATE