v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
platform.h
Go to the documentation of this file.
1// Copyright 2012 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_BASE_PLATFORM_PLATFORM_H_
6#define V8_BASE_PLATFORM_PLATFORM_H_
7
8// This module contains the platform-specific code. This make the rest of the
9// code less dependent on operating system, compilers and runtime libraries.
10// This module does specifically not deal with differences between different
11// processor architecture.
12// The platform classes have the same definition for all platforms. The
13// implementation for a particular platform is put in platform_<os>.cc.
14// The build system then uses the implementation for the target platform.
15//
16// This design has been chosen because it is simple and fast. Alternatively,
17// the platform dependent classes could have been implemented using abstract
18// superclasses with virtual methods and having specializations for each
19// platform. This design was rejected because it was more complicated and
20// slower. It would require factory methods for selecting the right
21// implementation and the overhead of virtual methods for performance
22// sensitive like mutex locking/unlocking.
23
24#include <cstdarg>
25#include <cstdint>
26#include <optional>
27#include <string>
28#include <vector>
29
30#include "include/v8-platform.h"
31#include "src/base/abort-mode.h"
35#include "src/base/macros.h"
37#include "testing/gtest/include/gtest/gtest_prod.h" // nogncheck
38
39#if V8_OS_QNX
40#include "src/base/qnx-math.h"
41#endif
42
43#if V8_CC_MSVC
44#include <intrin.h>
45#endif // V8_CC_MSVC
46
47#if V8_OS_FUCHSIA
48#include <zircon/types.h>
49#endif // V8_OS_FUCHSIA
50
51#ifdef V8_USE_ADDRESS_SANITIZER
52#include <sanitizer/asan_interface.h>
53#endif // V8_USE_ADDRESS_SANITIZER
54
55#ifndef V8_NO_FAST_TLS
56#if V8_CC_MSVC && V8_HOST_ARCH_IA32
57// __readfsdword is supposed to be declared in intrin.h but it is missing from
58// some versions of that file. See https://bugs.llvm.org/show_bug.cgi?id=51188
59// And, intrin.h is a very expensive header that we want to avoid here, and
60// the cheaper intrin0.h is not available for all build configurations. That is
61// why we declare this intrinsic.
62extern "C" unsigned long __readfsdword(unsigned long); // NOLINT(runtime/int)
63#endif // V8_CC_MSVC && V8_HOST_ARCH_IA32
64#endif // V8_NO_FAST_TLS
65
66#if V8_OS_OPENBSD
67#define PERMISSION_MUTABLE_SECTION __attribute__((section(".openbsd.mutable")))
68#else
69#define PERMISSION_MUTABLE_SECTION
70#endif
71
72namespace heap::base {
73class Stack;
74}
75
76namespace v8::base {
77
78// ----------------------------------------------------------------------------
79// Fast TLS support
80
81#ifndef V8_NO_FAST_TLS
82
83#if V8_CC_MSVC && V8_HOST_ARCH_IA32
84
85#define V8_FAST_TLS_SUPPORTED 1
86
87V8_INLINE intptr_t InternalGetExistingThreadLocal(intptr_t index) {
88 const intptr_t kTibInlineTlsOffset = 0xE10;
89 const intptr_t kTibExtraTlsOffset = 0xF94;
90 const intptr_t kMaxInlineSlots = 64;
91 const intptr_t kMaxSlots = kMaxInlineSlots + 1024;
92 const intptr_t kSystemPointerSize = sizeof(void*);
93 DCHECK(0 <= index && index < kMaxSlots);
94 USE(kMaxSlots);
95 if (index < kMaxInlineSlots) {
96 return static_cast<intptr_t>(
97 __readfsdword(kTibInlineTlsOffset + kSystemPointerSize * index));
98 }
99 intptr_t extra = static_cast<intptr_t>(__readfsdword(kTibExtraTlsOffset));
100 if (!extra) return 0;
101 return *reinterpret_cast<intptr_t*>(extra + kSystemPointerSize *
102 (index - kMaxInlineSlots));
103}
104
105// Not possible on ARM64, the register holding the base pointer is not stable
106// across major releases.
107#elif defined(__APPLE__) && (V8_HOST_ARCH_IA32 || V8_HOST_ARCH_X64)
108
109// tvOS simulator does not use intptr_t as TLS key.
110#if !defined(V8_OS_STARBOARD) || !defined(TARGET_OS_SIMULATOR)
111
112#define V8_FAST_TLS_SUPPORTED 1
113
114V8_INLINE intptr_t InternalGetExistingThreadLocal(intptr_t index) {
115 intptr_t result;
116#if V8_HOST_ARCH_IA32
117 asm("movl %%gs:(,%1,4), %0;"
118 : "=r"(result) // Output must be a writable register.
119 : "r"(index));
120#else
121 asm("movq %%gs:(,%1,8), %0;" : "=r"(result) : "r"(index));
122#endif
123 return result;
124}
125
126#endif // !defined(V8_OS_STARBOARD) || !defined(TARGET_OS_SIMULATOR)
127
128#endif
129
130#endif // V8_NO_FAST_TLS
131
132class AddressSpaceReservation;
133class PageAllocator;
134class TimezoneCache;
135class VirtualAddressSpace;
136class VirtualAddressSubspace;
137
138// ----------------------------------------------------------------------------
139// OS
140//
141// This class has static methods for the different platform specific
142// functions. Add methods here to cope with differences between the
143// supported platforms.
144
146 public:
147 // Initialize the OS class.
148 // - abort_mode: see src/base/abort-mode.h for details.
149 // - gc_fake_mmap: Name of the file for fake gc mmap used in ll_prof.
150 static void Initialize(AbortMode abort_mode, const char* const gc_fake_mmap);
151
152#if V8_OS_WIN
153 // On Windows, ensure the newer memory API is loaded if available. This
154 // includes function like VirtualAlloc2 and MapViewOfFile3.
155 // TODO(chromium:1218005) this should probably happen as part of Initialize,
156 // but that is currently invoked too late, after the sandbox is initialized.
157 // However, eventually the sandbox initialization will probably happen as
158 // part of V8::Initialize, at which point this function can probably be
159 // merged into OS::Initialize.
160 static void EnsureWin32MemoryAPILoaded();
161#endif
162
163 // Check whether CET shadow stack is enabled.
164 static bool IsHardwareEnforcedShadowStacksEnabled();
165
166 // Returns the accumulated user time for thread. This routine
167 // can be used for profiling. The implementation should
168 // strive for high-precision timer resolution, preferable
169 // micro-second resolution.
170 static int GetUserTime(uint32_t* secs, uint32_t* usecs);
171
172 // Obtain the peak memory usage in kilobytes
173 static int GetPeakMemoryUsageKb();
174
175 // Returns current time as the number of milliseconds since
176 // 00:00:00 UTC, January 1, 1970.
177 static double TimeCurrentMillis();
178
179 static TimezoneCache* CreateTimezoneCache();
180
181 // Returns last OS error.
182 static int GetLastError();
183
184 static FILE* FOpen(const char* path, const char* mode);
185 static bool Remove(const char* path);
186
187 static char DirectorySeparator();
188 static bool isDirectorySeparator(const char ch);
189
190 // Opens a temporary file, the file is auto removed on close.
191 static FILE* OpenTemporaryFile();
192
193 // Log file open mode is platform-dependent due to line ends issues.
194 static const char* const LogFileOpenMode;
195
196 // Print output to console. This is mostly used for debugging output.
197 // On platforms that has standard terminal output, the output
198 // should go to stdout.
199 static PRINTF_FORMAT(1, 2) void Print(const char* format, ...);
200 static PRINTF_FORMAT(1, 0) void VPrint(const char* format, va_list args);
201
202 // Print output to a file. This is mostly used for debugging output.
203 static PRINTF_FORMAT(2, 3) void FPrint(FILE* out, const char* format, ...);
204 static PRINTF_FORMAT(2, 0) void VFPrint(FILE* out, const char* format,
205 va_list args);
206
207 // Print error output to console. This is mostly used for error message
208 // output. On platforms that has standard terminal output, the output
209 // should go to stderr.
210 static PRINTF_FORMAT(1, 2) void PrintError(const char* format, ...);
211 static PRINTF_FORMAT(1, 0) void VPrintError(const char* format, va_list args);
212
213 // Memory permissions. These should be kept in sync with the ones in
214 // v8::PageAllocator and v8::PagePermissions.
215 enum class MemoryPermission {
216 kNoAccess,
217 kRead,
221 // TODO(jkummerow): Remove this when Wasm has a platform-independent
222 // w^x implementation.
223 kNoAccessWillJitLater
224 };
225
226 // Helpers to create shared memory objects. Currently only used for testing.
227 static PlatformSharedMemoryHandle CreateSharedMemoryHandleForTesting(
228 size_t size);
229 static void DestroySharedMemoryHandle(PlatformSharedMemoryHandle handle);
230
231 static bool HasLazyCommits();
232
233 // Sleep for a specified time interval.
234 static void Sleep(TimeDelta interval);
235
236 // Abort the current process.
237 [[noreturn]] static void Abort();
238
239 // Debug break.
240 static void DebugBreak();
241
242 // Walk the stack.
243 static const int kStackWalkError = -1;
244 static const int kStackWalkMaxNameLen = 256;
245 static const int kStackWalkMaxTextLen = 256;
246 struct StackFrame {
247 void* address;
248 char text[kStackWalkMaxTextLen];
249 };
250
252 public:
253 enum class FileMode { kReadOnly, kReadWrite };
254
255 virtual ~MemoryMappedFile() = default;
256 virtual void* memory() const = 0;
257 virtual size_t size() const = 0;
258
259 static MemoryMappedFile* open(const char* name,
260 FileMode mode = FileMode::kReadWrite);
261 static MemoryMappedFile* create(const char* name, size_t size,
262 void* initial);
263 };
264
265 // Safe formatting print. Ensures that str is always null-terminated.
266 // Returns the number of chars written, or -1 if output was truncated.
267 static PRINTF_FORMAT(3, 4) int SNPrintF(char* str, int length,
268 const char* format, ...);
269 static PRINTF_FORMAT(3, 0) int VSNPrintF(char* str, int length,
270 const char* format, va_list args);
271
272 static void StrNCpy(char* dest, int length, const char* src, size_t n);
273
274 // Support for the profiler. Can do nothing, in which case ticks
275 // occurring in shared libraries will not be properly accounted for.
277 SharedLibraryAddress(const std::string& library_path, uintptr_t start,
278 uintptr_t end)
279 : library_path(library_path), start(start), end(end), aslr_slide(0) {}
280 SharedLibraryAddress(const std::string& library_path, uintptr_t start,
281 uintptr_t end, intptr_t aslr_slide)
282 : library_path(library_path),
283 start(start),
284 end(end),
285 aslr_slide(aslr_slide) {}
286
287 std::string library_path;
288 uintptr_t start;
289 uintptr_t end;
290 intptr_t aslr_slide;
291 };
292
293 static std::vector<SharedLibraryAddress> GetSharedLibraryAddresses();
294
295 // Support for the profiler. Notifies the external profiling
296 // process that a code moving garbage collection starts. Can do
297 // nothing, in which case the code objects must not move (e.g., by
298 // using --never-compact) if accurate profiling is desired.
299 static void SignalCodeMovingGC();
300
301 // Support runtime detection of whether the hard float option of the
302 // EABI is used.
303 static bool ArmUsingHardFloat();
304
305 // Returns the activation frame alignment constraint or zero if
306 // the platform doesn't care. Guaranteed to be a power of two.
307 static int ActivationFrameAlignment();
308
309 static int GetCurrentProcessId();
310
311 static int GetCurrentThreadId();
312
313 static void AdjustSchedulingParams();
314
315 using Address = uintptr_t;
316
317 struct MemoryRange {
318 uintptr_t start = 0;
319 uintptr_t end = 0;
320 };
321
322 // Find the first gap between existing virtual memory ranges that has enough
323 // space to place a region with minimum_size within (boundary_start,
324 // boundary_end)
325 static std::optional<MemoryRange> GetFirstFreeMemoryRangeWithin(
326 Address boundary_start, Address boundary_end, size_t minimum_size,
327 size_t alignment);
328
329 [[noreturn]] static void ExitProcess(int exit_code);
330
331 // Whether the platform supports mapping a given address in another location
332 // in the address space.
334#if (defined(V8_OS_MACOS) || defined(V8_OS_LINUX)) && \
335 !(defined(V8_TARGET_ARCH_PPC64) || defined(V8_TARGET_ARCH_S390X))
336 return true;
337#else
338 return false;
339#endif
340 }
341
342 // Remaps already-mapped memory at |new_address| with |access| permissions.
343 //
344 // Both the source and target addresses must be page-aligned, and |size| must
345 // be a multiple of the system page size. If there is already memory mapped
346 // at the target address, it is replaced by the new mapping.
347 //
348 // In addition, this is only meant to remap memory which is file-backed, and
349 // mapped from a file which is still accessible.
350 //
351 // Must not be called if |IsRemapPagesSupported()| return false.
352 // Returns true for success.
353 V8_WARN_UNUSED_RESULT static bool RemapPages(const void* address, size_t size,
354 void* new_address,
355 MemoryPermission access);
356
357 // Make part of the process's data memory read-only.
358 static void SetDataReadOnly(void* address, size_t size);
359
360 private:
361 static int GetCurrentThreadIdInternal();
362
363 // These classes use the private memory management API below.
365 friend class MemoryMappedFile;
370 FRIEND_TEST(OS, RemapPages);
371
372 static size_t AllocatePageSize();
373
374 static size_t CommitPageSize();
375
376 static void SetRandomMmapSeed(int64_t seed);
377
378 static void* GetRandomMmapAddr();
379
380 V8_WARN_UNUSED_RESULT static void* Allocate(void* address, size_t size,
381 size_t alignment,
382 MemoryPermission access);
383
384 V8_WARN_UNUSED_RESULT static void* AllocateShared(size_t size,
385 MemoryPermission access);
386
387 V8_WARN_UNUSED_RESULT static void* RemapShared(void* old_address,
388 void* new_address,
389 size_t size);
390
391 static void Free(void* address, size_t size);
392
393 V8_WARN_UNUSED_RESULT static void* AllocateShared(
394 void* address, size_t size, OS::MemoryPermission access,
395 PlatformSharedMemoryHandle handle, uint64_t offset);
396
397 static void FreeShared(void* address, size_t size);
398
399 static void Release(void* address, size_t size);
400
401 V8_WARN_UNUSED_RESULT static bool SetPermissions(void* address, size_t size,
402 MemoryPermission access);
403
404 V8_WARN_UNUSED_RESULT static bool RecommitPages(void* address, size_t size,
405 MemoryPermission access);
406
407 V8_WARN_UNUSED_RESULT static bool DiscardSystemPages(void* address,
408 size_t size);
409
410 V8_WARN_UNUSED_RESULT static bool DecommitPages(void* address, size_t size);
411
412 V8_WARN_UNUSED_RESULT static bool SealPages(void* address, size_t size);
413
414 V8_WARN_UNUSED_RESULT static bool CanReserveAddressSpace();
415
416 V8_WARN_UNUSED_RESULT static std::optional<AddressSpaceReservation>
417 CreateAddressSpaceReservation(void* hint, size_t size, size_t alignment,
418 MemoryPermission max_permission);
419
420 static void FreeAddressSpaceReservation(AddressSpaceReservation reservation);
421
422 static const int msPerSecond = 1000;
423
424#if V8_OS_POSIX
425 static const char* GetGCFakeMMapFile();
426#endif
427
429};
430
431#if defined(V8_OS_WIN)
432V8_BASE_EXPORT void EnsureConsoleOutputWin32();
433#endif // defined(V8_OS_WIN)
434
435inline void EnsureConsoleOutput() {
436#if defined(V8_OS_WIN)
437 // Windows requires extra calls to send assert output to the console
438 // rather than a dialog box.
439 EnsureConsoleOutputWin32();
440#endif // defined(V8_OS_WIN)
441}
442
443// ----------------------------------------------------------------------------
444// AddressSpaceReservation
445//
446// This class provides the same memory management functions as OS but operates
447// inside a previously reserved contiguous region of virtual address space.
448//
449// Reserved address space in which no pages have been allocated is guaranteed
450// to be inaccessible and cause a fault on access. As such, creating guard
451// regions requires no further action.
453 public:
454 using Address = uintptr_t;
455
456 void* base() const { return base_; }
457 size_t size() const { return size_; }
458
459 bool Contains(void* region_addr, size_t region_size) const {
460 Address base = reinterpret_cast<Address>(base_);
461 Address region_base = reinterpret_cast<Address>(region_addr);
462 return (region_base >= base) &&
463 ((region_base + region_size) <= (base + size_));
464 }
465
466 V8_WARN_UNUSED_RESULT bool Allocate(void* address, size_t size,
467 OS::MemoryPermission access);
468
469 V8_WARN_UNUSED_RESULT bool Free(void* address, size_t size);
470
471 V8_WARN_UNUSED_RESULT bool AllocateShared(void* address, size_t size,
474 uint64_t offset);
475
476 V8_WARN_UNUSED_RESULT bool FreeShared(void* address, size_t size);
477
478 V8_WARN_UNUSED_RESULT bool SetPermissions(void* address, size_t size,
479 OS::MemoryPermission access);
480
481 V8_WARN_UNUSED_RESULT bool RecommitPages(void* address, size_t size,
482 OS::MemoryPermission access);
483
484 V8_WARN_UNUSED_RESULT bool DiscardSystemPages(void* address, size_t size);
485
486 V8_WARN_UNUSED_RESULT bool DecommitPages(void* address, size_t size);
487
488 V8_WARN_UNUSED_RESULT std::optional<AddressSpaceReservation>
489 CreateSubReservation(void* address, size_t size,
490 OS::MemoryPermission max_permission);
491
492 V8_WARN_UNUSED_RESULT static bool FreeSubReservation(
493 AddressSpaceReservation reservation);
494
495#if V8_OS_WIN
496 // On Windows, the placeholder mappings backing address space reservations
497 // need to be split and merged as page allocations can only replace an entire
498 // placeholder mapping, not parts of it. This must be done by the users of
499 // this API as it requires a RegionAllocator (or equivalent) to keep track of
500 // sub-regions and decide when to split and when to coalesce multiple free
501 // regions into a single one.
502 V8_WARN_UNUSED_RESULT bool SplitPlaceholder(void* address, size_t size);
503 V8_WARN_UNUSED_RESULT bool MergePlaceholders(void* address, size_t size);
504#endif // V8_OS_WIN
505
506 private:
507 friend class OS;
508
509#if V8_OS_FUCHSIA
510 AddressSpaceReservation(void* base, size_t size, zx_handle_t vmar)
511 : base_(base), size_(size), vmar_(vmar) {}
512#else
513 AddressSpaceReservation(void* base, size_t size) : base_(base), size_(size) {}
514#endif // V8_OS_FUCHSIA
515
516 void* base_ = nullptr;
517 size_t size_ = 0;
518
519#if V8_OS_FUCHSIA
520 // On Fuchsia, address space reservations are backed by VMARs.
521 zx_handle_t vmar_ = ZX_HANDLE_INVALID;
522#endif // V8_OS_FUCHSIA
523};
524
525// ----------------------------------------------------------------------------
526// Thread
527//
528// Thread objects are used for creating and running threads. When the start()
529// method is called the new thread starts running the run() method in the new
530// thread. The Thread object should not be deallocated before the thread has
531// terminated.
532
534 public:
535 // Opaque data type for thread-local storage keys.
536#if V8_OS_STARBOARD
537 using LocalStorageKey = SbThreadLocalKey;
538#elif V8_OS_ZOS
539 using LocalStorageKey = pthread_key_t;
540#else
541 using LocalStorageKey = int32_t;
542#endif
543
544 // Priority class for the thread. Use kDefault to keep the priority
545 // unchanged.
546 enum class Priority { kBestEffort, kUserVisible, kUserBlocking, kDefault };
547
548 class Options {
549 public:
550 Options() : Options("v8:<unknown>") {}
551 explicit Options(const char* name, int stack_size = 0)
552 : Options(name, Priority::kDefault, stack_size) {}
553 Options(const char* name, Priority priority, int stack_size = 0)
554 : name_(name), priority_(priority), stack_size_(stack_size) {}
555
556 const char* name() const { return name_; }
557 int stack_size() const { return stack_size_; }
558 Priority priority() const { return priority_; }
559
560 private:
561 const char* name_;
563 const int stack_size_;
564 };
565
566 // Create new thread.
567 explicit Thread(const Options& options);
568 Thread(const Thread&) = delete;
569 Thread& operator=(const Thread&) = delete;
570 virtual ~Thread();
571
572 // Start new thread by calling the Run() method on the new thread.
573 V8_WARN_UNUSED_RESULT bool Start();
574
575 // Start new thread and wait until Run() method is called on the new thread.
577 start_semaphore_ = new Semaphore(0);
578 if (!Start()) return false;
579 start_semaphore_->Wait();
580 delete start_semaphore_;
581 start_semaphore_ = nullptr;
582 return true;
583 }
584
585 // Wait until thread terminates.
586 void Join();
587
588 inline const char* name() const {
589 return name_;
590 }
591
592 // Abstract method for run handler.
593 virtual void Run() = 0;
594
595 // Thread-local storage.
596 static LocalStorageKey CreateThreadLocalKey();
597 static void DeleteThreadLocalKey(LocalStorageKey key);
598 static void* GetThreadLocal(LocalStorageKey key);
599 static void SetThreadLocal(LocalStorageKey key, void* value);
601 return GetThreadLocal(key) != nullptr;
602 }
603
604#ifdef V8_FAST_TLS_SUPPORTED
605 static inline void* GetExistingThreadLocal(LocalStorageKey key) {
606 void* result = reinterpret_cast<void*>(
607 InternalGetExistingThreadLocal(static_cast<intptr_t>(key)));
608 DCHECK(result == GetThreadLocal(key));
609 return result;
610 }
611#else
613 return GetThreadLocal(key);
614 }
615#endif
616
617 // The thread name length is limited to 16 based on Linux's implementation of
618 // prctl().
619 static const int kMaxThreadNameLength = 16;
620
621 class PlatformData;
622 PlatformData* data() { return data_; }
623 Priority priority() const { return priority_; }
624
626 if (start_semaphore_) start_semaphore_->Signal();
627 Run();
628 }
629
630 private:
631 void set_name(const char* name);
632
634
635 char name_[kMaxThreadNameLength];
639};
640
641// TODO(v8:10354): Make use of the stack utilities here in V8.
643 public:
644 // Convenience wrapper to use stack slots as unsigned values or void*
645 // pointers.
646 struct StackSlot {
647 // NOLINTNEXTLINE
648 StackSlot(void* value) : value(reinterpret_cast<uintptr_t>(value)) {}
649 StackSlot(uintptr_t value) : value(value) {} // NOLINT
650
651 // NOLINTNEXTLINE
652 operator void*() const { return reinterpret_cast<void*>(value); }
653 operator uintptr_t() const { return value; } // NOLINT
654
655 uintptr_t value;
656 };
657
658 // Gets the start of the stack of the current thread.
659 static StackSlot GetStackStart();
660
661 // Returns the current stack top. Works correctly with ASAN and SafeStack.
662 //
663 // GetCurrentStackPosition() should not be inlined, because it works on stack
664 // frames if it were inlined into a function with a huge stack frame it would
665 // return an address significantly above the actual current stack position.
666 static V8_NOINLINE StackSlot GetCurrentStackPosition();
667
668 // Same as `GetCurrentStackPosition()` with the difference that it is always
669 // inlined and thus always returns the current frame's stack top.
671#if V8_CC_MSVC
672 return _AddressOfReturnAddress();
673#else
674 return __builtin_frame_address(0);
675#endif
676 }
677
678 // Returns the real stack frame if slot is part of a fake frame, and slot
679 // otherwise.
681#ifdef V8_USE_ADDRESS_SANITIZER
682 // ASAN fetches the real stack deeper in the __asan_addr_is_in_fake_stack()
683 // call (precisely, deeper in __asan_stack_malloc_()), which results in a
684 // real frame that could be outside of stack bounds. Adjust for this
685 // impreciseness here.
686 constexpr size_t kAsanRealFrameOffsetBytes = 32;
687 void* real_frame = __asan_addr_is_in_fake_stack(
688 __asan_get_current_fake_stack(), slot, nullptr, nullptr);
689 return real_frame ? StackSlot(static_cast<char*>(real_frame) +
690 kAsanRealFrameOffsetBytes)
691 : slot;
692#endif // V8_USE_ADDRESS_SANITIZER
693 return slot;
694 }
695
696 private:
697 // Return the current thread stack start pointer.
698 static StackSlot GetStackStartUnchecked();
699 static Stack::StackSlot ObtainCurrentThreadStackStart();
700
701 friend class heap::base::Stack;
702};
703
704#if V8_HAS_PTHREAD_JIT_WRITE_PROTECT
705V8_BASE_EXPORT void SetJitWriteProtected(int enable);
706#endif
707
708} // namespace v8::base
709
710#endif // V8_BASE_PLATFORM_PLATFORM_H_
#define V8_BASE_EXPORT
Definition base-export.h:26
uint8_t data_[MAX_STACK_LENGTH]
bool Contains(void *region_addr, size_t region_size) const
Definition platform.h:459
AddressSpaceReservation(void *base, size_t size)
Definition platform.h:513
virtual ~MemoryMappedFile()=default
virtual size_t size() const =0
virtual void * memory() const =0
static bool ArmUsingHardFloat()
static const char *const LogFileOpenMode
Definition platform.h:194
static V8_WARN_UNUSED_RESULT constexpr bool IsRemapPageSupported()
Definition platform.h:333
FRIEND_TEST(OS, RemapPages)
uintptr_t Address
Definition platform.h:315
DISALLOW_IMPLICIT_CONSTRUCTORS(OS)
static PRINTF_FORMAT(1, 2) void Print(const char *format
static V8_INLINE StackSlot GetCurrentFrameAddress()
Definition platform.h:670
static StackSlot GetRealStackAddressForSlot(StackSlot slot)
Definition platform.h:680
const Priority priority_
Definition platform.h:562
Options(const char *name, Priority priority, int stack_size=0)
Definition platform.h:553
const char * name() const
Definition platform.h:556
Priority priority() const
Definition platform.h:558
Options(const char *name, int stack_size=0)
Definition platform.h:551
virtual void Run()=0
Thread & operator=(const Thread &)=delete
Priority priority_
Definition platform.h:637
int32_t LocalStorageKey
Definition platform.h:541
Semaphore * start_semaphore_
Definition platform.h:638
Thread(const Thread &)=delete
Priority priority() const
Definition platform.h:623
PlatformData * data_
Definition platform.h:633
bool StartSynchronously()
Definition platform.h:576
PlatformData * data()
Definition platform.h:622
static void * GetExistingThreadLocal(LocalStorageKey key)
Definition platform.h:612
static bool HasThreadLocal(LocalStorageKey key)
Definition platform.h:600
const char * name() const
Definition platform.h:588
void NotifyStartedAndRun()
Definition platform.h:625
const int size_
Definition assembler.cc:132
int start
int end
base::Vector< const DirectHandle< Object > > args
Definition execution.cc:74
OptionalOpIndex index
int32_t offset
ZoneVector< RpoNumber > & result
const char * name_
size_t priority
v8::PageAllocator PageAllocator
Definition platform.h:22
void * Allocate(void *address, size_t size, OS::MemoryPermission access)
std::vector< OS::SharedLibraryAddress > GetSharedLibraryAddresses(FILE *fp)
void EnsureConsoleOutput()
Definition platform.h:435
void Free(void *memory)
Definition memory.h:63
constexpr int kSystemPointerSize
Definition globals.h:410
intptr_t PlatformSharedMemoryHandle
#define PRINTF_FORMAT(format_param, dots_param)
#define DCHECK(condition)
Definition logging.h:482
#define USE(...)
Definition macros.h:293
SharedLibraryAddress(const std::string &library_path, uintptr_t start, uintptr_t end)
Definition platform.h:277
SharedLibraryAddress(const std::string &library_path, uintptr_t start, uintptr_t end, intptr_t aslr_slide)
Definition platform.h:280
StackSlot(uintptr_t value)
Definition platform.h:649
#define V8_INLINE
Definition v8config.h:500
#define V8_WARN_UNUSED_RESULT
Definition v8config.h:671
#define V8_NOINLINE
Definition v8config.h:586
std::unique_ptr< ValueMirror > value
std::unique_ptr< ValueMirror > key