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. <stdio.h>), or in C++-style C library headers (e.g. <cmath>) 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
This commit is contained in:
parent
111e604e72
commit
be986094a3
@ -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<byte*>(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<int>(actual_size));
|
||||
|
@ -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 <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <cmath>
|
||||
#include <cstdarg>
|
||||
|
||||
#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<uint32_t>(temp))
|
||||
: fabs(val - temp);
|
||||
unsigned_integer ? std::fabs(val - static_cast<uint32_t>(temp))
|
||||
: std::fabs(val - temp);
|
||||
|
||||
inexact_vfp_flag_ = (abs_diff != 0);
|
||||
|
||||
|
@ -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<double>(static_cast<int64_t>(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<uint64_t, double>(value);
|
||||
bits &= (static_cast<uint64_t>(1) << 52) - 1;
|
||||
double mantissa = BitCast<double, uint64_t>(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<d2d>(log)),
|
||||
FUNCTION_ADDR(static_cast<d2d>(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<int>(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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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<int>(estimate);
|
||||
}
|
||||
|
||||
|
@ -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<int>(k) - 1) / kDecimalExponentDistance + 1;
|
||||
|
@ -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<double>(negative ? -number : number), exponent);
|
||||
return std::ldexp(static_cast<double>(negative ? -number : number), exponent);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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<int>(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<int>(floor(decimal_part))];
|
||||
decimal_part -= floor(decimal_part);
|
||||
chars[static_cast<int>(std::floor(decimal_part))];
|
||||
decimal_part -= std::floor(decimal_part);
|
||||
}
|
||||
decimal_buffer[decimal_pos] = '\0';
|
||||
|
||||
|
10
src/cpu.cc
10
src/cpu.cc
@ -37,12 +37,12 @@
|
||||
#include <sys/syspage.h> // cpuinfo
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <algorithm>
|
||||
#include <cctype>
|
||||
#include <climits>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
#include "checks.h"
|
||||
#if V8_OS_WIN
|
||||
|
@ -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 <cstdio> // NOLINT
|
||||
#include <stdio.h> // NOLINT
|
||||
#include <string.h> // NOLINT
|
||||
#include <readline/readline.h> // NOLINT
|
||||
#include <readline/history.h> // NOLINT
|
||||
|
@ -28,6 +28,8 @@
|
||||
#ifndef V8_HEAP_INL_H_
|
||||
#define V8_HEAP_INL_H_
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include "heap.h"
|
||||
#include "isolate.h"
|
||||
#include "list-inl.h"
|
||||
|
@ -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;
|
||||
|
@ -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<byte*>(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<int>(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<int>(actual_size));
|
||||
// esp[1 * kPointerSize]: raw double input
|
||||
// esp[0 * kPointerSize]: return address
|
||||
|
@ -1615,10 +1615,10 @@ void LCodeGen::DoMathFloorOfDiv(LMathFloorOfDiv* instr) {
|
||||
double multiplier_f =
|
||||
static_cast<double>(static_cast<uint64_t>(1) << shift) / divisor_abs;
|
||||
int64_t multiplier;
|
||||
if (multiplier_f - floor(multiplier_f) < 0.5) {
|
||||
multiplier = static_cast<int64_t>(floor(multiplier_f));
|
||||
if (multiplier_f - std::floor(multiplier_f) < 0.5) {
|
||||
multiplier = static_cast<int64_t>(std::floor(multiplier_f));
|
||||
} else {
|
||||
multiplier = static_cast<int64_t>(floor(multiplier_f)) + 1;
|
||||
multiplier = static_cast<int64_t>(std::floor(multiplier_f)) + 1;
|
||||
}
|
||||
// The multiplier is a uint32.
|
||||
ASSERT(multiplier > 0 &&
|
||||
|
@ -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<int>(sqrt(number_of_pages / 2.0) + 1);
|
||||
static_cast<int>(std::sqrt(number_of_pages / 2.0) + 1);
|
||||
|
||||
if (FLAG_stress_compaction || FLAG_always_compact) {
|
||||
max_evacuation_candidates = kMaxMaxEvacuationCandidates;
|
||||
|
@ -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<byte*>(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<int>(actual_size));
|
||||
|
@ -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 <stdlib.h>
|
||||
#include <limits.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <cmath>
|
||||
#include <cstdarg>
|
||||
|
||||
#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<int32_t>(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<int32_t>(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<int32_t>(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<int64_t>(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<int64_t>(floor(fs));
|
||||
i64 = static_cast<int64_t>(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<int64_t>(ceil(fs));
|
||||
i64 = static_cast<int64_t>(std::ceil(fs));
|
||||
set_fpu_register(fd_reg, i64 & 0xffffffff);
|
||||
set_fpu_register(fd_reg + 1, i64 >> 32);
|
||||
break;
|
||||
|
@ -53,7 +53,7 @@ namespace internal {
|
||||
|
||||
const char* OS::LocalTimezone(double time) {
|
||||
if (std::isnan(time)) return "";
|
||||
time_t tv = static_cast<time_t>(floor(time/msPerSecond));
|
||||
time_t tv = static_cast<time_t>(std::floor(time/msPerSecond));
|
||||
struct tm* t = localtime(&tv);
|
||||
if (NULL == t) return "";
|
||||
return tzname[0]; // The location of the timezone string on Cygwin.
|
||||
|
@ -63,7 +63,7 @@ namespace internal {
|
||||
|
||||
const char* OS::LocalTimezone(double time) {
|
||||
if (std::isnan(time)) return "";
|
||||
time_t tv = static_cast<time_t>(floor(time/msPerSecond));
|
||||
time_t tv = static_cast<time_t>(std::floor(time/msPerSecond));
|
||||
struct tm* t = localtime(&tv);
|
||||
if (NULL == t) return "";
|
||||
return t->tm_zone;
|
||||
|
@ -115,7 +115,7 @@ bool OS::ArmUsingHardFloat() {
|
||||
|
||||
const char* OS::LocalTimezone(double time) {
|
||||
if (std::isnan(time)) return "";
|
||||
time_t tv = static_cast<time_t>(floor(time/msPerSecond));
|
||||
time_t tv = static_cast<time_t>(std::floor(time/msPerSecond));
|
||||
struct tm* t = localtime(&tv);
|
||||
if (NULL == t) return "";
|
||||
return t->tm_zone;
|
||||
|
@ -184,7 +184,7 @@ void OS::SignalCodeMovingGC() {
|
||||
|
||||
const char* OS::LocalTimezone(double time) {
|
||||
if (std::isnan(time)) return "";
|
||||
time_t tv = static_cast<time_t>(floor(time/msPerSecond));
|
||||
time_t tv = static_cast<time_t>(std::floor(time/msPerSecond));
|
||||
struct tm* t = localtime(&tv);
|
||||
if (NULL == t) return "";
|
||||
return t->tm_zone;
|
||||
|
@ -61,7 +61,7 @@ namespace internal {
|
||||
|
||||
const char* OS::LocalTimezone(double time) {
|
||||
if (std::isnan(time)) return "";
|
||||
time_t tv = static_cast<time_t>(floor(time/msPerSecond));
|
||||
time_t tv = static_cast<time_t>(std::floor(time/msPerSecond));
|
||||
struct tm* t = localtime(&tv);
|
||||
if (NULL == t) return "";
|
||||
return t->tm_zone;
|
||||
|
@ -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<time_t>(floor(time/msPerSecond));
|
||||
time_t tv = static_cast<time_t>(std::floor(time/msPerSecond));
|
||||
struct tm* t = localtime(&tv);
|
||||
if (NULL == t) return nan_value();
|
||||
return t->tm_isdst > 0 ? 3600 * msPerSecond : 0;
|
||||
|
@ -82,7 +82,7 @@ namespace internal {
|
||||
|
||||
const char* OS::LocalTimezone(double time) {
|
||||
if (std::isnan(time)) return "";
|
||||
time_t tv = static_cast<time_t>(floor(time/msPerSecond));
|
||||
time_t tv = static_cast<time_t>(std::floor(time/msPerSecond));
|
||||
struct tm* t = localtime(&tv);
|
||||
if (NULL == t) return "";
|
||||
return tzname[0]; // The location of the timezone string on Solaris.
|
||||
|
@ -44,7 +44,7 @@
|
||||
#ifndef V8_PLATFORM_H_
|
||||
#define V8_PLATFORM_H_
|
||||
|
||||
#include <cstdarg>
|
||||
#include <stdarg.h>
|
||||
|
||||
#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
|
||||
|
@ -27,8 +27,8 @@
|
||||
|
||||
#include "platform/condition-variable.h"
|
||||
|
||||
#include <cerrno>
|
||||
#include <ctime>
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "platform/time.h"
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
#include "platform/mutex.h"
|
||||
|
||||
#include <cerrno>
|
||||
#include <errno.h>
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
@ -32,7 +32,7 @@
|
||||
#include <mach/task.h>
|
||||
#endif
|
||||
|
||||
#include <cerrno>
|
||||
#include <errno.h>
|
||||
|
||||
#include "checks.h"
|
||||
#include "platform/time.h"
|
||||
|
@ -37,7 +37,7 @@
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <cerrno>
|
||||
#include <errno.h>
|
||||
|
||||
#include "checks.h"
|
||||
#include "once.h"
|
||||
|
@ -34,7 +34,7 @@
|
||||
#include <mach/mach_time.h>
|
||||
#endif
|
||||
|
||||
#include <cstring>
|
||||
#include <string.h>
|
||||
|
||||
#include "checks.h"
|
||||
#include "cpu.h"
|
||||
|
@ -28,7 +28,7 @@
|
||||
#ifndef V8_PLATFORM_TIME_H_
|
||||
#define V8_PLATFORM_TIME_H_
|
||||
|
||||
#include <ctime>
|
||||
#include <time.h>
|
||||
#include <limits>
|
||||
|
||||
#include "../allocation.h"
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -28,10 +28,10 @@
|
||||
#ifndef V8_UTILS_H_
|
||||
#define V8_UTILS_H_
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <algorithm>
|
||||
#include <climits>
|
||||
|
||||
#include "allocation.h"
|
||||
#include "checks.h"
|
||||
|
@ -27,8 +27,8 @@
|
||||
|
||||
#include "utils/random-number-generator.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "flags.h"
|
||||
#include "platform/mutex.h"
|
||||
|
@ -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<byte*>(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<int>(actual_size));
|
||||
@ -92,7 +92,7 @@ UnaryMathFunction CreateSqrtFunction() {
|
||||
byte* buffer = static_cast<byte*>(OS::Allocate(1 * KB,
|
||||
&actual_size,
|
||||
true));
|
||||
if (buffer == NULL) return &sqrt;
|
||||
if (buffer == NULL) return &std::sqrt;
|
||||
|
||||
MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size));
|
||||
// xmm0: raw double input.
|
||||
|
@ -1123,10 +1123,10 @@ void LCodeGen::DoMathFloorOfDiv(LMathFloorOfDiv* instr) {
|
||||
double multiplier_f =
|
||||
static_cast<double>(static_cast<uint64_t>(1) << shift) / divisor_abs;
|
||||
int64_t multiplier;
|
||||
if (multiplier_f - floor(multiplier_f) < 0.5) {
|
||||
multiplier = static_cast<int64_t>(floor(multiplier_f));
|
||||
if (multiplier_f - std::floor(multiplier_f) < 0.5) {
|
||||
multiplier = static_cast<int64_t>(std::floor(multiplier_f));
|
||||
} else {
|
||||
multiplier = static_cast<int64_t>(floor(multiplier_f)) + 1;
|
||||
multiplier = static_cast<int64_t>(std::floor(multiplier_f)) + 1;
|
||||
}
|
||||
// The multiplier is a uint32.
|
||||
ASSERT(multiplier > 0 &&
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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 <cstdlib>
|
||||
|
||||
#include "v8.h"
|
||||
|
||||
#if V8_OS_POSIX
|
||||
|
Loading…
Reference in New Issue
Block a user