v8 12.4.254 (node 22.4.1)
V8 is Google's open source JavaScript engine
Loading...
Searching...
No Matches
v8-platform.h
Go to the documentation of this file.
1// Copyright 2013 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef V8_V8_PLATFORM_H_
6#define V8_V8_PLATFORM_H_
7
8#include <math.h>
9#include <stddef.h>
10#include <stdint.h>
11#include <stdlib.h> // For abort.
12
13#include <memory>
14#include <string>
15
16#include "v8-source-location.h" // NOLINT(build/include_directory)
17#include "v8config.h" // NOLINT(build/include_directory)
18
19namespace v8 {
20
21class Isolate;
22
23// Valid priorities supported by the task scheduling infrastructure.
24enum class TaskPriority : uint8_t {
44};
45
49class Task {
50 public:
51 virtual ~Task() = default;
52
53 virtual void Run() = 0;
54};
55
62class IdleTask {
63 public:
64 virtual ~IdleTask() = default;
65 virtual void Run(double deadline_in_seconds) = 0;
66};
67
75 public:
82 virtual void PostTask(std::unique_ptr<Task> task) {
83 PostTaskImpl(std::move(task), SourceLocation::Current());
84 }
85
103 virtual void PostNonNestableTask(std::unique_ptr<Task> task) {
105 }
106
114 virtual void PostDelayedTask(std::unique_ptr<Task> task,
115 double delay_in_seconds) {
116 PostDelayedTaskImpl(std::move(task), delay_in_seconds,
118 }
119
138 virtual void PostNonNestableDelayedTask(std::unique_ptr<Task> task,
139 double delay_in_seconds) {
140 PostNonNestableDelayedTaskImpl(std::move(task), delay_in_seconds,
142 }
143
154 virtual void PostIdleTask(std::unique_ptr<IdleTask> task) {
155 PostIdleTaskImpl(std::move(task), SourceLocation::Current());
156 }
157
161 virtual bool IdleTasksEnabled() = 0;
162
166 virtual bool NonNestableTasksEnabled() const { return false; }
167
171 virtual bool NonNestableDelayedTasksEnabled() const { return false; }
172
173 TaskRunner() = default;
174 virtual ~TaskRunner() = default;
175
176 TaskRunner(const TaskRunner&) = delete;
177 TaskRunner& operator=(const TaskRunner&) = delete;
178
179 protected:
183 virtual void PostTaskImpl(std::unique_ptr<Task> task,
184 const SourceLocation& location) {}
185 virtual void PostNonNestableTaskImpl(std::unique_ptr<Task> task,
186 const SourceLocation& location) {}
187 virtual void PostDelayedTaskImpl(std::unique_ptr<Task> task,
188 double delay_in_seconds,
189 const SourceLocation& location) {}
190 virtual void PostNonNestableDelayedTaskImpl(std::unique_ptr<Task> task,
191 double delay_in_seconds,
192 const SourceLocation& location) {}
193 virtual void PostIdleTaskImpl(std::unique_ptr<IdleTask> task,
194 const SourceLocation& location) {}
195};
196
202 public:
209 virtual bool ShouldYield() = 0;
210
216 virtual void NotifyConcurrencyIncrease() = 0;
217
223 virtual uint8_t GetTaskId() = 0;
224
229 virtual bool IsJoiningThread() const = 0;
230};
231
237 public:
238 virtual ~JobHandle() = default;
239
245 virtual void NotifyConcurrencyIncrease() = 0;
246
254 virtual void Join() = 0;
255
260 virtual void Cancel() = 0;
261
262 /*
263 * Forces all existing workers to yield ASAP but doesn’t wait for them.
264 * Warning, this is dangerous if the Job's callback is bound to or has access
265 * to state which may be deleted after this call.
266 */
267 virtual void CancelAndDetach() = 0;
268
272 virtual bool IsActive() = 0;
273
279 virtual bool IsValid() = 0;
280
284 virtual bool UpdatePriorityEnabled() const { return false; }
285
289 virtual void UpdatePriority(TaskPriority new_priority) {}
290};
291
295class JobTask {
296 public:
297 virtual ~JobTask() = default;
298
299 virtual void Run(JobDelegate* delegate) = 0;
300
312 virtual size_t GetMaxConcurrency(size_t worker_count) const = 0;
313};
314
327enum class BlockingType {
328 // The call might block (e.g. file I/O that might hit in memory cache).
329 kMayBlock,
330 // The call will definitely block (e.g. cache already checked and now pinging
331 // server synchronously).
333};
334
343 public:
344 virtual ~ScopedBlockingCall() = default;
345};
346
351 public:
352 virtual ~ConvertableToTraceFormat() = default;
353
360 virtual void AppendAsTraceFormat(std::string* out) const = 0;
361};
362
371 public:
372 virtual ~TracingController() = default;
373
374 // In Perfetto mode, trace events are written using Perfetto's Track Event
375 // API directly without going through the embedder. However, it is still
376 // possible to observe tracing being enabled and disabled.
377#if !defined(V8_USE_PERFETTO)
385 virtual const uint8_t* GetCategoryGroupEnabled(const char* name) {
386 static uint8_t no = 0;
387 return &no;
388 }
389
398 virtual uint64_t AddTraceEvent(
399 char phase, const uint8_t* category_enabled_flag, const char* name,
400 const char* scope, uint64_t id, uint64_t bind_id, int32_t num_args,
401 const char** arg_names, const uint8_t* arg_types,
402 const uint64_t* arg_values,
403 std::unique_ptr<ConvertableToTraceFormat>* arg_convertables,
404 unsigned int flags) {
405 return 0;
406 }
408 char phase, const uint8_t* category_enabled_flag, const char* name,
409 const char* scope, uint64_t id, uint64_t bind_id, int32_t num_args,
410 const char** arg_names, const uint8_t* arg_types,
411 const uint64_t* arg_values,
412 std::unique_ptr<ConvertableToTraceFormat>* arg_convertables,
413 unsigned int flags, int64_t timestamp) {
414 return 0;
415 }
416
421 virtual void UpdateTraceEventDuration(const uint8_t* category_enabled_flag,
422 const char* name, uint64_t handle) {}
423#endif // !defined(V8_USE_PERFETTO)
424
426 public:
427 virtual ~TraceStateObserver() = default;
428 virtual void OnTraceEnabled() = 0;
429 virtual void OnTraceDisabled() = 0;
430 };
431
437
443};
444
451 public:
452 virtual ~PageAllocator() = default;
453
458 virtual size_t AllocatePageSize() = 0;
459
464 virtual size_t CommitPageSize() = 0;
465
470 virtual void SetRandomMmapSeed(int64_t seed) = 0;
471
476 virtual void* GetRandomMmapAddr() = 0;
477
487 // Set this when reserving memory that will later require kReadWriteExecute
488 // permissions. The resulting behavior is platform-specific, currently
489 // this is used to set the MAP_JIT flag on Apple Silicon.
490 // TODO(jkummerow): Remove this when Wasm has a platform-independent
491 // w^x implementation.
492 // TODO(saelo): Remove this once all JIT pages are allocated through the
493 // VirtualAddressSpace API.
495 };
496
500 virtual void* AllocatePages(void* address, size_t length, size_t alignment,
501 Permission permissions) = 0;
502
506 virtual bool FreePages(void* address, size_t length) = 0;
507
511 virtual bool ReleasePages(void* address, size_t length,
512 size_t new_length) = 0;
513
517 virtual bool SetPermissions(void* address, size_t length,
518 Permission permissions) = 0;
519
525 virtual bool RecommitPages(void* address, size_t length,
526 Permission permissions) {
527 // TODO(v8:12797): make it pure once it's implemented on Chromium side.
528 return false;
529 }
530
538 virtual bool DiscardSystemPages(void* address, size_t size) { return true; }
539
548 virtual bool DecommitPages(void* address, size_t size) = 0;
549
555 public:
556 // Implementations are expected to free the shared memory mapping in the
557 // destructor.
558 virtual ~SharedMemoryMapping() = default;
559 virtual void* GetMemory() const = 0;
560 };
561
567 public:
568 // Implementations are expected to free the shared memory in the destructor.
569 virtual ~SharedMemory() = default;
570 virtual std::unique_ptr<SharedMemoryMapping> RemapTo(
571 void* new_address) const = 0;
572 virtual void* GetMemory() const = 0;
573 virtual size_t GetSize() const = 0;
574 };
575
585 virtual bool ReserveForSharedMemoryMapping(void* address, size_t size) {
586 return false;
587 }
588
598 virtual std::unique_ptr<SharedMemory> AllocateSharedPages(
599 size_t length, const void* original_address) {
600 return {};
601 }
602
611 virtual bool CanAllocateSharedPages() { return false; }
612};
613
623 public:
624 virtual ~ThreadIsolatedAllocator() = default;
625
626 virtual void* Allocate(size_t size) = 0;
627
628 virtual void Free(void* object) = 0;
629
630 enum class Type {
631 kPkey,
632 };
633
634 virtual Type Type() const = 0;
635
639 virtual int Pkey() const { return -1; }
640
648};
649
650// Opaque type representing a handle to a shared memory region.
652static constexpr PlatformSharedMemoryHandle kInvalidSharedMemoryHandle = -1;
653
654// Conversion routines from the platform-dependent shared memory identifiers
655// into the opaque PlatformSharedMemoryHandle type. These use the underlying
656// types (e.g. unsigned int) instead of the typedef'd ones (e.g. mach_port_t)
657// to avoid pulling in large OS header files into this header file. Instead,
658// the users of these routines are expected to include the respecitve OS
659// headers in addition to this one.
660#if V8_OS_DARWIN
661// Convert between a shared memory handle and a mach_port_t referencing a memory
662// entry object.
663inline PlatformSharedMemoryHandle SharedMemoryHandleFromMachMemoryEntry(
664 unsigned int port) {
665 return static_cast<PlatformSharedMemoryHandle>(port);
666}
667inline unsigned int MachMemoryEntryFromSharedMemoryHandle(
669 return static_cast<unsigned int>(handle);
670}
671#elif V8_OS_FUCHSIA
672// Convert between a shared memory handle and a zx_handle_t to a VMO.
673inline PlatformSharedMemoryHandle SharedMemoryHandleFromVMO(uint32_t handle) {
674 return static_cast<PlatformSharedMemoryHandle>(handle);
675}
676inline uint32_t VMOFromSharedMemoryHandle(PlatformSharedMemoryHandle handle) {
677 return static_cast<uint32_t>(handle);
678}
679#elif V8_OS_WIN
680// Convert between a shared memory handle and a Windows HANDLE to a file mapping
681// object.
682inline PlatformSharedMemoryHandle SharedMemoryHandleFromFileMapping(
683 void* handle) {
684 return reinterpret_cast<PlatformSharedMemoryHandle>(handle);
685}
686inline void* FileMappingFromSharedMemoryHandle(
688 return reinterpret_cast<void*>(handle);
689}
690#else
691// Convert between a shared memory handle and a file descriptor.
693 return static_cast<PlatformSharedMemoryHandle>(fd);
694}
697 return static_cast<int>(handle);
698}
699#endif
700
704enum class PagePermissions {
705 kNoAccess,
706 kRead,
710};
711
723 public:
724 using Address = uintptr_t;
725
727 Address base, size_t size,
729 : page_size_(page_size),
730 allocation_granularity_(allocation_granularity),
731 base_(base),
732 size_(size),
733 max_page_permissions_(max_page_permissions) {}
734
735 virtual ~VirtualAddressSpace() = default;
736
744 size_t page_size() const { return page_size_; }
745
754 size_t allocation_granularity() const { return allocation_granularity_; }
755
761 Address base() const { return base_; }
762
768 size_t size() const { return size_; }
769
776 PagePermissions max_page_permissions() const { return max_page_permissions_; }
777
783 bool Contains(Address address) const {
784 return (address >= base()) && (address < base() + size());
785 }
786
793 virtual void SetRandomSeed(int64_t seed) = 0;
794
802
823 static constexpr Address kNoHint = 0;
825 AllocatePages(Address hint, size_t size, size_t alignment,
826 PagePermissions permissions) = 0;
827
840 virtual void FreePages(Address address, size_t size) = 0;
841
860 Address address, size_t size, PagePermissions permissions) = 0;
861
879 size_t size) = 0;
880
894 virtual void FreeGuardRegion(Address address, size_t size) = 0;
895
917 PlatformSharedMemoryHandle handle, uint64_t offset) = 0;
918
931 virtual void FreeSharedPages(Address address, size_t size) = 0;
932
938 virtual bool CanAllocateSubspaces() = 0;
939
940 /*
941 * Allocate a subspace.
942 *
943 * The address space of a subspace stays reserved in the parent space for the
944 * lifetime of the subspace. As such, it is guaranteed that page allocations
945 * on the parent space cannot end up inside a subspace.
946 *
947 * \param hint Hints where the subspace should be allocated. See
948 * AllocatePages() for more details.
949 *
950 * \param size The size in bytes of the subspace. Must be a multiple of the
951 * allocation_granularity().
952 *
953 * \param alignment The alignment of the subspace in bytes. Must be a multiple
954 * of the allocation_granularity() and should be a power of two.
955 *
956 * \param max_page_permissions The maximum permissions that pages allocated in
957 * the subspace can obtain.
958 *
959 * \returns a new subspace or nullptr on failure.
960 */
961 virtual std::unique_ptr<VirtualAddressSpace> AllocateSubspace(
962 Address hint, size_t size, size_t alignment,
964
965 //
966 // TODO(v8) maybe refactor the methods below before stabilizing the API. For
967 // example by combining them into some form of page operation method that
968 // takes a command enum as parameter.
969 //
970
987 Address address, size_t size, PagePermissions permissions) = 0;
988
1000 size_t size) {
1001 return true;
1002 }
1014 size_t size) = 0;
1015
1016 private:
1017 const size_t page_size_;
1018 const size_t allocation_granularity_;
1019 const Address base_;
1020 const size_t size_;
1021 const PagePermissions max_page_permissions_;
1022};
1023
1028 public:
1029 using MallocFn = void* (*)(size_t);
1030 using FreeFn = void (*)(void*);
1031
1032 virtual MallocFn GetMallocFn() const { return ::malloc; }
1033 virtual FreeFn GetFreeFn() const { return ::free; }
1034};
1035
1041 public:
1042 virtual void EnterSection() {}
1043 virtual void LeaveSection() {}
1044};
1045
1053 public:
1054 virtual ~Platform() = default;
1055
1061
1069 return nullptr;
1070 }
1071
1076 static ZoneBackingAllocator default_allocator;
1077 return &default_allocator;
1078 }
1079
1088
1097 virtual int NumberOfWorkerThreads() = 0;
1098
1106 virtual std::shared_ptr<v8::TaskRunner> GetForegroundTaskRunner(
1107 Isolate* isolate) {
1109 }
1110
1117 virtual std::shared_ptr<v8::TaskRunner> GetForegroundTaskRunner(
1118 Isolate* isolate, TaskPriority priority) {
1119 return nullptr;
1120 }
1121
1128 std::unique_ptr<Task> task,
1129 const SourceLocation& location = SourceLocation::Current()) {
1131 location);
1132 }
1133
1141 std::unique_ptr<Task> task,
1142 const SourceLocation& location = SourceLocation::Current()) {
1143 // Embedders may optionally override this to process these tasks in a high
1144 // priority pool.
1146 location);
1147 }
1148
1155 std::unique_ptr<Task> task,
1156 const SourceLocation& location = SourceLocation::Current()) {
1157 // Embedders may optionally override this to process these tasks in a low
1158 // priority pool.
1160 location);
1161 }
1162
1170 std::unique_ptr<Task> task, double delay_in_seconds,
1171 const SourceLocation& location = SourceLocation::Current()) {
1173 std::move(task), delay_in_seconds,
1174 location);
1175 }
1176
1180 virtual bool IdleTasksEnabled(Isolate* isolate) { return false; }
1181
1227 std::unique_ptr<JobHandle> PostJob(
1228 TaskPriority priority, std::unique_ptr<JobTask> job_task,
1229 const SourceLocation& location = SourceLocation::Current()) {
1230 auto handle = CreateJob(priority, std::move(job_task), location);
1231 handle->NotifyConcurrencyIncrease();
1232 return handle;
1233 }
1234
1250 std::unique_ptr<JobHandle> CreateJob(
1251 TaskPriority priority, std::unique_ptr<JobTask> job_task,
1252 const SourceLocation& location = SourceLocation::Current()) {
1253 return CreateJobImpl(priority, std::move(job_task), location);
1254 }
1255
1259 virtual std::unique_ptr<ScopedBlockingCall> CreateBlockingScope(
1260 BlockingType blocking_type) {
1261 return nullptr;
1262 }
1263
1271 virtual double MonotonicallyIncreasingTime() = 0;
1272
1279 return static_cast<int64_t>(floor(CurrentClockTimeMillis()));
1280 }
1281
1287 virtual double CurrentClockTimeMillis() = 0;
1288
1293 return CurrentClockTimeMillis();
1294 }
1295
1296 typedef void (*StackTracePrinter)();
1297
1302 virtual StackTracePrinter GetStackTracePrinter() { return nullptr; }
1303
1308
1313 virtual void DumpWithoutCrashing() {}
1314
1321 static HighAllocationThroughputObserver default_observer;
1322 return &default_observer;
1323 }
1324
1325 protected:
1332
1336 virtual std::unique_ptr<JobHandle> CreateJobImpl(
1337 TaskPriority priority, std::unique_ptr<JobTask> job_task,
1338 const SourceLocation& location) = 0;
1339
1344 std::unique_ptr<Task> task,
1345 const SourceLocation& location) = 0;
1346
1352 TaskPriority priority, std::unique_ptr<Task> task,
1353 double delay_in_seconds, const SourceLocation& location) = 0;
1354};
1355
1356} // namespace v8
1357
1358#endif // V8_V8_PLATFORM_H_
virtual void AppendAsTraceFormat(std::string *out) const =0
virtual ~ConvertableToTraceFormat()=default
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 bool IsValid()=0
virtual void Cancel()=0
virtual void NotifyConcurrencyIncrease()=0
virtual ~JobHandle()=default
virtual void Join()=0
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 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 bool RecommitPages(void *address, size_t length, Permission permissions)
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 ~Platform()=default
void CallLowPriorityTaskOnWorkerThread(std::unique_ptr< Task > task, const SourceLocation &location=SourceLocation::Current())
virtual TracingController * GetTracingController()=0
virtual void PostDelayedTaskOnWorkerThreadImpl(TaskPriority priority, std::unique_ptr< Task > task, double delay_in_seconds, const SourceLocation &location)=0
static V8_EXPORT double SystemClockTimeMillis()
virtual std::shared_ptr< v8::TaskRunner > GetForegroundTaskRunner(Isolate *isolate)
virtual double CurrentClockTimeMillisecondsHighResolution()
virtual PageAllocator * GetPageAllocator()=0
virtual void PostTaskOnWorkerThreadImpl(TaskPriority priority, std::unique_ptr< Task > task, const SourceLocation &location)=0
virtual ZoneBackingAllocator * GetZoneBackingAllocator()
virtual void DumpWithoutCrashing()
void(* StackTracePrinter)()
virtual std::unique_ptr< JobHandle > CreateJobImpl(TaskPriority priority, std::unique_ptr< JobTask > job_task, const SourceLocation &location)=0
std::unique_ptr< JobHandle > CreateJob(TaskPriority priority, std::unique_ptr< JobTask > job_task, const SourceLocation &location=SourceLocation::Current())
virtual StackTracePrinter GetStackTracePrinter()
virtual ThreadIsolatedAllocator * GetThreadIsolatedAllocator()
virtual double CurrentClockTimeMillis()=0
virtual void OnCriticalMemoryPressure()
virtual HighAllocationThroughputObserver * GetHighAllocationThroughputObserver()
std::unique_ptr< JobHandle > PostJob(TaskPriority priority, std::unique_ptr< JobTask > job_task, const SourceLocation &location=SourceLocation::Current())
void CallBlockingTaskOnWorkerThread(std::unique_ptr< Task > task, const SourceLocation &location=SourceLocation::Current())
virtual bool IdleTasksEnabled(Isolate *isolate)
void CallDelayedOnWorkerThread(std::unique_ptr< Task > task, double delay_in_seconds, const SourceLocation &location=SourceLocation::Current())
virtual int64_t CurrentClockTimeMilliseconds()
virtual std::unique_ptr< ScopedBlockingCall > CreateBlockingScope(BlockingType blocking_type)
virtual double MonotonicallyIncreasingTime()=0
virtual int NumberOfWorkerThreads()=0
virtual std::shared_ptr< v8::TaskRunner > GetForegroundTaskRunner(Isolate *isolate, TaskPriority priority)
void CallOnWorkerThread(std::unique_ptr< Task > task, const SourceLocation &location=SourceLocation::Current())
virtual ~ScopedBlockingCall()=default
static constexpr SourceLocation Current()
virtual void Run()=0
virtual ~Task()=default
virtual bool NonNestableTasksEnabled() const
virtual void PostIdleTaskImpl(std::unique_ptr< IdleTask > task, const SourceLocation &location)
virtual void PostNonNestableDelayedTaskImpl(std::unique_ptr< Task > task, double delay_in_seconds, const SourceLocation &location)
virtual void PostNonNestableDelayedTask(std::unique_ptr< Task > task, double delay_in_seconds)
virtual void PostNonNestableTaskImpl(std::unique_ptr< Task > task, const SourceLocation &location)
virtual void PostTaskImpl(std::unique_ptr< Task > task, const SourceLocation &location)
TaskRunner(const TaskRunner &)=delete
virtual void PostDelayedTask(std::unique_ptr< Task > task, double delay_in_seconds)
TaskRunner()=default
virtual bool NonNestableDelayedTasksEnabled() const
virtual void PostDelayedTaskImpl(std::unique_ptr< Task > task, double delay_in_seconds, const SourceLocation &location)
virtual void PostIdleTask(std::unique_ptr< IdleTask > task)
virtual bool IdleTasksEnabled()=0
virtual ~TaskRunner()=default
TaskRunner & operator=(const TaskRunner &)=delete
virtual void PostTask(std::unique_ptr< Task > task)
Definition v8-platform.h:82
virtual void PostNonNestableTask(std::unique_ptr< Task > task)
virtual ~ThreadIsolatedAllocator()=default
virtual void Free(void *object)=0
virtual int Pkey() const
static void SetDefaultPermissionsForSignalHandler()
virtual Type Type() const =0
virtual void * Allocate(size_t size)=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 *)
bool Contains(Address address) const
size_t page_size() const
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 V8_WARN_UNUSED_RESULT bool RecommitPages(Address address, size_t size, PagePermissions 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
Address base() const
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)
TaskPriority
Definition v8-platform.h:24
int FileDescriptorFromSharedMemoryHandle(PlatformSharedMemoryHandle handle)
PagePermissions
BlockingType
#define V8_EXPORT
Definition v8config.h:753
#define V8_WARN_UNUSED_RESULT
Definition v8config.h:628