21 #ifndef V8_BASE_PLATFORM_PLATFORM_H_
22 #define V8_BASE_PLATFORM_PLATFORM_H_
50 int strncasecmp(
const char*
s1,
const char*
s2,
int n);
54 inline int lrint(
double flt) {
56 #if V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X87
62 intgr =
static_cast<int>(flt + 0.5);
63 if ((intgr & 1) != 0 && intgr - flt == 0.5) {
80 #ifndef V8_NO_FAST_TLS
82 #if defined(_MSC_VER) && (V8_HOST_ARCH_IA32)
84 #define V8_FAST_TLS_SUPPORTED 1
86 INLINE(intptr_t InternalGetExistingThreadLocal(intptr_t index));
88 inline intptr_t InternalGetExistingThreadLocal(intptr_t index) {
89 const intptr_t kTibInlineTlsOffset = 0xE10;
90 const intptr_t kTibExtraTlsOffset = 0xF94;
91 const intptr_t kMaxInlineSlots = 64;
92 const intptr_t kMaxSlots = kMaxInlineSlots + 1024;
94 DCHECK(0 <= index && index < kMaxSlots);
95 if (index < kMaxInlineSlots) {
96 return static_cast<intptr_t
>(__readfsdword(kTibInlineTlsOffset +
99 intptr_t extra =
static_cast<intptr_t
>(__readfsdword(kTibExtraTlsOffset));
101 return *
reinterpret_cast<intptr_t*
>(extra +
105 #elif defined(__APPLE__) && (V8_HOST_ARCH_IA32 || V8_HOST_ARCH_X64)
107 #define V8_FAST_TLS_SUPPORTED 1
109 extern intptr_t kMacTlsBaseOffset;
111 INLINE(intptr_t InternalGetExistingThreadLocal(intptr_t index));
113 inline intptr_t InternalGetExistingThreadLocal(intptr_t index) {
115 #if V8_HOST_ARCH_IA32
116 asm(
"movl %%gs:(%1,%2,4), %0;"
118 :
"r"(kMacTlsBaseOffset),
"r"(index));
120 asm(
"movq %%gs:(%1,%2,8), %0;"
122 :
"r"(kMacTlsBaseOffset),
"r"(index));
150 const char*
const gc_fake_mmap);
180 static FILE*
FOpen(
const char* path,
const char*
mode);
181 static bool Remove(
const char* path);
192 static void Print(
const char* format, ...);
193 static void VPrint(
const char* format, va_list args);
196 static void FPrint(FILE* out,
const char* format, ...);
197 static void VFPrint(FILE* out,
const char* format, va_list args);
202 static void PrintError(
const char* format, ...);
203 static void VPrintError(
const char* format, va_list args);
208 static void*
Allocate(
const size_t requested,
211 static void Free(
void* address,
const size_t size);
221 static void Guard(
void* address,
const size_t size);
230 static void Sleep(
const int milliseconds);
258 static int SNPrintF(
char* str,
int length,
const char* format, ...);
264 static char*
StrChr(
char* str,
int c);
265 static void StrNCpy(
char* dest,
int length,
const char* src,
size_t n);
306 static const char* GetGCFakeMMapFile();
451 inline const char*
name()
const {
463 return static_cast<int>(
reinterpret_cast<intptr_t
>(
GetThreadLocal(key)));
467 SetThreadLocal(key,
reinterpret_cast<void*
>(
static_cast<intptr_t
>(value)));
473 #ifdef V8_FAST_TLS_SUPPORTED
475 void* result =
reinterpret_cast<void*
>(
476 InternalGetExistingThreadLocal(
static_cast<intptr_t
>(key)));
virtual ~MemoryMappedFile()
static MemoryMappedFile * create(const char *name, int size, void *initial)
virtual void * memory()=0
static MemoryMappedFile * open(const char *name)
static void VPrintError(const char *format, va_list args)
static double DaylightSavingsOffset(double time, TimezoneCache *cache)
static void * GetRandomMmapAddr()
static size_t AllocateAlignment()
static void SignalCodeMovingGC()
static bool ArmUsingHardFloat()
static double nan_value()
static void VPrint(const char *format, va_list args)
static void Initialize(int64_t random_seed, bool hard_abort, const char *const gc_fake_mmap)
static intptr_t CommitPageSize()
static void ClearTimezoneCache(TimezoneCache *cache)
static const char *const LogFileOpenMode
static const int kStackWalkMaxNameLen
static void Guard(void *address, const size_t size)
static void Sleep(const int milliseconds)
static int GetLastError()
static void * Allocate(const size_t requested, size_t *allocated, bool is_executable)
static FILE * OpenTemporaryFile()
static FILE * FOpen(const char *path, const char *mode)
static int GetCurrentProcessId()
static const char * LocalTimezone(double time, TimezoneCache *cache)
static std::vector< SharedLibraryAddress > GetSharedLibraryAddresses()
static void Print(const char *format,...)
static void StrNCpy(char *dest, int length, const char *src, size_t n)
static double LocalTimeOffset(TimezoneCache *cache)
static void PrintError(const char *format,...)
static int GetUserTime(uint32_t *secs, uint32_t *usecs)
static const int kStackWalkMaxTextLen
static int GetCurrentThreadId()
static int ActivationFrameAlignment()
static const int kStackWalkError
static char * StrChr(char *str, int c)
static void VFPrint(FILE *out, const char *format, va_list args)
static void ProtectCode(void *address, const size_t size)
DISALLOW_IMPLICIT_CONSTRUCTORS(OS)
static void Free(void *address, const size_t size)
static TimezoneCache * CreateTimezoneCache()
static double TimeCurrentMillis()
static void DisposeTimezoneCache(TimezoneCache *cache)
static int SNPrintF(char *str, int length, const char *format,...)
static const int msPerSecond
static int VSNPrintF(char *str, int length, const char *format, va_list args)
static void FPrint(FILE *out, const char *format,...)
static bool Remove(const char *path)
const char * name() const
Options(const char *name, int stack_size=0)
DISALLOW_COPY_AND_ASSIGN(Thread)
Thread(const Options &options)
void StartSynchronously()
static int GetThreadLocalInt(LocalStorageKey key)
static void DeleteThreadLocalKey(LocalStorageKey key)
Semaphore * start_semaphore_
const char * name() const
static LocalStorageKey CreateThreadLocalKey()
static void * GetThreadLocal(LocalStorageKey key)
void set_name(const char *name)
static void * GetExistingThreadLocal(LocalStorageKey key)
char name_[kMaxThreadNameLength]
static void SetThreadLocalInt(LocalStorageKey key, int value)
static const int kMaxThreadNameLength
static bool HasThreadLocal(LocalStorageKey key)
void NotifyStartedAndRun()
static void SetThreadLocal(LocalStorageKey key, void *value)
bool Commit(void *address, size_t size, bool is_executable)
static bool UncommitRegion(void *base, size_t size)
static bool ReleaseRegion(void *base, size_t size)
bool Guard(void *address)
bool Uncommit(void *address, size_t size)
static bool CommitRegion(void *base, size_t size, bool is_executable)
void TakeControl(VirtualMemory *from)
static bool HasLazyCommits()
static void * ReserveRegion(size_t size)
enable harmony numeric enable harmony object literal extensions Optimize object size
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be expose gc extension under the specified name show built in functions in stack traces use random jit cookie to mask large constants minimum length for automatic enable preparsing CPU profiler sampling interval in microseconds trace out of bounds accesses to external arrays default size of stack region v8 is allowed to maximum length of function source code printed in a stack trace min size of a semi the new space consists of two semi spaces print one trace line following each garbage collection do not print trace line after scavenger collection print cumulative GC statistics in name
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long mode(MIPS only)") DEFINE_BOOL(enable_always_align_csp
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be NULL
#define DCHECK(condition)
#define INLINE(declarator)
Debugger support for the V8 JavaScript engine.
SharedLibraryAddress(const std::string &library_path, uintptr_t start, uintptr_t end)
char text[kStackWalkMaxTextLen]