#ifndef V8_COMMON_PTR_COMPR_INL_H_
#define V8_COMMON_PTR_COMPR_INL_H_
#include "include/v8-internal.h"
#include "src/execution/isolate.h"
#include "src/execution/local-isolate-inl.h"
namespace v8 {
namespace internal {
#ifdef V8_COMPRESS_POINTERS
PtrComprCageBase::PtrComprCageBase(const Isolate* isolate)
: … { … }
PtrComprCageBase::PtrComprCageBase(const LocalIsolate* isolate)
: … { … }
constexpr Address kPtrComprCageBaseMask = …;
template <typename Cage>
Address V8HeapCompressionSchemeImpl<Cage>::GetPtrComprCageBaseAddress(
Address on_heap_addr) { … }
template <typename Cage>
Address V8HeapCompressionSchemeImpl<Cage>::GetPtrComprCageBaseAddress(
PtrComprCageBase cage_base) { … }
template <typename Cage>
void V8HeapCompressionSchemeImpl<Cage>::InitBase(Address base) { … }
template <typename Cage>
Address V8HeapCompressionSchemeImpl<Cage>::base() { … }
template <typename Cage>
Tagged_t V8HeapCompressionSchemeImpl<Cage>::CompressObject(Address tagged) { … }
template <typename Cage>
Tagged_t V8HeapCompressionSchemeImpl<Cage>::CompressAny(Address tagged) { … }
template <typename Cage>
Address V8HeapCompressionSchemeImpl<Cage>::DecompressTaggedSigned(
Tagged_t raw_value) { … }
template <typename Cage>
template <typename TOnHeapAddress>
Address V8HeapCompressionSchemeImpl<Cage>::DecompressTagged(
TOnHeapAddress on_heap_addr, Tagged_t raw_value) { … }
template <typename Cage>
template <typename ProcessPointerCallback>
void V8HeapCompressionSchemeImpl<Cage>::ProcessIntermediatePointers(
PtrComprCageBase cage_base, Address raw_value,
ProcessPointerCallback callback) { … }
#ifdef V8_EXTERNAL_CODE_SPACE
Address ExternalCodeCompressionScheme::PrepareCageBaseAddress(
Address on_heap_addr) { … }
Address ExternalCodeCompressionScheme::GetPtrComprCageBaseAddress(
PtrComprCageBase cage_base) { … }
void ExternalCodeCompressionScheme::InitBase(Address base) { … }
V8_CONST Address ExternalCodeCompressionScheme::base() { … }
Tagged_t ExternalCodeCompressionScheme::CompressObject(Address tagged) { … }
Tagged_t ExternalCodeCompressionScheme::CompressAny(Address tagged) { … }
Address ExternalCodeCompressionScheme::DecompressTaggedSigned(
Tagged_t raw_value) { … }
template <typename TOnHeapAddress>
Address ExternalCodeCompressionScheme::DecompressTagged(
TOnHeapAddress on_heap_addr, Tagged_t raw_value) { … }
template <typename ProcessPointerCallback>
void ExternalCodeCompressionScheme::ProcessIntermediatePointers(
PtrComprCageBase cage_base, Address raw_value,
ProcessPointerCallback callback) { … }
#endif
V8_INLINE PtrComprCageBase
GetPtrComprCageBaseFromOnHeapAddress(Address address) { … }
V8_INLINE PtrComprCageBase GetPtrComprCageBase() { … }
#else
template <typename Cage>
Address V8HeapCompressionSchemeImpl<Cage>::GetPtrComprCageBaseAddress(
Address on_heap_addr) {
UNREACHABLE();
}
template <typename Cage>
Tagged_t V8HeapCompressionSchemeImpl<Cage>::CompressObject(Address tagged) {
UNREACHABLE();
}
template <typename Cage>
Tagged_t V8HeapCompressionSchemeImpl<Cage>::CompressAny(Address tagged) {
UNREACHABLE();
}
template <typename Cage>
Address V8HeapCompressionSchemeImpl<Cage>::DecompressTaggedSigned(
Tagged_t raw_value) {
UNREACHABLE();
}
template <typename Cage>
template <typename TOnHeapAddress>
Address V8HeapCompressionSchemeImpl<Cage>::DecompressTagged(
TOnHeapAddress on_heap_addr, Tagged_t raw_value) {
UNREACHABLE();
}
template <typename Cage>
template <typename ProcessPointerCallback>
void V8HeapCompressionSchemeImpl<Cage>::ProcessIntermediatePointers(
PtrComprCageBase cage_base, Address raw_value,
ProcessPointerCallback callback) {
UNREACHABLE();
}
V8_INLINE constexpr PtrComprCageBase GetPtrComprCageBaseFromOnHeapAddress(
Address address) {
return PtrComprCageBase();
}
V8_INLINE PtrComprCageBase GetPtrComprCageBase() { return PtrComprCageBase(); }
#endif
V8_INLINE PtrComprCageBase GetPtrComprCageBase(Tagged<HeapObject> object) { … }
#ifdef V8_COMPRESS_POINTERS_IN_MULTIPLE_CAGES
PtrComprCageAccessScope::PtrComprCageAccessScope(Isolate* isolate)
: cage_base_(V8HeapCompressionScheme::base()),
#ifdef V8_EXTERNAL_CODE_SPACE
code_cage_base_(ExternalCodeCompressionScheme::base()),
#endif
saved_current_isolate_group_(IsolateGroup::current()) {
V8HeapCompressionScheme::InitBase(isolate->cage_base());
#ifdef V8_EXTERNAL_CODE_SPACE
ExternalCodeCompressionScheme::InitBase(isolate->code_cage_base());
#endif
IsolateGroup::set_current(isolate->isolate_group());
}
PtrComprCageAccessScope::~PtrComprCageAccessScope() {
V8HeapCompressionScheme::InitBase(cage_base_);
#ifdef V8_EXTERNAL_CODE_SPACE
ExternalCodeCompressionScheme::InitBase(code_cage_base_);
#endif
IsolateGroup::set_current(saved_current_isolate_group_);
}
#endif
}
}
#endif