#include "src/common/code-memory-access.h"
#include <optional>
#include "src/common/code-memory-access-inl.h"
#include "src/objects/instruction-stream-inl.h"
#include "src/utils/allocation.h"
namespace v8 {
namespace internal {
ThreadIsolation::TrustedData ThreadIsolation::trusted_data_;
#if V8_HAS_PKU_JIT_WRITE_PROTECT
int RwxMemoryWriteScope::memory_protection_key() { … }
bool RwxMemoryWriteScope::IsPKUWritable() { … }
void RwxMemoryWriteScope::SetDefaultPermissionsForSignalHandler() { … }
#endif
RwxMemoryWriteScopeForTesting::RwxMemoryWriteScopeForTesting()
: … { … }
RwxMemoryWriteScopeForTesting::~RwxMemoryWriteScopeForTesting() { … }
bool ThreadIsolation::Enabled() { … }
template <typename T, typename... Args>
void ThreadIsolation::ConstructNew(T** ptr, Args&&... args) { … }
template <typename T>
void ThreadIsolation::Delete(T* ptr) { … }
void ThreadIsolation::Initialize(
ThreadIsolatedAllocator* thread_isolated_allocator) { … }
ThreadIsolation::JitPageReference ThreadIsolation::LookupJitPageLocked(
Address addr, size_t size) { … }
ThreadIsolation::JitPageReference ThreadIsolation::LookupJitPage(Address addr,
size_t size) { … }
WritableJitPage ThreadIsolation::LookupWritableJitPage(Address addr,
size_t size) { … }
std::optional<ThreadIsolation::JitPageReference>
ThreadIsolation::TryLookupJitPage(Address addr, size_t size) { … }
std::optional<ThreadIsolation::JitPageReference>
ThreadIsolation::TryLookupJitPageLocked(Address addr, size_t size) { … }
namespace {
size_t GetSize(ThreadIsolation::JitPage* jit_page) { … }
size_t GetSize(ThreadIsolation::JitAllocation allocation) { … }
template <class T>
void CheckForRegionOverlap(const T& map, Address addr, size_t size) { … }
template <typename Iterator>
bool AllocationIsBehindRange(Address range_start, Address range_size,
const Iterator& it) { … }
}
ThreadIsolation::JitPageReference::JitPageReference(class JitPage* jit_page,
base::Address address)
: … { … }
ThreadIsolation::JitPage::~JitPage() { … }
size_t ThreadIsolation::JitPageReference::Size() const { … }
void ThreadIsolation::JitPageReference::Shrink(class JitPage* tail) { … }
void ThreadIsolation::JitPageReference::Expand(size_t offset) { … }
void ThreadIsolation::JitPageReference::Merge(JitPageReference& next) { … }
ThreadIsolation::JitAllocation&
ThreadIsolation::JitPageReference::RegisterAllocation(base::Address addr,
size_t size,
JitAllocationType type) { … }
ThreadIsolation::JitAllocation&
ThreadIsolation::JitPageReference::LookupAllocation(base::Address addr,
size_t size,
JitAllocationType type) { … }
void ThreadIsolation::JitPageReference::UnregisterAllocation(
base::Address addr) { … }
void ThreadIsolation::JitPageReference::UnregisterRange(base::Address start,
size_t size) { … }
void ThreadIsolation::JitPageReference::UnregisterAllocationsExcept(
base::Address start, size_t size, const std::vector<base::Address>& keep) { … }
base::Address ThreadIsolation::JitPageReference::StartOfAllocationAt(
base::Address inner_pointer) { … }
std::pair<base::Address, ThreadIsolation::JitAllocation&>
ThreadIsolation::JitPageReference::AllocationContaining(
base::Address inner_pointer) { … }
void ThreadIsolation::RegisterJitPage(Address address, size_t size) { … }
void ThreadIsolation::UnregisterJitPage(Address address, size_t size) { … }
bool ThreadIsolation::MakeExecutable(Address address, size_t size) { … }
WritableJitAllocation ThreadIsolation::RegisterJitAllocation(
Address obj, size_t size, JitAllocationType type) { … }
WritableJitAllocation ThreadIsolation::RegisterInstructionStreamAllocation(
Address addr, size_t size) { … }
WritableJitAllocation ThreadIsolation::LookupJitAllocation(
Address addr, size_t size, JitAllocationType type) { … }
WritableJumpTablePair ThreadIsolation::LookupJumpTableAllocations(
Address jump_table_address, size_t jump_table_size,
Address far_jump_table_address, size_t far_jump_table_size) { … }
void ThreadIsolation::RegisterJitAllocations(Address start,
const std::vector<size_t>& sizes,
JitAllocationType type) { … }
void ThreadIsolation::RegisterJitAllocationForTesting(Address obj,
size_t size) { … }
void ThreadIsolation::UnregisterJitAllocationForTesting(Address addr,
size_t size) { … }
void ThreadIsolation::UnregisterWasmAllocation(Address addr, size_t size) { … }
ThreadIsolation::JitPageReference ThreadIsolation::SplitJitPage(Address addr,
size_t size) { … }
ThreadIsolation::JitPageReference ThreadIsolation::SplitJitPageLocked(
Address addr, size_t size) { … }
std::pair<ThreadIsolation::JitPageReference, ThreadIsolation::JitPageReference>
ThreadIsolation::SplitJitPages(Address addr1, size_t size1, Address addr2,
size_t size2) { … }
std::optional<Address> ThreadIsolation::StartOfJitAllocationAt(
Address inner_pointer) { … }
bool ThreadIsolation::WriteProtectMemory(
Address addr, size_t size, PageAllocator::Permission page_permissions) { … }
namespace {
class MutexUnlocker { … };
}
bool ThreadIsolation::CanLookupStartOfJitAllocationAt(Address inner_pointer) { … }
WritableJitAllocation WritableJitAllocation::ForInstructionStream(
Tagged<InstructionStream> istream) { … }
template <size_t offset>
void WritableFreeSpace::ClearTagged(size_t count) const { … }
template void WritableFreeSpace::ClearTagged<kTaggedSize>(size_t count) const;
template void WritableFreeSpace::ClearTagged<2 * kTaggedSize>(
size_t count) const;
#if DEBUG
void ThreadIsolation::CheckTrackedMemoryEmpty() { … }
#endif
}
}