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 void PostTask(std::unique_ptr<Task> task,
83 const SourceLocation& location = SourceLocation::Current()) {
84 PostTaskImpl(std::move(task), location);
85 }
86
105 std::unique_ptr<Task> task,
106 const SourceLocation& location = SourceLocation::Current()) {
107 PostNonNestableTaskImpl(std::move(task), location);
108 }
109
118 std::unique_ptr<Task> task, double delay_in_seconds,
119 const SourceLocation& location = SourceLocation::Current()) {
120 PostDelayedTaskImpl(std::move(task), delay_in_seconds, location);
121 }
122
142 std::unique_ptr<Task> task, double delay_in_seconds,
143 const SourceLocation& location = SourceLocation::Current()) {
144 PostNonNestableDelayedTaskImpl(std::move(task), delay_in_seconds, location);
145 }
146
158 std::unique_ptr<IdleTask> task,
159 const SourceLocation& location = SourceLocation::Current()) {
160 PostIdleTaskImpl(std::move(task), location);
161 }
162
166 virtual bool IdleTasksEnabled() = 0;
167
171 virtual bool NonNestableTasksEnabled() const { return false; }
172
176 virtual bool NonNestableDelayedTasksEnabled() const { return false; }
177
178 TaskRunner() = default;
179 virtual ~TaskRunner() = default;
180
181 TaskRunner(const TaskRunner&) = delete;
182 TaskRunner& operator=(const TaskRunner&) = delete;
183
184 protected:
188 virtual void PostTaskImpl(std::unique_ptr<Task> task,
189 const SourceLocation& location) {}
190 virtual void PostNonNestableTaskImpl(std::unique_ptr<Task> task,
191 const SourceLocation& location) {}
192 virtual void PostDelayedTaskImpl(std::unique_ptr<Task> task,
193 double delay_in_seconds,
194 const SourceLocation& location) {}
195 virtual void PostNonNestableDelayedTaskImpl(std::unique_ptr<Task> task,
196 double delay_in_seconds,
197 const SourceLocation& location) {}
198 virtual void PostIdleTaskImpl(std::unique_ptr<IdleTask> task,
199 const SourceLocation& location) {}
200};
201
207 public:
214 virtual bool ShouldYield() = 0;
215
221 virtual void NotifyConcurrencyIncrease() = 0;
222
228 virtual uint8_t GetTaskId() = 0;
229
234 virtual bool IsJoiningThread() const = 0;
235};
236
242 public:
243 virtual ~JobHandle() = default;
244
250 virtual void NotifyConcurrencyIncrease() = 0;
251
259 virtual void Join() = 0;
260
265 virtual void Cancel() = 0;
266
267 /*
268 * Forces all existing workers to yield ASAP but doesn’t wait for them.
269 * Warning, this is dangerous if the Job's callback is bound to or has access
270 * to state which may be deleted after this call.
271 */
272 virtual void CancelAndDetach() = 0;
273
277 virtual bool IsActive() = 0;
278
284 virtual bool IsValid() = 0;
285
289 virtual bool UpdatePriorityEnabled() const { return false; }
290
294 virtual void UpdatePriority(TaskPriority new_priority) {}
295};
296
300class JobTask {
301 public:
302 virtual ~JobTask() = default;
303
304 virtual void Run(JobDelegate* delegate) = 0;
305
317 virtual size_t GetMaxConcurrency(size_t worker_count) const = 0;
318};
319
332enum class BlockingType {
333 // The call might block (e.g. file I/O that might hit in memory cache).
334 kMayBlock,
335 // The call will definitely block (e.g. cache already checked and now pinging
336 // server synchronously).
338};
339
348 public:
349 virtual ~ScopedBlockingCall() = default;
350};
351
356 public:
357 virtual ~ConvertableToTraceFormat() = default;
358
365 virtual void AppendAsTraceFormat(std::string* out) const = 0;
366};
367
376 public:
377 virtual ~TracingController() = default;
378
379 // In Perfetto mode, trace events are written using Perfetto's Track Event
380 // API directly without going through the embedder. However, it is still
381 // possible to observe tracing being enabled and disabled.
382#if !defined(V8_USE_PERFETTO)
390 virtual const uint8_t* GetCategoryGroupEnabled(const char* name) {
391 static uint8_t no = 0;
392 return &no;
393 }
394
403 virtual uint64_t AddTraceEvent(
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) {
410 return 0;
411 }
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) {
419 return 0;
420 }
421
426 virtual void UpdateTraceEventDuration(const uint8_t* category_enabled_flag,
427 const char* name, uint64_t handle) {}
428#endif // !defined(V8_USE_PERFETTO)
429
431 public:
432 virtual ~TraceStateObserver() = default;
433 virtual void OnTraceEnabled() = 0;
434 virtual void OnTraceDisabled() = 0;
435 };
436
442
448};
449
456 public:
457 virtual ~PageAllocator() = default;
458
463 virtual size_t AllocatePageSize() = 0;
464
469 virtual size_t CommitPageSize() = 0;
470
475 virtual void SetRandomMmapSeed(int64_t seed) = 0;
476
481 virtual void* GetRandomMmapAddr() = 0;
482
492 // Set this when reserving memory that will later require kReadWriteExecute
493 // permissions. The resulting behavior is platform-specific, currently
494 // this is used to set the MAP_JIT flag on Apple Silicon.
495 // TODO(jkummerow): Remove this when Wasm has a platform-independent
496 // w^x implementation.
497 // TODO(saelo): Remove this once all JIT pages are allocated through the
498 // VirtualAddressSpace API.
500 };
501
505 virtual void* AllocatePages(void* address, size_t length, size_t alignment,
506 Permission permissions) = 0;
507
511 virtual bool FreePages(void* address, size_t length) = 0;
512
516 virtual bool ReleasePages(void* address, size_t length,
517 size_t new_length) = 0;
518
522 virtual bool SetPermissions(void* address, size_t length,
523 Permission permissions) = 0;
524
530 virtual bool RecommitPages(void* address, size_t length,
531 Permission permissions) {
532 // TODO(v8:12797): make it pure once it's implemented on Chromium side.
533 return false;
534 }
535
543 virtual bool DiscardSystemPages(void* address, size_t size) { return true; }
544
553 virtual bool DecommitPages(void* address, size_t size) = 0;
554
563 virtual bool SealPages(void* address, size_t length) {
564 // TODO(360048056): make it pure once it's implemented on Chromium side.
565 return false;
566 }
567
573 public:
574 // Implementations are expected to free the shared memory mapping in the
575 // destructor.
576 virtual ~SharedMemoryMapping() = default;
577 virtual void* GetMemory() const = 0;
578 };
579
585 public:
586 // Implementations are expected to free the shared memory in the destructor.
587 virtual ~SharedMemory() = default;
588 virtual std::unique_ptr<SharedMemoryMapping> RemapTo(
589 void* new_address) const = 0;
590 virtual void* GetMemory() const = 0;
591 virtual size_t GetSize() const = 0;
592 };
593
603 virtual bool ReserveForSharedMemoryMapping(void* address, size_t size) {
604 return false;
605 }
606
616 virtual std::unique_ptr<SharedMemory> AllocateSharedPages(
617 size_t length, const void* original_address) {
618 return {};
619 }
620
629 virtual bool CanAllocateSharedPages() { return false; }
630};
631
641 public:
642 virtual ~ThreadIsolatedAllocator() = default;
643
644 virtual void* Allocate(size_t size) = 0;
645
646 virtual void Free(void* object) = 0;
647
648 enum class Type {
649 kPkey,
650 };
651
652 virtual Type Type() const = 0;
653
657 virtual int Pkey() const { return -1; }
658
666};
667
668// Opaque type representing a handle to a shared memory region.
670static constexpr PlatformSharedMemoryHandle kInvalidSharedMemoryHandle = -1;
671
672// Conversion routines from the platform-dependent shared memory identifiers
673// into the opaque PlatformSharedMemoryHandle type. These use the underlying
674// types (e.g. unsigned int) instead of the typedef'd ones (e.g. mach_port_t)
675// to avoid pulling in large OS header files into this header file. Instead,
676// the users of these routines are expected to include the respecitve OS
677// headers in addition to this one.
678#if V8_OS_DARWIN
679// Convert between a shared memory handle and a mach_port_t referencing a memory
680// entry object.
681inline PlatformSharedMemoryHandle SharedMemoryHandleFromMachMemoryEntry(
682 unsigned int port) {
683 return static_cast<PlatformSharedMemoryHandle>(port);
684}
685inline unsigned int MachMemoryEntryFromSharedMemoryHandle(
687 return static_cast<unsigned int>(handle);
688}
689#elif V8_OS_FUCHSIA
690// Convert between a shared memory handle and a zx_handle_t to a VMO.
691inline PlatformSharedMemoryHandle SharedMemoryHandleFromVMO(uint32_t handle) {
692 return static_cast<PlatformSharedMemoryHandle>(handle);
693}
694inline uint32_t VMOFromSharedMemoryHandle(PlatformSharedMemoryHandle handle) {
695 return static_cast<uint32_t>(handle);
696}
697#elif V8_OS_WIN
698// Convert between a shared memory handle and a Windows HANDLE to a file mapping
699// object.
700inline PlatformSharedMemoryHandle SharedMemoryHandleFromFileMapping(
701 void* handle) {
702 return reinterpret_cast<PlatformSharedMemoryHandle>(handle);
703}
704inline void* FileMappingFromSharedMemoryHandle(
706 return reinterpret_cast<void*>(handle);
707}
708#else
709// Convert between a shared memory handle and a file descriptor.
711 return static_cast<PlatformSharedMemoryHandle>(fd);
712}
715 return static_cast<int>(handle);
716}
717#endif
718
722enum class PagePermissions {
723 kNoAccess,
724 kRead,
728};
729
741 public:
742 using Address = uintptr_t;
743
745 Address base, size_t size,
747 : page_size_(page_size),
748 allocation_granularity_(allocation_granularity),
749 base_(base),
750 size_(size),
751 max_page_permissions_(max_page_permissions) {}
752
753 virtual ~VirtualAddressSpace() = default;
754
762 size_t page_size() const { return page_size_; }
763
772 size_t allocation_granularity() const { return allocation_granularity_; }
773
779 Address base() const { return base_; }
780
786 size_t size() const { return size_; }
787
794 PagePermissions max_page_permissions() const { return max_page_permissions_; }
795
801 bool Contains(Address address) const {
802 return (address >= base()) && (address < base() + size());
803 }
804
811 virtual void SetRandomSeed(int64_t seed) = 0;
812
820
841 static constexpr Address kNoHint = 0;
843 AllocatePages(Address hint, size_t size, size_t alignment,
844 PagePermissions permissions) = 0;
845
858 virtual void FreePages(Address address, size_t size) = 0;
859
878 Address address, size_t size, PagePermissions permissions) = 0;
879
897 size_t size) = 0;
898
912 virtual void FreeGuardRegion(Address address, size_t size) = 0;
913
935 PlatformSharedMemoryHandle handle, uint64_t offset) = 0;
936
949 virtual void FreeSharedPages(Address address, size_t size) = 0;
950
956 virtual bool CanAllocateSubspaces() = 0;
957
958 /*
959 * Allocate a subspace.
960 *
961 * The address space of a subspace stays reserved in the parent space for the
962 * lifetime of the subspace. As such, it is guaranteed that page allocations
963 * on the parent space cannot end up inside a subspace.
964 *
965 * \param hint Hints where the subspace should be allocated. See
966 * AllocatePages() for more details.
967 *
968 * \param size The size in bytes of the subspace. Must be a multiple of the
969 * allocation_granularity().
970 *
971 * \param alignment The alignment of the subspace in bytes. Must be a multiple
972 * of the allocation_granularity() and should be a power of two.
973 *
974 * \param max_page_permissions The maximum permissions that pages allocated in
975 * the subspace can obtain.
976 *
977 * \returns a new subspace or nullptr on failure.
978 */
979 virtual std::unique_ptr<VirtualAddressSpace> AllocateSubspace(
980 Address hint, size_t size, size_t alignment,
982
983 //
984 // TODO(v8) maybe refactor the methods below before stabilizing the API. For
985 // example by combining them into some form of page operation method that
986 // takes a command enum as parameter.
987 //
988
1005 Address address, size_t size, PagePermissions permissions) = 0;
1006
1018 size_t size) {
1019 return true;
1020 }
1032 size_t size) = 0;
1033
1034 private:
1035 const size_t page_size_;
1036 const size_t allocation_granularity_;
1037 const Address base_;
1038 const size_t size_;
1039 const PagePermissions max_page_permissions_;
1040};
1041
1047 public:
1048 virtual void EnterSection() {}
1049 virtual void LeaveSection() {}
1050};
1051
1059 public:
1060 virtual ~Platform() = default;
1061
1067
1075 return nullptr;
1076 }
1077
1086
1095 virtual int NumberOfWorkerThreads() = 0;
1096
1102 std::shared_ptr<v8::TaskRunner> GetForegroundTaskRunner(Isolate* isolate) {
1104 }
1105
1111 virtual std::shared_ptr<v8::TaskRunner> GetForegroundTaskRunner(
1112 Isolate* isolate, TaskPriority priority) = 0;
1113
1120 std::unique_ptr<Task> task,
1121 const SourceLocation& location = SourceLocation::Current()) {
1123 location);
1124 }
1125
1133 std::unique_ptr<Task> task,
1134 const SourceLocation& location = SourceLocation::Current()) {
1135 // Embedders may optionally override this to process these tasks in a high
1136 // priority pool.
1138 location);
1139 }
1140
1147 std::unique_ptr<Task> task,
1148 const SourceLocation& location = SourceLocation::Current()) {
1149 // Embedders may optionally override this to process these tasks in a low
1150 // priority pool.
1152 location);
1153 }
1154
1162 std::unique_ptr<Task> task, double delay_in_seconds,
1163 const SourceLocation& location = SourceLocation::Current()) {
1165 std::move(task), delay_in_seconds,
1166 location);
1167 }
1168
1172 virtual bool IdleTasksEnabled(Isolate* isolate) { return false; }
1173
1219 std::unique_ptr<JobHandle> PostJob(
1220 TaskPriority priority, std::unique_ptr<JobTask> job_task,
1221 const SourceLocation& location = SourceLocation::Current()) {
1222 auto handle = CreateJob(priority, std::move(job_task), location);
1223 handle->NotifyConcurrencyIncrease();
1224 return handle;
1225 }
1226
1242 std::unique_ptr<JobHandle> CreateJob(
1243 TaskPriority priority, std::unique_ptr<JobTask> job_task,
1244 const SourceLocation& location = SourceLocation::Current()) {
1245 return CreateJobImpl(priority, std::move(job_task), location);
1246 }
1247
1251 virtual std::unique_ptr<ScopedBlockingCall> CreateBlockingScope(
1252 BlockingType blocking_type) {
1253 return nullptr;
1254 }
1255
1263 virtual double MonotonicallyIncreasingTime() = 0;
1264
1271 return static_cast<int64_t>(floor(CurrentClockTimeMillis()));
1272 }
1273
1279 virtual double CurrentClockTimeMillis() = 0;
1280
1285 return CurrentClockTimeMillis();
1286 }
1287
1288 typedef void (*StackTracePrinter)();
1289
1294 virtual StackTracePrinter GetStackTracePrinter() { return nullptr; }
1295
1300
1305 virtual void DumpWithoutCrashing() {}
1306
1313 static HighAllocationThroughputObserver default_observer;
1314 return &default_observer;
1315 }
1316
1317 protected:
1324
1328 virtual std::unique_ptr<JobHandle> CreateJobImpl(
1329 TaskPriority priority, std::unique_ptr<JobTask> job_task,
1330 const SourceLocation& location) = 0;
1331
1336 std::unique_ptr<Task> task,
1337 const SourceLocation& location) = 0;
1338
1344 TaskPriority priority, std::unique_ptr<Task> task,
1345 double delay_in_seconds, const SourceLocation& location) = 0;
1346};
1347
1348} // namespace v8
1349
1350#endif // V8_V8_PLATFORM_H_
Definition: v8-platform.h:355
virtual ~ConvertableToTraceFormat()=default
virtual void AppendAsTraceFormat(std::string *out) const =0
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:212
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 bool IsValid()=0
virtual void UpdatePriority(TaskPriority new_priority)
Definition: v8-platform.h:294
virtual void Cancel()=0
virtual ~JobHandle()=default
virtual void Join()=0
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 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:1058
virtual std::unique_ptr< ScopedBlockingCall > CreateBlockingScope(BlockingType blocking_type)
Definition: v8-platform.h:1251
static double SystemClockTimeMillis()
virtual void PostDelayedTaskOnWorkerThreadImpl(TaskPriority priority, std::unique_ptr< Task > task, double delay_in_seconds, const SourceLocation &location)=0
virtual PageAllocator * GetPageAllocator()=0
std::unique_ptr< JobHandle > PostJob(TaskPriority priority, std::unique_ptr< JobTask > job_task, const SourceLocation &location=SourceLocation::Current())
Definition: v8-platform.h:1219
virtual std::shared_ptr< v8::TaskRunner > GetForegroundTaskRunner(Isolate *isolate, TaskPriority priority)=0
virtual TracingController * GetTracingController()=0
virtual int NumberOfWorkerThreads()=0
void CallLowPriorityTaskOnWorkerThread(std::unique_ptr< Task > task, const SourceLocation &location=SourceLocation::Current())
Definition: v8-platform.h:1146
virtual double MonotonicallyIncreasingTime()=0
void CallDelayedOnWorkerThread(std::unique_ptr< Task > task, double delay_in_seconds, const SourceLocation &location=SourceLocation::Current())
Definition: v8-platform.h:1161
virtual HighAllocationThroughputObserver * GetHighAllocationThroughputObserver()
Definition: v8-platform.h:1312
virtual void OnCriticalMemoryPressure()
Definition: v8-platform.h:1085
virtual int64_t CurrentClockTimeMilliseconds()
Definition: v8-platform.h:1270
virtual double CurrentClockTimeMillis()=0
void CallBlockingTaskOnWorkerThread(std::unique_ptr< Task > task, const SourceLocation &location=SourceLocation::Current())
Definition: v8-platform.h:1132
void CallOnWorkerThread(std::unique_ptr< Task > task, const SourceLocation &location=SourceLocation::Current())
Definition: v8-platform.h:1119
virtual StackTracePrinter GetStackTracePrinter()
Definition: v8-platform.h:1294
void(* StackTracePrinter)()
Definition: v8-platform.h:1288
virtual ~Platform()=default
std::unique_ptr< JobHandle > CreateJob(TaskPriority priority, std::unique_ptr< JobTask > job_task, const SourceLocation &location=SourceLocation::Current())
Definition: v8-platform.h:1242
virtual double CurrentClockTimeMillisecondsHighResolution()
Definition: v8-platform.h:1284
virtual void DumpWithoutCrashing()
Definition: v8-platform.h:1305
virtual void PostTaskOnWorkerThreadImpl(TaskPriority priority, std::unique_ptr< Task > task, const SourceLocation &location)=0
virtual bool IdleTasksEnabled(Isolate *isolate)
Definition: v8-platform.h:1172
std::shared_ptr< v8::TaskRunner > GetForegroundTaskRunner(Isolate *isolate)
Definition: v8-platform.h:1102
virtual std::unique_ptr< JobHandle > CreateJobImpl(TaskPriority priority, std::unique_ptr< JobTask > job_task, const SourceLocation &location)=0
virtual ThreadIsolatedAllocator * GetThreadIsolatedAllocator()
Definition: v8-platform.h:1074
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
TaskRunner()=default
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
virtual void Run()=0
virtual ~Task()=default
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
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_WARN_UNUSED_RESULT
Definition: v8config.h:660