X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fv8%2Fsrc%2Fbase%2Fplatform%2Fplatform-win32.cc;h=1c46cf6811b02eafa27979405046ffb12135dad3;hb=1afa4dd80ef85af7c90efaea6959db1d92330844;hp=10f89de68080e793bf944cffbed72ca405ad0231;hpb=90762837333c13ccf56f2ad88e4481fc71e8d281;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/v8/src/base/platform/platform-win32.cc b/src/v8/src/base/platform/platform-win32.cc index 10f89de..1c46cf6 100644 --- a/src/v8/src/base/platform/platform-win32.cc +++ b/src/v8/src/base/platform/platform-win32.cc @@ -15,9 +15,7 @@ #endif // MINGW_HAS_SECURE_API #endif // __MINGW32__ -#ifdef _MSC_VER #include -#endif #include "src/base/win32-headers.h" @@ -28,16 +26,6 @@ #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. @@ -358,41 +346,26 @@ void Win32Time::SetToCurrentTime() { } +int64_t FileTimeToInt64(FILETIME ft) { + ULARGE_INTEGER result; + result.LowPart = ft.dwLowDateTime; + result.HighPart = ft.dwHighDateTime; + return static_cast(result.QuadPart); +} + + // Return the local timezone offset in milliseconds east of UTC. This // takes into account whether daylight saving is in effect at the time. // Only times in the 32-bit Unix range may be passed to this function. // Also, adding the time-zone offset to the input must not overflow. // The function EquivalentTime() in date.js guarantees this. int64_t Win32Time::LocalOffset(TimezoneCache* cache) { - cache->InitializeIfNeeded(); - - Win32Time rounded_to_second(*this); - rounded_to_second.t() = rounded_to_second.t() / 1000 / kTimeScaler * - 1000 * kTimeScaler; - // Convert to local time using POSIX localtime function. - // Windows XP Service Pack 3 made SystemTimeToTzSpecificLocalTime() - // very slow. Other browsers use localtime(). - - // Convert from JavaScript milliseconds past 1/1/1970 0:00:00 to - // POSIX seconds past 1/1/1970 0:00:00. - double unchecked_posix_time = rounded_to_second.ToJSTime() / 1000; - if (unchecked_posix_time > INT_MAX || unchecked_posix_time < 0) { - return 0; - } - // Because _USE_32BIT_TIME_T is defined, time_t is a 32-bit int. - time_t posix_time = static_cast(unchecked_posix_time); - - // Convert to local time, as struct with fields for day, hour, year, etc. - tm posix_local_time_struct; - if (localtime_s(&posix_local_time_struct, &posix_time)) return 0; - - if (posix_local_time_struct.tm_isdst > 0) { - return (cache->tzinfo_.Bias + cache->tzinfo_.DaylightBias) * -kMsPerMinute; - } else if (posix_local_time_struct.tm_isdst == 0) { - return (cache->tzinfo_.Bias + cache->tzinfo_.StandardBias) * -kMsPerMinute; - } else { - return cache->tzinfo_.Bias * -kMsPerMinute; - } + FILETIME local; + SYSTEMTIME system_utc, system_local; + FileTimeToSystemTime(&time_.ft_, &system_utc); + SystemTimeToTzSpecificLocalTime(NULL, &system_utc, &system_local); + SystemTimeToFileTime(&system_local, &local); + return (FileTimeToInt64(local) - FileTimeToInt64(time_.ft_)) / kTimeScaler; } @@ -832,7 +805,7 @@ void OS::Abort() { 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 } @@ -1175,11 +1148,7 @@ void OS::SignalCodeMovingGC() { } double OS::nan_value() { -#ifdef _MSC_VER return std::numeric_limits::quiet_NaN(); -#else // _MSC_VER - return NAN; -#endif // _MSC_VER }