5#ifndef V8_V8_PLATFORM_H_
6#define V8_V8_PLATFORM_H_
49 virtual void Run() = 0;
61 virtual void Run(
double deadline_in_seconds) = 0;
76 virtual void PostTask(std::unique_ptr<Task> task) = 0;
101 double delay_in_seconds) = 0;
120 double delay_in_seconds) {}
295#if !defined(V8_USE_PERFETTO)
304 static uint8_t no = 0;
317 char phase,
const uint8_t* category_enabled_flag,
const char* name,
318 const char* scope, uint64_t
id, uint64_t bind_id,
int32_t num_args,
319 const char** arg_names,
const uint8_t* arg_types,
320 const uint64_t* arg_values,
321 std::unique_ptr<ConvertableToTraceFormat>* arg_convertables,
322 unsigned int flags) {
326 char phase,
const uint8_t* category_enabled_flag,
const char* name,
327 const char* scope, uint64_t
id, uint64_t bind_id,
int32_t num_args,
328 const char** arg_names,
const uint8_t* arg_types,
329 const uint64_t* arg_values,
330 std::unique_ptr<ConvertableToTraceFormat>* arg_convertables,
331 unsigned int flags, int64_t timestamp) {
340 const char* name, uint64_t handle) {}
418 virtual bool FreePages(
void* address,
size_t length) = 0;
424 size_t new_length) = 0;
471 virtual std::unique_ptr<SharedMemoryMapping>
RemapTo(
472 void* new_address)
const = 0;
500 size_t length,
const void* original_address) {
532inline unsigned int MachMemoryEntryFromSharedMemoryHandle(
534 return static_cast<unsigned int>(handle);
542 return static_cast<uint32_t
>(handle);
551inline void* FileMappingFromSharedMemoryHandle(
553 return reinterpret_cast<void*
>(handle);
562 return static_cast<int>(handle);
633 size_t size()
const {
return size_; }
851 const size_t page_size_;
852 const size_t allocation_granularity_;
903 return &default_allocator;
975 double delay_in_seconds) = 0;
1035 TaskPriority priority, std::unique_ptr<JobTask> job_task) = 0;
1078 return &default_observer;
virtual void LeaveSection()
virtual void EnterSection()
virtual ~IdleTask()=default
virtual void Run(double deadline_in_seconds)=0
virtual bool IsJoiningThread() const =0
virtual uint8_t GetTaskId()=0
virtual bool ShouldYield()=0
virtual void NotifyConcurrencyIncrease()=0
virtual void UpdatePriority(TaskPriority new_priority)
virtual bool UpdatePriorityEnabled() const
virtual void CancelAndDetach()=0
virtual bool IsActive()=0
virtual void NotifyConcurrencyIncrease()=0
virtual ~JobHandle()=default
virtual size_t GetMaxConcurrency(size_t worker_count) const =0
virtual void Run(JobDelegate *delegate)=0
virtual ~JobTask()=default
virtual std::unique_ptr< SharedMemoryMapping > RemapTo(void *new_address) const =0
virtual size_t GetSize() const =0
virtual void * GetMemory() const =0
virtual ~SharedMemory()=default
virtual ~SharedMemoryMapping()=default
virtual void * GetMemory() const =0
virtual std::unique_ptr< SharedMemory > AllocateSharedPages(size_t length, const void *original_address)
virtual bool SetPermissions(void *address, size_t length, Permission permissions)=0
virtual bool CanAllocateSharedPages()
virtual bool DecommitPages(void *address, size_t size)=0
virtual void * AllocatePages(void *address, size_t length, size_t alignment, Permission permissions)=0
virtual void * GetRandomMmapAddr()=0
virtual size_t CommitPageSize()=0
virtual bool DiscardSystemPages(void *address, size_t size)
virtual bool ReserveForSharedMemoryMapping(void *address, size_t size)
virtual bool ReleasePages(void *address, size_t length, size_t new_length)=0
virtual void SetRandomMmapSeed(int64_t seed)=0
virtual ~PageAllocator()=default
virtual size_t AllocatePageSize()=0
virtual bool FreePages(void *address, size_t length)=0
virtual bool NonNestableTasksEnabled() const
virtual void PostNonNestableDelayedTask(std::unique_ptr< Task > task, double delay_in_seconds)
virtual void PostDelayedTask(std::unique_ptr< Task > task, double delay_in_seconds)=0
TaskRunner(const TaskRunner &)=delete
virtual bool NonNestableDelayedTasksEnabled() const
virtual void PostIdleTask(std::unique_ptr< IdleTask > task)=0
virtual bool IdleTasksEnabled()=0
virtual void PostTask(std::unique_ptr< Task > task)=0
virtual ~TaskRunner()=default
TaskRunner & operator=(const TaskRunner &)=delete
virtual void PostNonNestableTask(std::unique_ptr< Task > task)
virtual void OnTraceDisabled()=0
virtual ~TraceStateObserver()=default
virtual void OnTraceEnabled()=0
virtual const uint8_t * GetCategoryGroupEnabled(const char *name)
virtual void AddTraceStateObserver(TraceStateObserver *)
virtual ~TracingController()=default
virtual uint64_t AddTraceEventWithTimestamp(char phase, const uint8_t *category_enabled_flag, const char *name, const char *scope, uint64_t id, uint64_t bind_id, int32_t num_args, const char **arg_names, const uint8_t *arg_types, const uint64_t *arg_values, std::unique_ptr< ConvertableToTraceFormat > *arg_convertables, unsigned int flags, int64_t timestamp)
virtual void UpdateTraceEventDuration(const uint8_t *category_enabled_flag, const char *name, uint64_t handle)
virtual uint64_t AddTraceEvent(char phase, const uint8_t *category_enabled_flag, const char *name, const char *scope, uint64_t id, uint64_t bind_id, int32_t num_args, const char **arg_names, const uint8_t *arg_types, const uint64_t *arg_values, std::unique_ptr< ConvertableToTraceFormat > *arg_convertables, unsigned int flags)
virtual void RemoveTraceStateObserver(TraceStateObserver *)
virtual V8_WARN_UNUSED_RESULT bool DiscardSystemPages(Address address, size_t size)
static constexpr Address kNoHint
VirtualAddressSpace(size_t page_size, size_t allocation_granularity, Address base, size_t size, PagePermissions max_page_permissions)
virtual void SetRandomSeed(int64_t seed)=0
virtual V8_WARN_UNUSED_RESULT bool SetPagePermissions(Address address, size_t size, PagePermissions permissions)=0
size_t allocation_granularity() const
virtual V8_WARN_UNUSED_RESULT Address AllocateSharedPages(Address hint, size_t size, PagePermissions permissions, PlatformSharedMemoryHandle handle, uint64_t offset)=0
virtual void FreeGuardRegion(Address address, size_t size)=0
virtual V8_WARN_UNUSED_RESULT bool DecommitPages(Address address, size_t size)=0
virtual ~VirtualAddressSpace()=default
virtual std::unique_ptr< VirtualAddressSpace > AllocateSubspace(Address hint, size_t size, size_t alignment, PagePermissions max_page_permissions)=0
virtual void FreeSharedPages(Address address, size_t size)=0
virtual V8_WARN_UNUSED_RESULT Address AllocatePages(Address hint, size_t size, size_t alignment, PagePermissions permissions)=0
virtual void FreePages(Address address, size_t size)=0
virtual bool CanAllocateSubspaces()=0
virtual Address RandomPageAddress()=0
PagePermissions max_page_permissions() const
virtual V8_WARN_UNUSED_RESULT bool AllocateGuardRegion(Address address, size_t size)=0
virtual MallocFn GetMallocFn() const
virtual FreeFn GetFreeFn() const
void *(*)(size_t) MallocFn
intptr_t PlatformSharedMemoryHandle
PlatformSharedMemoryHandle SharedMemoryHandleFromFileDescriptor(int fd)
int FileDescriptorFromSharedMemoryHandle(PlatformSharedMemoryHandle handle)
int32_t(Local< Array > src, int32_t *dst, uint32_t max_length)
#define V8_WARN_UNUSED_RESULT