Commit 7cede115 authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[cleanup] Replace V8_INT64_C macro by proper C++11 syntax

Some uses use uint64_t instead of int64_t to avoid compiler warnings
about illegal narrowing of values with the MSB set.

R=tebbi@chromium.org,mlippautz@chromium.org

Bug: v8:7109
Change-Id: I6e861f48828bd931c451ef336672a260c13ae042
Reviewed-on: https://chromium-review.googlesource.com/803275
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49797}
parent b6ca58e5
......@@ -214,29 +214,16 @@ struct Use {
// than defining __STDC_CONSTANT_MACROS before including <stdint.h>, and it
// works on compilers that don't have it (like MSVC).
#if V8_CC_MSVC
# define V8_INT64_C(x) (x ## I64)
# if V8_HOST_ARCH_64_BIT
# define V8_INTPTR_C(x) (x ## I64)
# define V8_PTR_PREFIX "ll"
# else
# define V8_INTPTR_C(x) (x)
# define V8_PTR_PREFIX ""
# endif // V8_HOST_ARCH_64_BIT
#elif V8_CC_MINGW64
# define V8_INT64_C(x) (x ## LL)
# define V8_INTPTR_C(x) (x ## LL)
# define V8_PTR_PREFIX "I64"
#elif V8_HOST_ARCH_64_BIT
# if V8_OS_MACOSX || V8_OS_OPENBSD
# define V8_INT64_C(x) (x ## LL)
# else
# define V8_INT64_C(x) (x ## L)
# endif
# define V8_INTPTR_C(x) (x ## L)
# define V8_PTR_PREFIX "l"
#else
# define V8_INT64_C(x) (x ## LL)
# define V8_INTPTR_C(x) (x)
#if V8_OS_AIX
#define V8_PTR_PREFIX "l"
#else
......
......@@ -298,8 +298,7 @@ Time Time::NowFromSystemTime() {
// Time between windows epoch and standard epoch.
static const int64_t kTimeToEpochInMicroseconds = V8_INT64_C(11644473600000000);
static const int64_t kTimeToEpochInMicroseconds = int64_t{11644473600000000};
Time Time::FromFiletime(FILETIME ft) {
if (ft.dwLowDateTime == 0 && ft.dwHighDateTime == 0) {
......
......@@ -43,7 +43,7 @@ class Arm64OperandGenerator final : public OperandGenerator {
InstructionOperand UseRegisterOrImmediateZero(Node* node) {
if ((IsIntegerConstant(node) && (GetIntegerConstantValue(node) == 0)) ||
(IsFloatConstant(node) &&
(bit_cast<int64_t>(GetFloatConstantValue(node)) == V8_INT64_C(0)))) {
(bit_cast<int64_t>(GetFloatConstantValue(node)) == 0))) {
return UseImmediate(node);
}
return UseRegister(node);
......
......@@ -36,7 +36,7 @@ class MipsOperandGenerator final : public OperandGenerator {
InstructionOperand UseRegisterOrImmediateZero(Node* node) {
if ((IsIntegerConstant(node) && (GetIntegerConstantValue(node) == 0)) ||
(IsFloatConstant(node) &&
(bit_cast<int64_t>(GetFloatConstantValue(node)) == V8_INT64_C(0)))) {
(bit_cast<int64_t>(GetFloatConstantValue(node)) == 0))) {
return UseImmediate(node);
}
return UseRegister(node);
......
......@@ -36,7 +36,7 @@ class Mips64OperandGenerator final : public OperandGenerator {
InstructionOperand UseRegisterOrImmediateZero(Node* node) {
if ((IsIntegerConstant(node) && (GetIntegerConstantValue(node) == 0)) ||
(IsFloatConstant(node) &&
(bit_cast<int64_t>(GetFloatConstantValue(node)) == V8_INT64_C(0)))) {
(bit_cast<int64_t>(GetFloatConstantValue(node)) == 0))) {
return UseImmediate(node);
}
return UseRegister(node);
......
......@@ -181,7 +181,8 @@ const size_t kMaxWasmCodeMemory = 256 * MB;
#if V8_HOST_ARCH_64_BIT
const int kPointerSizeLog2 = 3;
const intptr_t kIntptrSignBit = V8_INT64_C(0x8000000000000000);
const intptr_t kIntptrSignBit =
static_cast<intptr_t>(uintptr_t{0x8000000000000000});
const uintptr_t kUintptrAllBitsSet = uintptr_t{0xFFFFFFFFFFFFFFFF};
const bool kRequiresCodeRange = true;
#if V8_TARGET_ARCH_MIPS64
......
......@@ -2033,7 +2033,7 @@ void MacroAssembler::AssertFixedArray(Register object) {
void TurboAssembler::AssertZeroExtended(Register int32_register) {
if (emit_debug_code()) {
DCHECK_NE(int32_register, kScratchRegister);
movq(kScratchRegister, V8_INT64_C(0x0000000100000000));
movq(kScratchRegister, int64_t{0x0000000100000000});
cmpq(kScratchRegister, int32_register);
Check(above_equal, k32BitValueInRegisterIsNotZeroExtended);
}
......
......@@ -5546,11 +5546,11 @@ TEST(RunWord64EqualInBranchP) {
m.Return(m.Int32Constant(1));
m.Bind(&blockb);
m.Return(m.Int32Constant(2));
input = V8_INT64_C(0);
input = int64_t{0};
CHECK_EQ(1, m.Call());
input = V8_INT64_C(1);
input = int64_t{1};
CHECK_EQ(2, m.Call());
input = V8_INT64_C(0x100000000);
input = int64_t{0x100000000};
CHECK_EQ(2, m.Call());
}
......
......@@ -1546,7 +1546,7 @@ TEST(AssemblerX64AVX_sd) {
// Test vcvtss2sd & vcvtsd2ss
__ movl(rax, Immediate(9));
__ movq(rdx, V8_INT64_C(0x426D1A0000000000));
__ movq(rdx, uint64_t{0x426D1A0000000000});
__ movq(Operand(rsp, 0), rdx);
__ vcvtsd2ss(xmm6, xmm6, Operand(rsp, 0));
__ vcvtss2sd(xmm7, xmm6, xmm6);
......@@ -1572,10 +1572,10 @@ TEST(AssemblerX64AVX_sd) {
// Test vcvttsd2siq
__ movl(rax, Immediate(11));
__ movq(rdx, V8_INT64_C(0x426D1A94A2000000)); // 1.0e12
__ movq(rdx, uint64_t{0x426D1A94A2000000}); // 1.0e12
__ vmovq(xmm6, rdx);
__ vcvttsd2siq(rcx, xmm6);
__ movq(rdx, V8_INT64_C(1000000000000));
__ movq(rdx, uint64_t{1000000000000});
__ cmpq(rcx, rdx);
__ j(not_equal, &exit);
__ xorq(rcx, rcx);
......@@ -1586,9 +1586,9 @@ TEST(AssemblerX64AVX_sd) {
// Test vmovmskpd
__ movl(rax, Immediate(12));
__ movq(rdx, V8_INT64_C(0x426D1A94A2000000)); // 1.0e12
__ movq(rdx, uint64_t{0x426D1A94A2000000}); // 1.0e12
__ vmovq(xmm6, rdx);
__ movq(rdx, V8_INT64_C(0xC26D1A94A2000000)); // -1.0e12
__ movq(rdx, uint64_t{0xC26D1A94A2000000}); // -1.0e12
__ vmovq(xmm7, rdx);
__ shufps(xmm6, xmm7, 0x44);
__ vmovmskpd(rdx, xmm6);
......@@ -1696,7 +1696,7 @@ TEST(AssemblerX64AVX_sd) {
__ cmpl(rcx, Immediate(6));
__ j(not_equal, &exit);
__ movq(rdx, V8_INT64_C(0x3ff0000000000000)); // 1.0
__ movq(rdx, uint64_t{0x3ff0000000000000}); // 1.0
__ vmovq(xmm7, rdx);
__ vmulsd(xmm1, xmm1, xmm7);
__ movq(Operand(rsp, 0), rdx);
......
......@@ -173,59 +173,106 @@ const int32_t kInt32Values[] = {
1954730266, 2008792749, 2045320228,
std::numeric_limits<int32_t>::max()};
const int64_t kInt64Values[] = {
std::numeric_limits<int64_t>::min(), V8_INT64_C(-8974392461363618006),
V8_INT64_C(-8874367046689588135), V8_INT64_C(-8269197512118230839),
V8_INT64_C(-8146091527100606733), V8_INT64_C(-7550917981466150848),
V8_INT64_C(-7216590251577894337), V8_INT64_C(-6464086891160048440),
V8_INT64_C(-6365616494908257190), V8_INT64_C(-6305630541365849726),
V8_INT64_C(-5982222642272245453), V8_INT64_C(-5510103099058504169),
V8_INT64_C(-5496838675802432701), V8_INT64_C(-4047626578868642657),
V8_INT64_C(-4033755046900164544), V8_INT64_C(-3554299241457877041),
V8_INT64_C(-2482258764588614470), V8_INT64_C(-1688515425526875335),
V8_INT64_C(-924784137176548532), V8_INT64_C(-725316567157391307),
V8_INT64_C(-439022654781092241), V8_INT64_C(-105545757668917080),
V8_INT64_C(-2088319373), V8_INT64_C(-2073699916),
V8_INT64_C(-1844949911), V8_INT64_C(-1831090548),
V8_INT64_C(-1756711933), V8_INT64_C(-1559409497),
V8_INT64_C(-1281179700), V8_INT64_C(-1211513985),
V8_INT64_C(-1182371520), V8_INT64_C(-785934753),
V8_INT64_C(-767480697), V8_INT64_C(-705745662),
V8_INT64_C(-514362436), V8_INT64_C(-459916580),
V8_INT64_C(-312328082), V8_INT64_C(-302949707),
V8_INT64_C(-285499304), V8_INT64_C(-125701262),
V8_INT64_C(-95139843), V8_INT64_C(-32768),
V8_INT64_C(-27542), V8_INT64_C(-23600),
V8_INT64_C(-18582), V8_INT64_C(-17770),
V8_INT64_C(-9086), V8_INT64_C(-9010),
V8_INT64_C(-8244), V8_INT64_C(-2890),
V8_INT64_C(-103), V8_INT64_C(-34),
V8_INT64_C(-27), V8_INT64_C(-25),
V8_INT64_C(-9), V8_INT64_C(-7),
V8_INT64_C(0), V8_INT64_C(2),
V8_INT64_C(38), V8_INT64_C(58),
V8_INT64_C(65), V8_INT64_C(93),
V8_INT64_C(111), V8_INT64_C(1003),
V8_INT64_C(1267), V8_INT64_C(12797),
V8_INT64_C(23122), V8_INT64_C(28200),
V8_INT64_C(30888), V8_INT64_C(42648848),
V8_INT64_C(116836693), V8_INT64_C(263003643),
V8_INT64_C(571039860), V8_INT64_C(1079398689),
V8_INT64_C(1145196402), V8_INT64_C(1184846321),
V8_INT64_C(1758281648), V8_INT64_C(1859991374),
V8_INT64_C(1960251588), V8_INT64_C(2042443199),
V8_INT64_C(296220586027987448), V8_INT64_C(1015494173071134726),
V8_INT64_C(1151237951914455318), V8_INT64_C(1331941174616854174),
V8_INT64_C(2022020418667972654), V8_INT64_C(2450251424374977035),
V8_INT64_C(3668393562685561486), V8_INT64_C(4858229301215502171),
V8_INT64_C(4919426235170669383), V8_INT64_C(5034286595330341762),
V8_INT64_C(5055797915536941182), V8_INT64_C(6072389716149252074),
V8_INT64_C(6185309910199801210), V8_INT64_C(6297328311011094138),
V8_INT64_C(6932372858072165827), V8_INT64_C(8483640924987737210),
V8_INT64_C(8663764179455849203), V8_INT64_C(8877197042645298254),
V8_INT64_C(8901543506779157333), std::numeric_limits<int64_t>::max()};
const int64_t kInt64Values[] = {std::numeric_limits<int64_t>::min(),
int64_t{-8974392461363618006},
int64_t{-8874367046689588135},
int64_t{-8269197512118230839},
int64_t{-8146091527100606733},
int64_t{-7550917981466150848},
int64_t{-7216590251577894337},
int64_t{-6464086891160048440},
int64_t{-6365616494908257190},
int64_t{-6305630541365849726},
int64_t{-5982222642272245453},
int64_t{-5510103099058504169},
int64_t{-5496838675802432701},
int64_t{-4047626578868642657},
int64_t{-4033755046900164544},
int64_t{-3554299241457877041},
int64_t{-2482258764588614470},
int64_t{-1688515425526875335},
int64_t{-924784137176548532},
int64_t{-725316567157391307},
int64_t{-439022654781092241},
int64_t{-105545757668917080},
int64_t{-2088319373},
int64_t{-2073699916},
int64_t{-1844949911},
int64_t{-1831090548},
int64_t{-1756711933},
int64_t{-1559409497},
int64_t{-1281179700},
int64_t{-1211513985},
int64_t{-1182371520},
int64_t{-785934753},
int64_t{-767480697},
int64_t{-705745662},
int64_t{-514362436},
int64_t{-459916580},
int64_t{-312328082},
int64_t{-302949707},
int64_t{-285499304},
int64_t{-125701262},
int64_t{-95139843},
int64_t{-32768},
int64_t{-27542},
int64_t{-23600},
int64_t{-18582},
int64_t{-17770},
int64_t{-9086},
int64_t{-9010},
int64_t{-8244},
int64_t{-2890},
int64_t{-103},
int64_t{-34},
int64_t{-27},
int64_t{-25},
int64_t{-9},
int64_t{-7},
int64_t{0},
int64_t{2},
int64_t{38},
int64_t{58},
int64_t{65},
int64_t{93},
int64_t{111},
int64_t{1003},
int64_t{1267},
int64_t{12797},
int64_t{23122},
int64_t{28200},
int64_t{30888},
int64_t{42648848},
int64_t{116836693},
int64_t{263003643},
int64_t{571039860},
int64_t{1079398689},
int64_t{1145196402},
int64_t{1184846321},
int64_t{1758281648},
int64_t{1859991374},
int64_t{1960251588},
int64_t{2042443199},
int64_t{296220586027987448},
int64_t{1015494173071134726},
int64_t{1151237951914455318},
int64_t{1331941174616854174},
int64_t{2022020418667972654},
int64_t{2450251424374977035},
int64_t{3668393562685561486},
int64_t{4858229301215502171},
int64_t{4919426235170669383},
int64_t{5034286595330341762},
int64_t{5055797915536941182},
int64_t{6072389716149252074},
int64_t{6185309910199801210},
int64_t{6297328311011094138},
int64_t{6932372858072165827},
int64_t{8483640924987737210},
int64_t{8663764179455849203},
int64_t{8877197042645298254},
int64_t{8901543506779157333},
std::numeric_limits<int64_t>::max()};
const uint32_t kUint32Values[] = {
0x00000000, 0x00000001, 0xffffffff, 0x1b09788b, 0x04c5fce8, 0xcc0de5bf,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment