5#ifndef V8_V8_PLATFORM_H_
6#define V8_V8_PLATFORM_H_
53 virtual void Run() = 0;
65 virtual void Run(
double deadline_in_seconds) = 0;
105 std::unique_ptr<Task> task,
118 std::unique_ptr<Task> task,
double delay_in_seconds,
142 std::unique_ptr<Task> task,
double delay_in_seconds,
158 std::unique_ptr<IdleTask> task,
193 double delay_in_seconds,
196 double delay_in_seconds,
382#if !defined(V8_USE_PERFETTO)
391 static uint8_t no = 0;
404 char phase,
const uint8_t* category_enabled_flag,
const char* name,
405 const char* scope, uint64_t
id, uint64_t bind_id, int32_t num_args,
406 const char** arg_names,
const uint8_t* arg_types,
407 const uint64_t* arg_values,
408 std::unique_ptr<ConvertableToTraceFormat>* arg_convertables,
409 unsigned int flags) {
413 char phase,
const uint8_t* category_enabled_flag,
const char* name,
414 const char* scope, uint64_t
id, uint64_t bind_id, int32_t num_args,
415 const char** arg_names,
const uint8_t* arg_types,
416 const uint64_t* arg_values,
417 std::unique_ptr<ConvertableToTraceFormat>* arg_convertables,
418 unsigned int flags, int64_t timestamp) {
427 const char* name, uint64_t handle) {}
511 virtual bool FreePages(
void* address,
size_t length) = 0;
517 size_t new_length) = 0;
588 virtual std::unique_ptr<SharedMemoryMapping>
RemapTo(
589 void* new_address)
const = 0;
617 size_t length,
const void* original_address) {
646 virtual void Free(
void*
object) = 0;
657 virtual int Pkey()
const {
return -1; }
685inline unsigned int MachMemoryEntryFromSharedMemoryHandle(
687 return static_cast<unsigned int>(handle);
695 return static_cast<uint32_t
>(handle);
704inline void* FileMappingFromSharedMemoryHandle(
706 return reinterpret_cast<void*
>(handle);
715 return static_cast<int>(handle);
786 size_t size()
const {
return size_; }
802 return (address >=
base()) && (address <
base() +
size());
1035 const size_t page_size_;
1036 const size_t allocation_granularity_;
1121 std::unique_ptr<
Task> task,
1135 std::unique_ptr<
Task> task,
1150 std::unique_ptr<
Task> task,
1166 std::unique_ptr<
Task> task,
double delay_in_seconds,
1169 std::move(task), delay_in_seconds,
1192 double delay_in_seconds,
1195 delay_in_seconds, location);
1249 TaskPriority priority, std::unique_ptr<JobTask> job_task,
1251 auto handle =
CreateJob(priority, std::move(job_task), location);
1252 handle->NotifyConcurrencyIncrease();
1272 TaskPriority priority, std::unique_ptr<JobTask> job_task,
1274 return CreateJobImpl(priority, std::move(job_task), location);
1343 return &default_observer;
1358 TaskPriority priority, std::unique_ptr<JobTask> job_task,
1365 std::unique_ptr<Task> task,
Definition: v8-platform.h:1046
virtual void EnterSection()
Definition: v8-platform.h:1048
virtual void LeaveSection()
Definition: v8-platform.h:1049
Definition: v8-platform.h:62
virtual void Run(double deadline_in_seconds)=0
virtual ~IdleTask()=default
Definition: v8-isolate.h:261
Definition: v8-platform.h:206
virtual void NotifyConcurrencyIncrease()=0
virtual bool ShouldYield()=0
virtual bool IsJoiningThread() const =0
virtual uint8_t GetTaskId()=0
Definition: v8-platform.h:241
virtual void NotifyConcurrencyIncrease()=0
virtual void CancelAndDetach()=0
virtual bool IsActive()=0
virtual bool UpdatePriorityEnabled() const
Definition: v8-platform.h:289
virtual void UpdatePriority(TaskPriority new_priority)
Definition: v8-platform.h:294
virtual ~JobHandle()=default
Definition: v8-platform.h:300
virtual void Run(JobDelegate *delegate)=0
virtual size_t GetMaxConcurrency(size_t worker_count) const =0
virtual ~JobTask()=default
Definition: v8-platform.h:572
virtual ~SharedMemoryMapping()=default
virtual void * GetMemory() const =0
Definition: v8-platform.h:584
virtual std::unique_ptr< SharedMemoryMapping > RemapTo(void *new_address) const =0
virtual void * GetMemory() const =0
virtual size_t GetSize() const =0
virtual ~SharedMemory()=default
Definition: v8-platform.h:455
virtual void * GetRandomMmapAddr()=0
virtual ~PageAllocator()=default
virtual bool ReleasePages(void *address, size_t length, size_t new_length)=0
Permission
Definition: v8-platform.h:486
@ kReadExecute
Definition: v8-platform.h:491
@ kRead
Definition: v8-platform.h:488
@ kNoAccess
Definition: v8-platform.h:487
@ kNoAccessWillJitLater
Definition: v8-platform.h:499
@ kReadWrite
Definition: v8-platform.h:489
@ kReadWriteExecute
Definition: v8-platform.h:490
virtual bool DecommitPages(void *address, size_t size)=0
virtual size_t AllocatePageSize()=0
virtual void SetRandomMmapSeed(int64_t seed)=0
virtual void * AllocatePages(void *address, size_t length, size_t alignment, Permission permissions)=0
virtual bool CanAllocateSharedPages()
Definition: v8-platform.h:629
virtual bool RecommitPages(void *address, size_t length, Permission permissions)
Definition: v8-platform.h:530
virtual bool SetPermissions(void *address, size_t length, Permission permissions)=0
virtual bool SealPages(void *address, size_t length)
Definition: v8-platform.h:563
virtual bool FreePages(void *address, size_t length)=0
virtual std::unique_ptr< SharedMemory > AllocateSharedPages(size_t length, const void *original_address)
Definition: v8-platform.h:616
virtual bool DiscardSystemPages(void *address, size_t size)
Definition: v8-platform.h:543
virtual size_t CommitPageSize()=0
virtual bool ReserveForSharedMemoryMapping(void *address, size_t size)
Definition: v8-platform.h:603
Definition: v8-platform.h:347
virtual ~ScopedBlockingCall()=default
Definition: v8-source-location.h:31
static constexpr SourceLocation Current()
Definition: v8-source-location.h:44
Definition: v8-platform.h:74
TaskRunner & operator=(const TaskRunner &)=delete
virtual void PostIdleTaskImpl(std::unique_ptr< IdleTask > task, const SourceLocation &location)
Definition: v8-platform.h:198
TaskRunner(const TaskRunner &)=delete
virtual void PostNonNestableTaskImpl(std::unique_ptr< Task > task, const SourceLocation &location)
Definition: v8-platform.h:190
virtual void PostTaskImpl(std::unique_ptr< Task > task, const SourceLocation &location)
Definition: v8-platform.h:188
virtual void PostDelayedTaskImpl(std::unique_ptr< Task > task, double delay_in_seconds, const SourceLocation &location)
Definition: v8-platform.h:192
virtual bool NonNestableDelayedTasksEnabled() const
Definition: v8-platform.h:176
void PostDelayedTask(std::unique_ptr< Task > task, double delay_in_seconds, const SourceLocation &location=SourceLocation::Current())
Definition: v8-platform.h:117
void PostIdleTask(std::unique_ptr< IdleTask > task, const SourceLocation &location=SourceLocation::Current())
Definition: v8-platform.h:157
void PostTask(std::unique_ptr< Task > task, const SourceLocation &location=SourceLocation::Current())
Definition: v8-platform.h:82
virtual bool NonNestableTasksEnabled() const
Definition: v8-platform.h:171
virtual ~TaskRunner()=default
virtual void PostNonNestableDelayedTaskImpl(std::unique_ptr< Task > task, double delay_in_seconds, const SourceLocation &location)
Definition: v8-platform.h:195
virtual bool IdleTasksEnabled()=0
void PostNonNestableTask(std::unique_ptr< Task > task, const SourceLocation &location=SourceLocation::Current())
Definition: v8-platform.h:104
void PostNonNestableDelayedTask(std::unique_ptr< Task > task, double delay_in_seconds, const SourceLocation &location=SourceLocation::Current())
Definition: v8-platform.h:141
Definition: v8-platform.h:49
Definition: v8-platform.h:640
virtual int Pkey() const
Definition: v8-platform.h:657
virtual void * Allocate(size_t size)=0
virtual void Free(void *object)=0
static void SetDefaultPermissionsForSignalHandler()
virtual ~ThreadIsolatedAllocator()=default
virtual Type Type() const =0
Type
Definition: v8-platform.h:648
Definition: v8-platform.h:430
virtual void OnTraceEnabled()=0
virtual ~TraceStateObserver()=default
virtual void OnTraceDisabled()=0
Definition: v8-platform.h:375
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)
Definition: v8-platform.h:412
virtual const uint8_t * GetCategoryGroupEnabled(const char *name)
Definition: v8-platform.h:390
virtual ~TracingController()=default
virtual void AddTraceStateObserver(TraceStateObserver *)
Definition: v8-platform.h:441
virtual void RemoveTraceStateObserver(TraceStateObserver *)
Definition: v8-platform.h:447
virtual void UpdateTraceEventDuration(const uint8_t *category_enabled_flag, const char *name, uint64_t handle)
Definition: v8-platform.h:426
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)
Definition: v8-platform.h:403
Definition: v8-platform.h:740
virtual bool CanAllocateSubspaces()=0
Address base() const
Definition: v8-platform.h:779
virtual void FreePages(Address address, size_t size)=0
virtual void SetRandomSeed(int64_t seed)=0
static constexpr Address kNoHint
Definition: v8-platform.h:841
bool Contains(Address address) const
Definition: v8-platform.h:801
uintptr_t Address
Definition: v8-platform.h:742
virtual bool DiscardSystemPages(Address address, size_t size)
Definition: v8-platform.h:1017
virtual void FreeSharedPages(Address address, size_t size)=0
virtual void FreeGuardRegion(Address address, size_t size)=0
virtual Address AllocateSharedPages(Address hint, size_t size, PagePermissions permissions, PlatformSharedMemoryHandle handle, uint64_t offset)=0
virtual bool SetPagePermissions(Address address, size_t size, PagePermissions permissions)=0
VirtualAddressSpace(size_t page_size, size_t allocation_granularity, Address base, size_t size, PagePermissions max_page_permissions)
Definition: v8-platform.h:744
size_t size() const
Definition: v8-platform.h:786
virtual bool AllocateGuardRegion(Address address, size_t size)=0
PagePermissions max_page_permissions() const
Definition: v8-platform.h:794
size_t allocation_granularity() const
Definition: v8-platform.h:772
virtual Address RandomPageAddress()=0
virtual bool RecommitPages(Address address, size_t size, PagePermissions permissions)=0
virtual ~VirtualAddressSpace()=default
virtual bool DecommitPages(Address address, size_t size)=0
virtual Address AllocatePages(Address hint, size_t size, size_t alignment, PagePermissions permissions)=0
size_t page_size() const
Definition: v8-platform.h:762
virtual std::unique_ptr< VirtualAddressSpace > AllocateSubspace(Address hint, size_t size, size_t alignment, PagePermissions max_page_permissions)=0
Definition: libplatform.h:15
TaskPriority
Definition: v8-platform.h:24
int FileDescriptorFromSharedMemoryHandle(PlatformSharedMemoryHandle handle)
Definition: v8-platform.h:713
PlatformSharedMemoryHandle SharedMemoryHandleFromFileDescriptor(int fd)
Definition: v8-platform.h:710
BlockingType
Definition: v8-platform.h:332
intptr_t PlatformSharedMemoryHandle
Definition: v8-platform.h:669
PagePermissions
Definition: v8-platform.h:722
#define V8_EXPORT
Definition: v8config.h:793
#define V8_DEPRECATE_SOON(message)
Definition: v8config.h:603
#define V8_WARN_UNUSED_RESULT
Definition: v8config.h:660