diff options
Diffstat (limited to 'src/3rdparty/v8/src/platform.h')
-rw-r--r-- | src/3rdparty/v8/src/platform.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/3rdparty/v8/src/platform.h b/src/3rdparty/v8/src/platform.h index a9464de..f3ab08d 100644 --- a/src/3rdparty/v8/src/platform.h +++ b/src/3rdparty/v8/src/platform.h @@ -71,6 +71,24 @@ int signbit(double x); int strncasecmp(const char* s1, const char* s2, int n); +inline int lrint(double flt) { + int intgr; +#if defined(V8_TARGET_ARCH_IA32) + __asm { + fld flt + fistp intgr + }; +#else + intgr = static_cast<int>(flt + 0.5); + if ((intgr & 1) != 0 && intgr - flt == 0.5) { + // If the number is halfway between two integers, round to the even one. + intgr--; + } +#endif + return intgr; +} + + #endif // _MSC_VER // Random is missing on both Visual Studio and MinGW. @@ -89,7 +107,11 @@ namespace internal { // Use AtomicWord for a machine-sized pointer. It is assumed that // reads and writes of naturally aligned values of this type are atomic. +#if defined(__OpenBSD__) && defined(__i386__) +typedef Atomic32 AtomicWord; +#else typedef intptr_t AtomicWord; +#endif class Semaphore; class Mutex; @@ -286,6 +308,9 @@ class OS { // Returns the double constant NAN static double nan_value(); + // Support runtime detection of Cpu implementer + static CpuImplementer GetCpuImplementer(); + // Support runtime detection of VFP3 on ARM CPUs. static bool ArmCpuHasFeature(CpuFeature feature); @@ -317,6 +342,8 @@ class OS { static const int kMinComplexMemCopy = 256; #endif // V8_TARGET_ARCH_IA32 + static int GetCurrentProcessId(); + private: static const int msPerSecond = 1000; @@ -405,6 +432,11 @@ class VirtualMemory { // and the same size it was reserved with. static bool ReleaseRegion(void* base, size_t size); + // Returns true if OS performs lazy commits, i.e. the memory allocation call + // defers actual physical memory allocation till the first memory access. + // Otherwise returns false. + static bool HasLazyCommits(); + private: void* address_; // Start address of the virtual memory. size_t size_; // Size of the virtual memory. |