sources += [
"src/base/platform/platform-win32.cc",
"src/base/win32-headers.h",
- "src/base/win32-math.cc",
- "src/base/win32-math.h",
]
defines += [ "_CRT_RAND_S" ] # for rand_s()
// V8_HAS_BUILTIN_CLZ - __builtin_clz() supported
// V8_HAS_BUILTIN_CTZ - __builtin_ctz() supported
// V8_HAS_BUILTIN_EXPECT - __builtin_expect() supported
+// V8_HAS_BUILTIN_FRAME_ADDRESS - __builtin_frame_address() supported
// V8_HAS_BUILTIN_POPCOUNT - __builtin_popcount() supported
// V8_HAS_BUILTIN_SADD_OVERFLOW - __builtin_sadd_overflow() supported
// V8_HAS_BUILTIN_SSUB_OVERFLOW - __builtin_ssub_overflow() supported
// V8_HAS_DECLSPEC_NOINLINE - __declspec(noinline) supported
// V8_HAS___FINAL - __final supported in non-C++11 mode
// V8_HAS___FORCEINLINE - __forceinline supported
-// V8_HAS_SEALED - MSVC style sealed marker supported
//
// Note that testing for compilers and/or features must be done using #if
// not #ifdef. For example, to test for Intel C++ Compiler, use:
# define V8_HAS_BUILTIN_CLZ (__has_builtin(__builtin_clz))
# define V8_HAS_BUILTIN_CTZ (__has_builtin(__builtin_ctz))
# define V8_HAS_BUILTIN_EXPECT (__has_builtin(__builtin_expect))
+# define V8_HAS_BUILTIN_FRAME_ADDRESS (__has_builtin(__builtin_frame_address))
# define V8_HAS_BUILTIN_POPCOUNT (__has_builtin(__builtin_popcount))
# define V8_HAS_BUILTIN_SADD_OVERFLOW (__has_builtin(__builtin_sadd_overflow))
# define V8_HAS_BUILTIN_SSUB_OVERFLOW (__has_builtin(__builtin_ssub_overflow))
# define V8_HAS_BUILTIN_CLZ (V8_GNUC_PREREQ(3, 4, 0))
# define V8_HAS_BUILTIN_CTZ (V8_GNUC_PREREQ(3, 4, 0))
# define V8_HAS_BUILTIN_EXPECT (V8_GNUC_PREREQ(2, 96, 0))
+# define V8_HAS_BUILTIN_FRAME_ADDRESS (V8_GNUC_PREREQ(2, 96, 0))
# define V8_HAS_BUILTIN_POPCOUNT (V8_GNUC_PREREQ(3, 4, 0))
// g++ requires -std=c++0x or -std=gnu++0x to support C++11 functionality
# define V8_HAS___ALIGNOF 1
-// Override control was added with Visual Studio 2005, but
-// Visual Studio 2010 and earlier spell "final" as "sealed".
-# define V8_HAS_CXX11_FINAL (_MSC_VER >= 1700)
-# define V8_HAS_CXX11_OVERRIDE (_MSC_VER >= 1400)
-# define V8_HAS_SEALED (_MSC_VER >= 1400)
+# define V8_HAS_CXX11_FINAL 1
+# define V8_HAS_CXX11_OVERRIDE 1
# define V8_HAS_DECLSPEC_ALIGN 1
-# define V8_HAS_DECLSPEC_DEPRECATED (_MSC_VER >= 1300)
+# define V8_HAS_DECLSPEC_DEPRECATED 1
# define V8_HAS_DECLSPEC_NOINLINE 1
# define V8_HAS___FORCEINLINE 1
#define FINAL final
#elif V8_HAS___FINAL
#define FINAL __final
-#elif V8_HAS_SEALED
-#define FINAL sealed
#else
#define FINAL /* NOT SUPPORTED */
#endif
#endif // MINGW_HAS_SECURE_API
#endif // __MINGW32__
-#ifdef _MSC_VER
#include <limits>
-#endif
#include "src/base/win32-headers.h"
#include "src/base/platform/time.h"
#include "src/base/utils/random-number-generator.h"
-#ifdef _MSC_VER
-
-// Case-insensitive bounded string comparisons. Use stricmp() on Win32. Usually
-// defined in strings.h.
-int strncasecmp(const char* s1, const char* s2, int n) {
- return _strnicmp(s1, s2, n);
-}
-
-#endif // _MSC_VER
-
// Extra functions for MinGW. Most of these are the _s functions which are in
// the Microsoft Visual Studio C++ CRT.
void OS::DebugBreak() {
-#ifdef _MSC_VER
+#if V8_CC_MSVC
// To avoid Visual Studio runtime support the following code can be used
// instead
// __asm { int 3 }
double OS::nan_value() {
-#ifdef _MSC_VER
return std::numeric_limits<double>::quiet_NaN();
-#else // _MSC_VER
- return NAN;
-#endif // _MSC_VER
}
#ifndef V8_BASE_PLATFORM_PLATFORM_H_
#define V8_BASE_PLATFORM_PLATFORM_H_
-#include <stdarg.h>
+#include <cstdarg>
#include <string>
#include <vector>
#include "src/base/qnx-math.h"
#endif
-// Microsoft Visual C++ specific stuff.
-#if V8_LIBC_MSVCRT
-
-#include "src/base/win32-headers.h"
-#include "src/base/win32-math.h"
-
-int strncasecmp(const char* s1, const char* s2, int n);
-
-// Visual C++ 2013 and higher implement this function.
-#if (_MSC_VER < 1800)
-inline int lrint(double flt) {
- int intgr;
-#if V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X87
- __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 < 1800
-
-#endif // V8_LIBC_MSVCRT
-
namespace v8 {
namespace base {
#ifndef V8_NO_FAST_TLS
-#if defined(_MSC_VER) && (V8_HOST_ARCH_IA32)
+#if V8_CC_MSVC && V8_HOST_ARCH_IA32
#define V8_FAST_TLS_SUPPORTED 1
+++ /dev/null
-// Copyright 2011 the V8 project authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Extra POSIX/ANSI routines for Win32 when using Visual Studio C++. Please
-// refer to The Open Group Base Specification for specification of the correct
-// semantics for these functions.
-// (http://www.opengroup.org/onlinepubs/000095399/)
-#if defined(_MSC_VER) && (_MSC_VER < 1800)
-
-#include "src/base/win32-headers.h"
-#include <float.h> // Required for DBL_MAX and on Win32 for finite()
-#include <limits.h> // Required for INT_MAX etc.
-#include <cmath>
-#include "src/base/win32-math.h"
-
-#include "src/base/logging.h"
-
-
-namespace std {
-
-// Test for a NaN (not a number) value - usually defined in math.h
-int isnan(double x) {
- return _isnan(x);
-}
-
-
-// Test for infinity - usually defined in math.h
-int isinf(double x) {
- return (_fpclass(x) & (_FPCLASS_PINF | _FPCLASS_NINF)) != 0;
-}
-
-
-// Test for finite value - usually defined in math.h
-int isfinite(double x) {
- return _finite(x);
-}
-
-
-// Test if x is less than y and both nominal - usually defined in math.h
-int isless(double x, double y) {
- return isnan(x) || isnan(y) ? 0 : x < y;
-}
-
-
-// Test if x is greater than y and both nominal - usually defined in math.h
-int isgreater(double x, double y) {
- return isnan(x) || isnan(y) ? 0 : x > y;
-}
-
-
-// Classify floating point number - usually defined in math.h
-int fpclassify(double x) {
- // Use the MS-specific _fpclass() for classification.
- int flags = _fpclass(x);
-
- // Determine class. We cannot use a switch statement because
- // the _FPCLASS_ constants are defined as flags.
- if (flags & (_FPCLASS_PN | _FPCLASS_NN)) return FP_NORMAL;
- if (flags & (_FPCLASS_PZ | _FPCLASS_NZ)) return FP_ZERO;
- if (flags & (_FPCLASS_PD | _FPCLASS_ND)) return FP_SUBNORMAL;
- if (flags & (_FPCLASS_PINF | _FPCLASS_NINF)) return FP_INFINITE;
-
- // All cases should be covered by the code above.
- DCHECK(flags & (_FPCLASS_SNAN | _FPCLASS_QNAN));
- return FP_NAN;
-}
-
-
-// Test sign - usually defined in math.h
-int signbit(double x) {
- // We need to take care of the special case of both positive
- // and negative versions of zero.
- if (x == 0)
- return _fpclass(x) & _FPCLASS_NZ;
- else
- return x < 0;
-}
-
-} // namespace std
-
-#endif // _MSC_VER
+++ /dev/null
-// Copyright 2011 the V8 project authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Extra POSIX/ANSI routines for Win32 when using Visual Studio C++. Please
-// refer to The Open Group Base Specification for specification of the correct
-// semantics for these functions.
-// (http://www.opengroup.org/onlinepubs/000095399/)
-
-#ifndef V8_BASE_WIN32_MATH_H_
-#define V8_BASE_WIN32_MATH_H_
-
-#ifndef _MSC_VER
-#error Wrong environment, expected MSVC.
-#endif // _MSC_VER
-
-// MSVC 2013+ provides implementations of all standard math functions.
-#if (_MSC_VER < 1800)
-enum {
- FP_NAN,
- FP_INFINITE,
- FP_ZERO,
- FP_SUBNORMAL,
- FP_NORMAL
-};
-
-
-namespace std {
-
-int isfinite(double x);
-int isinf(double x);
-int isnan(double x);
-int isless(double x, double y);
-int isgreater(double x, double y);
-int fpclassify(double x);
-int signbit(double x);
-
-} // namespace std
-
-#endif // _MSC_VER < 1800
-
-#endif // V8_BASE_WIN32_MATH_H_
#include "src/unicode.h"
#include "src/utils.h"
-#if V8_LIBC_MSVCRT && (_MSC_VER < 1800)
-namespace std {
-
-// Usually defined in math.h, but not in MSVC until VS2013+.
-// Abstracted to work
-int isfinite(double value);
-
-} // namespace std
-#endif
-
namespace v8 {
namespace internal {
// Floor(-0.0) == 0.0
inline double Floor(double x) {
-#ifdef _MSC_VER
+#if V8_CC_MSVC
if (x == 0) return x; // Fix for issue 3477.
#endif
return std::floor(x);
#include "test/cctest/profiler-extension.h"
#include "test/cctest/trace-extension.h"
-#if (defined(_WIN32) || defined(_WIN64))
+#if V8_OS_WIN
#include <windows.h> // NOLINT
-#if defined(_MSC_VER)
+#if V8_CC_MSVC
#include <crtdbg.h>
-#endif // defined(_MSC_VER)
-#endif // defined(_WIN32) || defined(_WIN64)
+#endif
+#endif
enum InitializationState {kUnset, kUnintialized, kInitialized};
static InitializationState initialization_state_ = kUnset;
int main(int argc, char* argv[]) {
-#if (defined(_WIN32) || defined(_WIN64))
+#if V8_OS_WIN
UINT new_flags =
SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX;
UINT existing_flags = SetErrorMode(new_flags);
SetErrorMode(existing_flags | new_flags);
-#if defined(_MSC_VER)
+#if V8_CC_MSVC
_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE);
_CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
_CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE);
_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE);
_CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);
_set_error_mode(_OUT_TO_STDERR);
-#endif // _MSC_VER
-#endif // defined(_WIN32) || defined(_WIN64)
+#endif // V8_CC_MSVC
+#endif // V8_OS_WIN
v8::V8::InitializeICU();
v8::Platform* platform = v8::platform::CreateDefaultPlatform();
static void CFuncDoTrace(byte dummy_parameter) {
Address fp;
-#ifdef __GNUC__
+#if V8_HAS_BUILTIN_FRAME_ADDRESS
fp = reinterpret_cast<Address>(__builtin_frame_address(0));
-#elif defined _MSC_VER
+#elif V8_CC_MSVC
// Approximate a frame pointer address. We compile without base pointers,
// so we can't trust ebp/rbp.
fp = &dummy_parameter - 2 * sizeof(void*); // NOLINT
name.Dispose();
int new_size, pointer_size, data_size, code_size, map_size, cell_size,
property_cell_size, lo_size;
-#ifdef _MSC_VER
+#if V8_CC_MSVC
// Avoid warning about unsafe fscanf from MSVC.
// Please note that this is only fine if %c and %s are not being used.
#define fscanf fscanf_s
CHECK_EQ(1, fscanf(fp, "cell %d\n", &cell_size));
CHECK_EQ(1, fscanf(fp, "property cell %d\n", &property_cell_size));
CHECK_EQ(1, fscanf(fp, "lo %d\n", &lo_size));
-#ifdef _MSC_VER
+#if V8_CC_MSVC
#undef fscanf
#endif
fclose(fp);
'sources': [
'../../src/base/platform/platform-win32.cc',
'../../src/base/win32-headers.h',
- '../../src/base/win32-math.cc',
- '../../src/base/win32-math.h'
],
}],
],
'sources': [
'../../src/base/platform/platform-win32.cc',
'../../src/base/win32-headers.h',
- '../../src/base/win32-math.cc',
- '../../src/base/win32-math.h'
],
'msvs_disabled_warnings': [4351, 4355, 4800],
'link_settings': {