diff --git a/src/checks.h b/src/checks.h index a5d24c5522..44db46af2f 100644 --- a/src/checks.h +++ b/src/checks.h @@ -80,6 +80,7 @@ static inline void CheckEqualsHelper(const char* file, int line, } } +#if !V8_HOST_ARCH_64_BIT // Helper function used by the CHECK_EQ function when given int64_t // arguments. Should not be called directly. static inline void CheckEqualsHelper(const char* file, int line, @@ -98,6 +99,7 @@ static inline void CheckEqualsHelper(const char* file, int line, uint32_t(value >> 32), uint32_t(value)); } } +#endif // Helper function used by the CHECK_NE function when given int diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc index 5b0a2d421c..73d0f1ab06 100644 --- a/test/cctest/test-api.cc +++ b/test/cctest/test-api.cc @@ -702,12 +702,18 @@ THREADED_TEST(PropertyHandler) { } +#if V8_HOST_ARCH_64_BIT +# define CAST_TO_INT64(x) (int(x)) +#else +# define CAST_TO_INT64(x) (int64_t(x)) +#endif + THREADED_TEST(TinyInteger) { v8::HandleScope scope; LocalContext env; int32_t value = 239; Local value_obj = v8::Integer::New(value); - CHECK_EQ(int64_t(value), value_obj->Value()); + CHECK_EQ(CAST_TO_INT64(value), value_obj->Value()); } @@ -718,7 +724,7 @@ THREADED_TEST(BigSmiInteger) { CHECK(i::Smi::IsValid(value)); CHECK(!i::Smi::IsValid(value + 1)); Local value_obj = v8::Integer::New(value); - CHECK_EQ(int64_t(value), value_obj->Value()); + CHECK_EQ(CAST_TO_INT64(value), value_obj->Value()); } @@ -728,7 +734,7 @@ THREADED_TEST(BigInteger) { int32_t value = (1 << 30) + 1; CHECK(!i::Smi::IsValid(value)); Local value_obj = v8::Integer::New(value); - CHECK_EQ(int64_t(value), value_obj->Value()); + CHECK_EQ(CAST_TO_INT64(value), value_obj->Value()); } @@ -737,7 +743,7 @@ THREADED_TEST(TinyUnsignedInteger) { LocalContext env; uint32_t value = 239; Local value_obj = v8::Integer::New(value); - CHECK_EQ(int64_t(value), value_obj->Value()); + CHECK_EQ(CAST_TO_INT64(value), value_obj->Value()); } @@ -748,7 +754,7 @@ THREADED_TEST(BigUnsignedSmiInteger) { CHECK(i::Smi::IsValid(value)); CHECK(!i::Smi::IsValid(value + 1)); Local value_obj = v8::Integer::New(value); - CHECK_EQ(int64_t(value), value_obj->Value()); + CHECK_EQ(CAST_TO_INT64(value), value_obj->Value()); } @@ -758,7 +764,7 @@ THREADED_TEST(BigUnsignedInteger) { uint32_t value = (1 << 30) + 1; CHECK(!i::Smi::IsValid(value)); Local value_obj = v8::Integer::New(value); - CHECK_EQ(int64_t(value), value_obj->Value()); + CHECK_EQ(CAST_TO_INT64(value), value_obj->Value()); } @@ -767,7 +773,7 @@ THREADED_TEST(OutOfSignedRangeUnsignedInteger) { LocalContext env; uint32_t value = uint32_t(0xffffffff); Local value_obj = v8::Integer::New(value); - CHECK_EQ(int64_t(value), value_obj->Value()); + CHECK_EQ(CAST_TO_INT64(value), value_obj->Value()); }