From: dslomov@chromium.org Date: Tue, 17 Sep 2013 15:26:18 +0000 (+0000) Subject: Make v8 compile on VS2013. X-Git-Tag: upstream/4.7.83~12450 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9f5edd1bb265caec431be71eebb0edde3980bc7a;p=platform%2Fupstream%2Fv8.git Make v8 compile on VS2013. VS2013 contains a number of improvements, most notably the addition of all C99 math functions. I'm a little bit concerned about the change I had to make in cpu-profiler.cc, but I spent quite a bit of time looking at it and was unable to figure out any rational explanation for the warning. It's possible it's spurious. Since it seems like a useful warning in general though, I chose not to disable globally at the gyp level. I do think someone with expertise here should probably try to determine if this is a legitimate warning. BUG=288948 R=dslomov@chromium.org Review URL: https://codereview.chromium.org/23449035 Patch from Zach Turner . git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16775 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/src/cpu-profiler.cc b/src/cpu-profiler.cc index e0f7aea..3d9dc67 100644 --- a/src/cpu-profiler.cc +++ b/src/cpu-profiler.cc @@ -435,8 +435,18 @@ void CpuProfiler::StartProcessorIfNotStarted() { logger->is_logging_ = false; generator_ = new ProfileGenerator(profiles_); Sampler* sampler = logger->sampler(); +#if V8_CC_MSVC && (_MSC_VER >= 1800) + // VS2013 reports "warning C4316: 'v8::internal::ProfilerEventsProcessor' + // : object allocated on the heap may not be aligned 64". We need to + // figure out if this is a legitimate warning or a compiler bug. + #pragma warning(push) + #pragma warning(disable:4316) +#endif processor_ = new ProfilerEventsProcessor( generator_, sampler, sampling_interval_); +#if V8_CC_MSVC && (_MSC_VER >= 1800) + #pragma warning(pop) +#endif is_profiling_ = true; // Enumerate stuff we already have in the heap. ASSERT(isolate_->heap()->HasBeenSetUp()); diff --git a/src/platform.h b/src/platform.h index aa50cb4..e0e62fa 100644 --- a/src/platform.h +++ b/src/platform.h @@ -67,6 +67,8 @@ int signbit(double x); 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 @@ -84,6 +86,8 @@ inline int lrint(double flt) { return intgr; } +#endif // _MSC_VER < 1800 + #endif // V8_CC_MSVC namespace v8 { diff --git a/src/preparser.cc b/src/preparser.cc index 36a94a3..2486632 100644 --- a/src/preparser.cc +++ b/src/preparser.cc @@ -42,10 +42,10 @@ #include "unicode.h" #include "utils.h" -#ifdef _MSC_VER +#if V8_CC_MSVC && (_MSC_VER < 1800) namespace std { -// Usually defined in math.h, but not in MSVC. +// Usually defined in math.h, but not in MSVC until VS2013+. // Abstracted to work int isfinite(double value); diff --git a/src/win32-math.cc b/src/win32-math.cc index 88fa3a6..8f6d077 100644 --- a/src/win32-math.cc +++ b/src/win32-math.cc @@ -29,7 +29,7 @@ // refer to The Open Group Base Specification for specification of the correct // semantics for these functions. // (http://www.opengroup.org/onlinepubs/000095399/) -#ifdef _MSC_VER +#if defined(_MSC_VER) && (_MSC_VER < 1800) #include "win32-headers.h" #include // Required for INT_MAX etc. diff --git a/src/win32-math.h b/src/win32-math.h index 0397c7e..fd9312b 100644 --- a/src/win32-math.h +++ b/src/win32-math.h @@ -37,6 +37,8 @@ #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, @@ -58,4 +60,6 @@ int signbit(double x); } // namespace std +#endif // _MSC_VER < 1800 + #endif // V8_WIN32_MATH_H_