From be986094a3807371506ac3255e6a54b74253a143 Mon Sep 17 00:00:00 2001 From: "bmeurer@chromium.org" Date: Tue, 14 Jan 2014 09:57:05 +0000 Subject: [PATCH] Use std:: on symbols declared in C++-style C headers. Some libraries (e.g. Dinkumware) perform strict checks on whether the symbols defined in classic C library headers (e.g. ), or in C++-style C library headers (e.g. ) are used correctly (respectively, in the global namespace, or in namespace std). BUG= R=danno@chromium.org Review URL: https://codereview.chromium.org/121303005 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@18578 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/arm/codegen-arm.cc | 4 ++-- src/arm/simulator-arm.cc | 11 ++++++----- src/assembler.cc | 16 ++++++++++------ src/bignum-dtoa.cc | 3 ++- src/cached-powers.cc | 2 +- src/conversions-inl.h | 4 ++-- src/conversions.cc | 8 ++++---- src/cpu.cc | 10 +++++----- src/d8-readline.cc | 2 +- src/heap-inl.h | 2 ++ src/hydrogen-instructions.cc | 6 +++--- src/ia32/codegen-ia32.cc | 8 ++++---- src/ia32/lithium-codegen-ia32.cc | 6 +++--- src/mark-compact.cc | 2 +- src/mips/codegen-mips.cc | 4 ++-- src/mips/simulator-mips.cc | 18 ++++++++++-------- src/platform-cygwin.cc | 2 +- src/platform-freebsd.cc | 2 +- src/platform-linux.cc | 2 +- src/platform-macos.cc | 2 +- src/platform-openbsd.cc | 2 +- src/platform-posix.cc | 4 ++-- src/platform-solaris.cc | 2 +- src/platform.h | 3 +-- src/platform/condition-variable.cc | 4 ++-- src/platform/mutex.cc | 2 +- src/platform/semaphore.cc | 2 +- src/platform/socket.cc | 2 +- src/platform/time.cc | 2 +- src/platform/time.h | 2 +- src/runtime.cc | 16 ++++++++-------- src/utils.h | 2 +- src/utils/random-number-generator.cc | 4 ++-- src/x64/codegen-x64.cc | 6 +++--- src/x64/lithium-codegen-x64.cc | 6 +++--- test/cctest/test-api.cc | 2 +- test/cctest/test-log.cc | 2 +- test/cctest/test-time.cc | 2 -- 38 files changed, 93 insertions(+), 86 deletions(-) diff --git a/src/arm/codegen-arm.cc b/src/arm/codegen-arm.cc index c850742..0b268e7 100644 --- a/src/arm/codegen-arm.cc +++ b/src/arm/codegen-arm.cc @@ -50,10 +50,10 @@ double fast_exp_simulator(double x) { UnaryMathFunction CreateExpFunction() { - if (!FLAG_fast_math) return &exp; + if (!FLAG_fast_math) return &std::exp; size_t actual_size; byte* buffer = static_cast(OS::Allocate(1 * KB, &actual_size, true)); - if (buffer == NULL) return &exp; + if (buffer == NULL) return &std::exp; ExternalReference::InitializeMathExpData(); MacroAssembler masm(NULL, buffer, static_cast(actual_size)); diff --git a/src/arm/simulator-arm.cc b/src/arm/simulator-arm.cc index 131a1bb..6e7c0e6 100644 --- a/src/arm/simulator-arm.cc +++ b/src/arm/simulator-arm.cc @@ -25,9 +25,10 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#include #include #include -#include + #include "v8.h" #if V8_TARGET_ARCH_ARM @@ -2909,7 +2910,7 @@ void Simulator::DecodeTypeVFP(Instruction* instr) { } else if ((instr->Opc2Value() == 0x0) && (instr->Opc3Value() == 0x3)) { // vabs double dm_value = get_double_from_d_register(vm); - double dd_value = fabs(dm_value); + double dd_value = std::fabs(dm_value); dd_value = canonicalizeNaN(dd_value); set_d_register_from_double(vd, dd_value); } else if ((instr->Opc2Value() == 0x1) && (instr->Opc3Value() == 0x1)) { @@ -2938,7 +2939,7 @@ void Simulator::DecodeTypeVFP(Instruction* instr) { } else if (((instr->Opc2Value() == 0x1)) && (instr->Opc3Value() == 0x3)) { // vsqrt double dm_value = get_double_from_d_register(vm); - double dd_value = sqrt(dm_value); + double dd_value = std::sqrt(dm_value); dd_value = canonicalizeNaN(dd_value); set_d_register_from_double(vd, dd_value); } else if (instr->Opc3Value() == 0x0) { @@ -3274,8 +3275,8 @@ void Simulator::DecodeVCVTBetweenFloatingPointAndInteger(Instruction* instr) { inv_op_vfp_flag_ = get_inv_op_vfp_flag(mode, val, unsigned_integer); double abs_diff = - unsigned_integer ? fabs(val - static_cast(temp)) - : fabs(val - temp); + unsigned_integer ? std::fabs(val - static_cast(temp)) + : std::fabs(val - temp); inexact_vfp_flag_ = (abs_diff != 0); diff --git a/src/assembler.cc b/src/assembler.cc index d0e9669..436d035 100644 --- a/src/assembler.cc +++ b/src/assembler.cc @@ -935,7 +935,7 @@ void ExternalReference::InitializeMathExpData() { // The rest is black magic. Do not attempt to understand it. It is // loosely based on the "expd" function published at: // http://herumi.blogspot.com/2011/08/fast-double-precision-exponential.html - const double constant3 = (1 << kTableSizeBits) / log(2.0); + const double constant3 = (1 << kTableSizeBits) / std::log(2.0); math_exp_constants_array[3] = constant3; math_exp_constants_array[4] = static_cast(static_cast(3) << 51); @@ -946,7 +946,7 @@ void ExternalReference::InitializeMathExpData() { math_exp_log_table_array = new double[kTableSize]; for (int i = 0; i < kTableSize; i++) { - double value = pow(2, i / kTableSizeDouble); + double value = std::pow(2, i / kTableSizeDouble); uint64_t bits = BitCast(value); bits &= (static_cast(1) << 52) - 1; double mantissa = BitCast(bits); @@ -1389,7 +1389,7 @@ ExternalReference ExternalReference::math_log_double_function( Isolate* isolate) { typedef double (*d2d)(double x); return ExternalReference(Redirect(isolate, - FUNCTION_ADDR(static_cast(log)), + FUNCTION_ADDR(static_cast(std::log)), BUILTIN_FP_CALL)); } @@ -1460,12 +1460,16 @@ double power_double_double(double x, double y) { // special cases that are different. if ((x == 0.0 || std::isinf(x)) && std::isfinite(y)) { double f; - if (modf(y, &f) != 0.0) return ((x == 0.0) ^ (y > 0)) ? V8_INFINITY : 0; + if (std::modf(y, &f) != 0.0) { + return ((x == 0.0) ^ (y > 0)) ? V8_INFINITY : 0; + } } if (x == 2.0) { int y_int = static_cast(y); - if (y == y_int) return ldexp(1.0, y_int); + if (y == y_int) { + return std::ldexp(1.0, y_int); + } } #endif @@ -1474,7 +1478,7 @@ double power_double_double(double x, double y) { if (std::isnan(y) || ((x == 1 || x == -1) && std::isinf(y))) { return OS::nan_value(); } - return pow(x, y); + return std::pow(x, y); } diff --git a/src/bignum-dtoa.cc b/src/bignum-dtoa.cc index c5ad442..2b91122 100644 --- a/src/bignum-dtoa.cc +++ b/src/bignum-dtoa.cc @@ -394,7 +394,8 @@ static int EstimatePower(int exponent) { // For doubles len(f) == 53 (don't forget the hidden bit). const int kSignificandSize = 53; - double estimate = ceil((exponent + kSignificandSize - 1) * k1Log10 - 1e-10); + double estimate = + std::ceil((exponent + kSignificandSize - 1) * k1Log10 - 1e-10); return static_cast(estimate); } diff --git a/src/cached-powers.cc b/src/cached-powers.cc index 9e2919b..faa26cd 100644 --- a/src/cached-powers.cc +++ b/src/cached-powers.cc @@ -152,7 +152,7 @@ void PowersOfTenCache::GetCachedPowerForBinaryExponentRange( int kQ = DiyFp::kSignificandSize; // Some platforms return incorrect sign on 0 result. We can ignore that here, // which means we can avoid depending on platform.h. - double k = ceil((min_exponent + kQ - 1) * kD_1_LOG2_10); + double k = std::ceil((min_exponent + kQ - 1) * kD_1_LOG2_10); int foo = kCachedPowersOffset; int index = (foo + static_cast(k) - 1) / kDecimalExponentDistance + 1; diff --git a/src/conversions-inl.h b/src/conversions-inl.h index 7ba19ba..3cb7ef2 100644 --- a/src/conversions-inl.h +++ b/src/conversions-inl.h @@ -88,7 +88,7 @@ inline unsigned int FastD2UI(double x) { inline double DoubleToInteger(double x) { if (std::isnan(x)) return 0; if (!std::isfinite(x) || x == 0) return x; - return (x >= 0) ? floor(x) : ceil(x); + return (x >= 0) ? std::floor(x) : std::ceil(x); } @@ -233,7 +233,7 @@ double InternalStringToIntDouble(UnicodeCache* unicode_cache, } ASSERT(number != 0); - return ldexp(static_cast(negative ? -number : number), exponent); + return std::ldexp(static_cast(negative ? -number : number), exponent); } diff --git a/src/conversions.cc b/src/conversions.cc index 397f3c5..9c52d41 100644 --- a/src/conversions.cc +++ b/src/conversions.cc @@ -394,14 +394,14 @@ char* DoubleToRadixCString(double value, int radix) { if (is_negative) value = -value; // Get the integer part and the decimal part. - double integer_part = floor(value); + double integer_part = std::floor(value); double decimal_part = value - integer_part; // Convert the integer part starting from the back. Always generate // at least one digit. int integer_pos = kBufferSize - 2; do { - double remainder = fmod(integer_part, radix); + double remainder = std::fmod(integer_part, radix); integer_buffer[integer_pos--] = chars[static_cast(remainder)]; integer_part -= remainder; integer_part /= radix; @@ -424,8 +424,8 @@ char* DoubleToRadixCString(double value, int radix) { while ((decimal_part > 0.0) && (decimal_pos < kBufferSize - 1)) { decimal_part *= radix; decimal_buffer[decimal_pos++] = - chars[static_cast(floor(decimal_part))]; - decimal_part -= floor(decimal_part); + chars[static_cast(std::floor(decimal_part))]; + decimal_part -= std::floor(decimal_part); } decimal_buffer[decimal_pos] = '\0'; diff --git a/src/cpu.cc b/src/cpu.cc index 8a9aa97..3146526 100644 --- a/src/cpu.cc +++ b/src/cpu.cc @@ -37,12 +37,12 @@ #include // cpuinfo #endif +#include +#include +#include +#include +#include #include -#include -#include -#include -#include -#include #include "checks.h" #if V8_OS_WIN diff --git a/src/d8-readline.cc b/src/d8-readline.cc index 42cb0c5..57b63bf 100644 --- a/src/d8-readline.cc +++ b/src/d8-readline.cc @@ -25,7 +25,7 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#include // NOLINT +#include // NOLINT #include // NOLINT #include // NOLINT #include // NOLINT diff --git a/src/heap-inl.h b/src/heap-inl.h index f70b6f7..fedf450 100644 --- a/src/heap-inl.h +++ b/src/heap-inl.h @@ -28,6 +28,8 @@ #ifndef V8_HEAP_INL_H_ #define V8_HEAP_INL_H_ +#include + #include "heap.h" #include "isolate.h" #include "list-inl.h" diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc index 4e614d8..2060d2e 100644 --- a/src/hydrogen-instructions.cc +++ b/src/hydrogen-instructions.cc @@ -3898,7 +3898,7 @@ HInstruction* HUnaryMathOperation::New( case kMathExp: return H_CONSTANT_DOUBLE(fast_exp(d)); case kMathLog: - return H_CONSTANT_DOUBLE(log(d)); + return H_CONSTANT_DOUBLE(std::log(d)); case kMathSqrt: return H_CONSTANT_DOUBLE(fast_sqrt(d)); case kMathPowHalf: @@ -3911,9 +3911,9 @@ HInstruction* HUnaryMathOperation::New( // Doubles are represented as Significant * 2 ^ Exponent. If the // Exponent is not negative, the double value is already an integer. if (Double(d).Exponent() >= 0) return H_CONSTANT_DOUBLE(d); - return H_CONSTANT_DOUBLE(floor(d + 0.5)); + return H_CONSTANT_DOUBLE(std::floor(d + 0.5)); case kMathFloor: - return H_CONSTANT_DOUBLE(floor(d)); + return H_CONSTANT_DOUBLE(std::floor(d)); default: UNREACHABLE(); break; diff --git a/src/ia32/codegen-ia32.cc b/src/ia32/codegen-ia32.cc index 99dbe20..350a8fb 100644 --- a/src/ia32/codegen-ia32.cc +++ b/src/ia32/codegen-ia32.cc @@ -58,11 +58,11 @@ void StubRuntimeCallHelper::AfterCall(MacroAssembler* masm) const { UnaryMathFunction CreateExpFunction() { - if (!CpuFeatures::IsSupported(SSE2)) return &exp; - if (!FLAG_fast_math) return &exp; + if (!CpuFeatures::IsSupported(SSE2)) return &std::exp; + if (!FLAG_fast_math) return &std::exp; size_t actual_size; byte* buffer = static_cast(OS::Allocate(1 * KB, &actual_size, true)); - if (buffer == NULL) return &exp; + if (buffer == NULL) return &std::exp; ExternalReference::InitializeMathExpData(); MacroAssembler masm(NULL, buffer, static_cast(actual_size)); @@ -103,7 +103,7 @@ UnaryMathFunction CreateSqrtFunction() { true)); // If SSE2 is not available, we can use libc's implementation to ensure // consistency since code by fullcodegen's calls into runtime in that case. - if (buffer == NULL || !CpuFeatures::IsSupported(SSE2)) return &sqrt; + if (buffer == NULL || !CpuFeatures::IsSupported(SSE2)) return &std::sqrt; MacroAssembler masm(NULL, buffer, static_cast(actual_size)); // esp[1 * kPointerSize]: raw double input // esp[0 * kPointerSize]: return address diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc index 2a217c3..fa29a67 100644 --- a/src/ia32/lithium-codegen-ia32.cc +++ b/src/ia32/lithium-codegen-ia32.cc @@ -1615,10 +1615,10 @@ void LCodeGen::DoMathFloorOfDiv(LMathFloorOfDiv* instr) { double multiplier_f = static_cast(static_cast(1) << shift) / divisor_abs; int64_t multiplier; - if (multiplier_f - floor(multiplier_f) < 0.5) { - multiplier = static_cast(floor(multiplier_f)); + if (multiplier_f - std::floor(multiplier_f) < 0.5) { + multiplier = static_cast(std::floor(multiplier_f)); } else { - multiplier = static_cast(floor(multiplier_f)) + 1; + multiplier = static_cast(std::floor(multiplier_f)) + 1; } // The multiplier is a uint32. ASSERT(multiplier > 0 && diff --git a/src/mark-compact.cc b/src/mark-compact.cc index 0594c07..db28ac3 100644 --- a/src/mark-compact.cc +++ b/src/mark-compact.cc @@ -726,7 +726,7 @@ void MarkCompactCollector::CollectEvacuationCandidates(PagedSpace* space) { static const int kMaxMaxEvacuationCandidates = 1000; int number_of_pages = space->CountTotalPages(); int max_evacuation_candidates = - static_cast(sqrt(number_of_pages / 2.0) + 1); + static_cast(std::sqrt(number_of_pages / 2.0) + 1); if (FLAG_stress_compaction || FLAG_always_compact) { max_evacuation_candidates = kMaxMaxEvacuationCandidates; diff --git a/src/mips/codegen-mips.cc b/src/mips/codegen-mips.cc index 0dd42d6..ff5658a 100644 --- a/src/mips/codegen-mips.cc +++ b/src/mips/codegen-mips.cc @@ -50,10 +50,10 @@ double fast_exp_simulator(double x) { UnaryMathFunction CreateExpFunction() { - if (!FLAG_fast_math) return &exp; + if (!FLAG_fast_math) return &std::exp; size_t actual_size; byte* buffer = static_cast(OS::Allocate(1 * KB, &actual_size, true)); - if (buffer == NULL) return &exp; + if (buffer == NULL) return &std::exp; ExternalReference::InitializeMathExpData(); MacroAssembler masm(NULL, buffer, static_cast(actual_size)); diff --git a/src/mips/simulator-mips.cc b/src/mips/simulator-mips.cc index acc6525..b7e53c9 100644 --- a/src/mips/simulator-mips.cc +++ b/src/mips/simulator-mips.cc @@ -25,10 +25,11 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#include #include +#include +#include #include -#include + #include "v8.h" #if V8_TARGET_ARCH_MIPS @@ -2115,7 +2116,7 @@ void Simulator::DecodeTypeRegister(Instruction* instr) { // In rounding mode 0 it should behave like ROUND. case ROUND_W_D: // Round double to word (round half to even). { - double rounded = floor(fs + 0.5); + double rounded = std::floor(fs + 0.5); int32_t result = static_cast(rounded); if ((result & 1) != 0 && result - fs == 0.5) { // If the number is halfway between two integers, @@ -2140,7 +2141,7 @@ void Simulator::DecodeTypeRegister(Instruction* instr) { break; case FLOOR_W_D: // Round double to word towards negative infinity. { - double rounded = floor(fs); + double rounded = std::floor(fs); int32_t result = static_cast(rounded); set_fpu_register(fd_reg, result); if (set_fcsr_round_error(fs, rounded)) { @@ -2150,7 +2151,7 @@ void Simulator::DecodeTypeRegister(Instruction* instr) { break; case CEIL_W_D: // Round double to word towards positive infinity. { - double rounded = ceil(fs); + double rounded = std::ceil(fs); int32_t result = static_cast(rounded); set_fpu_register(fd_reg, result); if (set_fcsr_round_error(fs, rounded)) { @@ -2176,19 +2177,20 @@ void Simulator::DecodeTypeRegister(Instruction* instr) { break; } case ROUND_L_D: { // Mips32r2 instruction. - double rounded = fs > 0 ? floor(fs + 0.5) : ceil(fs - 0.5); + double rounded = + fs > 0 ? std::floor(fs + 0.5) : std::ceil(fs - 0.5); i64 = static_cast(rounded); set_fpu_register(fd_reg, i64 & 0xffffffff); set_fpu_register(fd_reg + 1, i64 >> 32); break; } case FLOOR_L_D: // Mips32r2 instruction. - i64 = static_cast(floor(fs)); + i64 = static_cast(std::floor(fs)); set_fpu_register(fd_reg, i64 & 0xffffffff); set_fpu_register(fd_reg + 1, i64 >> 32); break; case CEIL_L_D: // Mips32r2 instruction. - i64 = static_cast(ceil(fs)); + i64 = static_cast(std::ceil(fs)); set_fpu_register(fd_reg, i64 & 0xffffffff); set_fpu_register(fd_reg + 1, i64 >> 32); break; diff --git a/src/platform-cygwin.cc b/src/platform-cygwin.cc index 0076d56..6dd04dd 100644 --- a/src/platform-cygwin.cc +++ b/src/platform-cygwin.cc @@ -53,7 +53,7 @@ namespace internal { const char* OS::LocalTimezone(double time) { if (std::isnan(time)) return ""; - time_t tv = static_cast(floor(time/msPerSecond)); + time_t tv = static_cast(std::floor(time/msPerSecond)); struct tm* t = localtime(&tv); if (NULL == t) return ""; return tzname[0]; // The location of the timezone string on Cygwin. diff --git a/src/platform-freebsd.cc b/src/platform-freebsd.cc index 75d88ec..6980a6e 100644 --- a/src/platform-freebsd.cc +++ b/src/platform-freebsd.cc @@ -63,7 +63,7 @@ namespace internal { const char* OS::LocalTimezone(double time) { if (std::isnan(time)) return ""; - time_t tv = static_cast(floor(time/msPerSecond)); + time_t tv = static_cast(std::floor(time/msPerSecond)); struct tm* t = localtime(&tv); if (NULL == t) return ""; return t->tm_zone; diff --git a/src/platform-linux.cc b/src/platform-linux.cc index eb2d10b..0f1481b 100644 --- a/src/platform-linux.cc +++ b/src/platform-linux.cc @@ -115,7 +115,7 @@ bool OS::ArmUsingHardFloat() { const char* OS::LocalTimezone(double time) { if (std::isnan(time)) return ""; - time_t tv = static_cast(floor(time/msPerSecond)); + time_t tv = static_cast(std::floor(time/msPerSecond)); struct tm* t = localtime(&tv); if (NULL == t) return ""; return t->tm_zone; diff --git a/src/platform-macos.cc b/src/platform-macos.cc index 5ffc3fc..c5e4cbe 100644 --- a/src/platform-macos.cc +++ b/src/platform-macos.cc @@ -184,7 +184,7 @@ void OS::SignalCodeMovingGC() { const char* OS::LocalTimezone(double time) { if (std::isnan(time)) return ""; - time_t tv = static_cast(floor(time/msPerSecond)); + time_t tv = static_cast(std::floor(time/msPerSecond)); struct tm* t = localtime(&tv); if (NULL == t) return ""; return t->tm_zone; diff --git a/src/platform-openbsd.cc b/src/platform-openbsd.cc index 710c390..a8f91ad 100644 --- a/src/platform-openbsd.cc +++ b/src/platform-openbsd.cc @@ -61,7 +61,7 @@ namespace internal { const char* OS::LocalTimezone(double time) { if (std::isnan(time)) return ""; - time_t tv = static_cast(floor(time/msPerSecond)); + time_t tv = static_cast(std::floor(time/msPerSecond)); struct tm* t = localtime(&tv); if (NULL == t) return ""; return t->tm_zone; diff --git a/src/platform-posix.cc b/src/platform-posix.cc index b897930..3c62909 100644 --- a/src/platform-posix.cc +++ b/src/platform-posix.cc @@ -296,7 +296,7 @@ void OS::DebugBreak() { // Math functions double modulo(double x, double y) { - return fmod(x, y); + return std::fmod(x, y); } @@ -354,7 +354,7 @@ double OS::TimeCurrentMillis() { double OS::DaylightSavingsOffset(double time) { if (std::isnan(time)) return nan_value(); - time_t tv = static_cast(floor(time/msPerSecond)); + time_t tv = static_cast(std::floor(time/msPerSecond)); struct tm* t = localtime(&tv); if (NULL == t) return nan_value(); return t->tm_isdst > 0 ? 3600 * msPerSecond : 0; diff --git a/src/platform-solaris.cc b/src/platform-solaris.cc index a0590cb..5afa7c5 100644 --- a/src/platform-solaris.cc +++ b/src/platform-solaris.cc @@ -82,7 +82,7 @@ namespace internal { const char* OS::LocalTimezone(double time) { if (std::isnan(time)) return ""; - time_t tv = static_cast(floor(time/msPerSecond)); + time_t tv = static_cast(std::floor(time/msPerSecond)); struct tm* t = localtime(&tv); if (NULL == t) return ""; return tzname[0]; // The location of the timezone string on Solaris. diff --git a/src/platform.h b/src/platform.h index acb4f94..51eefc1 100644 --- a/src/platform.h +++ b/src/platform.h @@ -44,7 +44,7 @@ #ifndef V8_PLATFORM_H_ #define V8_PLATFORM_H_ -#include +#include #include "platform/mutex.h" #include "platform/semaphore.h" @@ -89,7 +89,6 @@ inline int lrint(double flt) { #endif return intgr; } - #endif // _MSC_VER < 1800 #endif // V8_CC_MSVC diff --git a/src/platform/condition-variable.cc b/src/platform/condition-variable.cc index e2bf388..83c35d4 100644 --- a/src/platform/condition-variable.cc +++ b/src/platform/condition-variable.cc @@ -27,8 +27,8 @@ #include "platform/condition-variable.h" -#include -#include +#include +#include #include "platform/time.h" diff --git a/src/platform/mutex.cc b/src/platform/mutex.cc index ad97740..ff4a8a3 100644 --- a/src/platform/mutex.cc +++ b/src/platform/mutex.cc @@ -27,7 +27,7 @@ #include "platform/mutex.h" -#include +#include namespace v8 { namespace internal { diff --git a/src/platform/semaphore.cc b/src/platform/semaphore.cc index c3e5826..0b82d4a 100644 --- a/src/platform/semaphore.cc +++ b/src/platform/semaphore.cc @@ -32,7 +32,7 @@ #include #endif -#include +#include #include "checks.h" #include "platform/time.h" diff --git a/src/platform/socket.cc b/src/platform/socket.cc index 2fce6f2..9d56cc7 100644 --- a/src/platform/socket.cc +++ b/src/platform/socket.cc @@ -37,7 +37,7 @@ #include #endif -#include +#include #include "checks.h" #include "once.h" diff --git a/src/platform/time.cc b/src/platform/time.cc index de0ca16..5374af8 100644 --- a/src/platform/time.cc +++ b/src/platform/time.cc @@ -34,7 +34,7 @@ #include #endif -#include +#include #include "checks.h" #include "cpu.h" diff --git a/src/platform/time.h b/src/platform/time.h index 877e020..99a8d39 100644 --- a/src/platform/time.h +++ b/src/platform/time.h @@ -28,7 +28,7 @@ #ifndef V8_PLATFORM_TIME_H_ #define V8_PLATFORM_TIME_H_ -#include +#include #include #include "../allocation.h" diff --git a/src/runtime.cc b/src/runtime.cc index 7a2d46c..faf015c 100644 --- a/src/runtime.cc +++ b/src/runtime.cc @@ -7673,7 +7673,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_acos) { isolate->counters()->math_acos()->Increment(); CONVERT_DOUBLE_ARG_CHECKED(x, 0); - return isolate->heap()->AllocateHeapNumber(acos(x)); + return isolate->heap()->AllocateHeapNumber(std::acos(x)); } @@ -7683,7 +7683,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_asin) { isolate->counters()->math_asin()->Increment(); CONVERT_DOUBLE_ARG_CHECKED(x, 0); - return isolate->heap()->AllocateHeapNumber(asin(x)); + return isolate->heap()->AllocateHeapNumber(std::asin(x)); } @@ -7693,7 +7693,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_atan) { isolate->counters()->math_atan()->Increment(); CONVERT_DOUBLE_ARG_CHECKED(x, 0); - return isolate->heap()->AllocateHeapNumber(atan(x)); + return isolate->heap()->AllocateHeapNumber(std::atan(x)); } @@ -7717,7 +7717,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_atan2) { if (y < 0) multiplier *= 3; result = multiplier * kPiDividedBy4; } else { - result = atan2(x, y); + result = std::atan2(x, y); } return isolate->heap()->AllocateHeapNumber(result); } @@ -7740,7 +7740,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_floor) { isolate->counters()->math_floor()->Increment(); CONVERT_DOUBLE_ARG_CHECKED(x, 0); - return isolate->heap()->NumberFromDouble(floor(x)); + return isolate->heap()->NumberFromDouble(std::floor(x)); } @@ -7750,7 +7750,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_log) { isolate->counters()->math_log()->Increment(); CONVERT_DOUBLE_ARG_CHECKED(x, 0); - return isolate->heap()->AllocateHeapNumber(log(x)); + return isolate->heap()->AllocateHeapNumber(std::log(x)); } @@ -7835,7 +7835,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_RoundNumber) { if (sign && value >= -0.5) return isolate->heap()->minus_zero_value(); // Do not call NumberFromDouble() to avoid extra checks. - return isolate->heap()->AllocateHeapNumber(floor(value + 0.5)); + return isolate->heap()->AllocateHeapNumber(std::floor(value + 0.5)); } @@ -9550,7 +9550,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DateCurrentTime) { // the number in a Date object representing a particular instant in // time is milliseconds. Therefore, we floor the result of getting // the OS time. - double millis = floor(OS::TimeCurrentMillis()); + double millis = std::floor(OS::TimeCurrentMillis()); return isolate->heap()->NumberFromDouble(millis); } diff --git a/src/utils.h b/src/utils.h index 14a4c56..b11d756 100644 --- a/src/utils.h +++ b/src/utils.h @@ -28,10 +28,10 @@ #ifndef V8_UTILS_H_ #define V8_UTILS_H_ +#include #include #include #include -#include #include "allocation.h" #include "checks.h" diff --git a/src/utils/random-number-generator.cc b/src/utils/random-number-generator.cc index fe27331..d40102f 100644 --- a/src/utils/random-number-generator.cc +++ b/src/utils/random-number-generator.cc @@ -27,8 +27,8 @@ #include "utils/random-number-generator.h" -#include -#include +#include +#include #include "flags.h" #include "platform/mutex.h" diff --git a/src/x64/codegen-x64.cc b/src/x64/codegen-x64.cc index d224e60..048c5f1 100644 --- a/src/x64/codegen-x64.cc +++ b/src/x64/codegen-x64.cc @@ -56,10 +56,10 @@ void StubRuntimeCallHelper::AfterCall(MacroAssembler* masm) const { UnaryMathFunction CreateExpFunction() { - if (!FLAG_fast_math) return &exp; + if (!FLAG_fast_math) return &std::exp; size_t actual_size; byte* buffer = static_cast(OS::Allocate(1 * KB, &actual_size, true)); - if (buffer == NULL) return &exp; + if (buffer == NULL) return &std::exp; ExternalReference::InitializeMathExpData(); MacroAssembler masm(NULL, buffer, static_cast(actual_size)); @@ -92,7 +92,7 @@ UnaryMathFunction CreateSqrtFunction() { byte* buffer = static_cast(OS::Allocate(1 * KB, &actual_size, true)); - if (buffer == NULL) return &sqrt; + if (buffer == NULL) return &std::sqrt; MacroAssembler masm(NULL, buffer, static_cast(actual_size)); // xmm0: raw double input. diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc index 3edea02..a7983ae 100644 --- a/src/x64/lithium-codegen-x64.cc +++ b/src/x64/lithium-codegen-x64.cc @@ -1123,10 +1123,10 @@ void LCodeGen::DoMathFloorOfDiv(LMathFloorOfDiv* instr) { double multiplier_f = static_cast(static_cast(1) << shift) / divisor_abs; int64_t multiplier; - if (multiplier_f - floor(multiplier_f) < 0.5) { - multiplier = static_cast(floor(multiplier_f)); + if (multiplier_f - std::floor(multiplier_f) < 0.5) { + multiplier = static_cast(std::floor(multiplier_f)); } else { - multiplier = static_cast(floor(multiplier_f)) + 1; + multiplier = static_cast(std::floor(multiplier_f)) + 1; } // The multiplier is a uint32. ASSERT(multiplier > 0 && diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc index 839ddd9..66ffc9a 100644 --- a/test/cctest/test-api.cc +++ b/test/cctest/test-api.cc @@ -17797,7 +17797,7 @@ static double DoubleToDateTime(double input) { if (std::isnan(input) || input < -date_limit || input > date_limit) { return i::OS::nan_value(); } - return (input < 0) ? -(floor(-input)) : floor(input); + return (input < 0) ? -(std::floor(-input)) : std::floor(input); } diff --git a/test/cctest/test-log.cc b/test/cctest/test-log.cc index d80e4e8..1146994 100644 --- a/test/cctest/test-log.cc +++ b/test/cctest/test-log.cc @@ -203,7 +203,7 @@ class LoopingNonJsThread : public LoopingThread { double i = 10; SignalRunning(); while (IsRunning()) { - i = sin(i); + i = std::sin(i); i::OS::Sleep(1); } } diff --git a/test/cctest/test-time.cc b/test/cctest/test-time.cc index f7329b5..1ef9e08 100644 --- a/test/cctest/test-time.cc +++ b/test/cctest/test-time.cc @@ -25,8 +25,6 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#include - #include "v8.h" #if V8_OS_POSIX -- 2.7.4