// V8_HAS_DECLSPEC_ALIGN - __declspec(align(n)) supported
// V8_HAS_DECLSPEC_DEPRECATED - __declspec(deprecated) supported
// V8_HAS_DECLSPEC_NOINLINE - __declspec(noinline) supported
+// V8_HAS_DECLSPEC_SELECTANY - __declspec(selectany) supported
// V8_HAS___FINAL - __final supported in non-C++11 mode
// V8_HAS___FORCEINLINE - __forceinline supported
//
# define V8_HAS_DECLSPEC_ALIGN 1
# define V8_HAS_DECLSPEC_DEPRECATED 1
# define V8_HAS_DECLSPEC_NOINLINE 1
+# define V8_HAS_DECLSPEC_SELECTANY 1
# define V8_HAS___FORCEINLINE 1
if (!InternalFieldOK(obj, index, location)) return;
i::Handle<i::Object> val = Utils::OpenHandle(*value);
obj->SetInternalField(index, *val);
- DCHECK_EQ(value, GetInternalField(index));
+ DCHECK(value->Equals(GetInternalField(index)));
}
}
+// static
+STATIC_CONST_MEMBER_DEFINITION const SnapshotObjectId
+ HeapProfiler::kUnknownObjectId;
+
+
int HeapProfiler::GetSnapshotCount() {
return reinterpret_cast<i::HeapProfiler*>(this)->GetSnapshotsCount();
}
// If either is a Smi (we know that not both are), then they can only
// be strictly equal if the other is a HeapNumber.
STATIC_ASSERT(kSmiTag == 0);
- DCHECK_EQ(0, Smi::FromInt(0));
+ DCHECK_EQ(static_cast<Smi*>(0), Smi::FromInt(0));
__ and_(r2, lhs, Operand(rhs));
__ JumpIfNotSmi(r2, ¬_smis);
// One operand is a smi. EmitSmiNonsmiComparison generates code that can:
void FullCodeGenerator::EmitDateField(CallRuntime* expr) {
ZoneList<Expression*>* args = expr->arguments();
DCHECK(args->length() == 2);
- DCHECK_NE(NULL, args->at(1)->AsLiteral());
+ DCHECK_NOT_NULL(args->at(1)->AsLiteral());
Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->value()));
VisitForAccumulatorValue(args->at(0)); // Load the object.
void FullCodeGenerator::EmitGetFromCache(CallRuntime* expr) {
ZoneList<Expression*>* args = expr->arguments();
DCHECK_EQ(2, args->length());
- DCHECK_NE(NULL, args->at(0)->AsLiteral());
+ DCHECK_NOT_NULL(args->at(0)->AsLiteral());
int cache_id = Smi::cast(*(args->at(0)->AsLiteral()->value()))->value();
Handle<FixedArray> jsfunction_result_caches(
ldr(type, FieldMemOperand(obj, HeapObject::kMapOffset), cond);
ldrb(type, FieldMemOperand(type, Map::kInstanceTypeOffset), cond);
tst(type, Operand(kIsNotStringMask), cond);
- DCHECK_EQ(0, kStringTag);
+ DCHECK_EQ(0u, kStringTag);
return eq;
}
void FullCodeGenerator::EmitDateField(CallRuntime* expr) {
ZoneList<Expression*>* args = expr->arguments();
DCHECK(args->length() == 2);
- DCHECK_NE(NULL, args->at(1)->AsLiteral());
+ DCHECK_NOT_NULL(args->at(1)->AsLiteral());
Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->value()));
VisitForAccumulatorValue(args->at(0)); // Load the object.
void FullCodeGenerator::EmitGetFromCache(CallRuntime* expr) {
ZoneList<Expression*>* args = expr->arguments();
DCHECK_EQ(2, args->length());
- DCHECK_NE(NULL, args->at(0)->AsLiteral());
+ DCHECK_NOT_NULL(args->at(0)->AsLiteral());
int cache_id = Smi::cast(*(args->at(0)->AsLiteral()->value()))->value();
Handle<FixedArray> jsfunction_result_caches(
__ Sdiv(result, dividend, divisor);
if (hdiv->CheckFlag(HValue::kAllUsesTruncatingToInt32)) {
- DCHECK_EQ(NULL, instr->temp());
+ DCHECK(!instr->temp());
return;
}
Cmp(index, index_type == kIndexIsSmi ? scratch : Operand::UntagSmi(scratch));
Check(lt, kIndexIsTooLarge);
- DCHECK_EQ(0, Smi::FromInt(0));
+ DCHECK_EQ(static_cast<Smi*>(0), Smi::FromInt(0));
Cmp(index, 0);
Check(ge, kIndexIsNegative);
}
#define WARN_UNUSED_RESULT /* NOT SUPPORTED */
#endif
+
+// The C++ standard requires that static const members have an out-of-class
+// definition (in a single compilation unit), but MSVC chokes on this (when
+// language extensions, which are required, are enabled). (You're only likely to
+// notice the need for a definition if you take the address of the member or,
+// more commonly, pass it to a function that takes it as a reference argument --
+// probably an STL function.) This macro makes MSVC do the right thing. See
+// http://msdn.microsoft.com/en-us/library/34h23df8(v=vs.100).aspx for more
+// information. Use like:
+//
+// In .h file:
+// struct Foo {
+// static const int kBar = 5;
+// };
+//
+// In .cc file:
+// STATIC_CONST_MEMBER_DEFINITION const int Foo::kBar;
+#if V8_HAS_DECLSPEC_SELECTANY
+#define STATIC_CONST_MEMBER_DEFINITION __declspec(selectany)
+#else
+#define STATIC_CONST_MEMBER_DEFINITION
+#endif
+
#endif // V8_BASE_COMPILER_SPECIFIC_H_
#elif V8_OS_QNX
# include <backtrace.h>
#endif // V8_LIBC_GLIBC || V8_OS_BSD
-#include <stdio.h>
-#include <stdlib.h>
+
+#include <cstdio>
+#include <cstdlib>
#include "src/base/platform/platform.h"
namespace v8 {
namespace base {
+// Explicit instantiations for commonly used comparisons.
+#define DEFINE_MAKE_CHECK_OP_STRING(type) \
+ template std::string* MakeCheckOpString<type, type>( \
+ type const&, type const&, char const*);
+DEFINE_MAKE_CHECK_OP_STRING(int)
+DEFINE_MAKE_CHECK_OP_STRING(long) // NOLINT(runtime/int)
+DEFINE_MAKE_CHECK_OP_STRING(long long) // NOLINT(runtime/int)
+DEFINE_MAKE_CHECK_OP_STRING(unsigned int)
+DEFINE_MAKE_CHECK_OP_STRING(unsigned long) // NOLINT(runtime/int)
+DEFINE_MAKE_CHECK_OP_STRING(unsigned long long) // NOLINT(runtime/int)
+DEFINE_MAKE_CHECK_OP_STRING(char const*)
+DEFINE_MAKE_CHECK_OP_STRING(void const*)
+#undef DEFINE_MAKE_CHECK_OP_STRING
+
+
+// Explicit instantiations for floating point checks.
+#define DEFINE_CHECK_OP_IMPL(NAME) \
+ template std::string* Check##NAME##Impl<float, float>( \
+ float const& lhs, float const& rhs, char const* msg); \
+ template std::string* Check##NAME##Impl<double, double>( \
+ double const& lhs, double const& rhs, char const* msg);
+DEFINE_CHECK_OP_IMPL(EQ)
+DEFINE_CHECK_OP_IMPL(NE)
+DEFINE_CHECK_OP_IMPL(LE)
+DEFINE_CHECK_OP_IMPL(LT)
+DEFINE_CHECK_OP_IMPL(GE)
+DEFINE_CHECK_OP_IMPL(GT)
+#undef DEFINE_CHECK_OP_IMPL
+
+
// Attempts to dump a backtrace (if supported).
void DumpBacktrace() {
#if V8_LIBC_GLIBC || V8_OS_BSD
#endif // V8_LIBC_GLIBC || V8_OS_BSD
}
-} } // namespace v8::base
+} // namespace base
+} // namespace v8
// Contains protection against recursive calls (faults while handling faults).
#ifndef V8_BASE_LOGGING_H_
#define V8_BASE_LOGGING_H_
-#include <stdint.h>
-#include <string.h>
+#include <cstring>
+#include <sstream>
+#include <string>
#include "src/base/build_config.h"
#endif
-// The CHECK macro checks that the given condition is true; if not, it
-// prints a message to stderr and aborts.
-#define CHECK(condition) \
- do { \
- if (V8_UNLIKELY(!(condition))) { \
- V8_Fatal(__FILE__, __LINE__, "CHECK(%s) failed", #condition); \
- } \
- } while (0)
-
-
-// Helper function used by the CHECK_EQ function when given int
-// arguments. Should not be called directly.
-inline void CheckEqualsHelper(const char* file, int line,
- const char* expected_source, int expected,
- const char* value_source, int value) {
- if (V8_UNLIKELY(expected != value)) {
- V8_Fatal(file, line,
- "CHECK_EQ(%s, %s) failed\n# Expected: %i\n# Found: %i",
- expected_source, value_source, expected, value);
- }
-}
-
-
-// Helper function used by the CHECK_EQ function when given int64_t
-// arguments. Should not be called directly.
-inline void CheckEqualsHelper(const char* file, int line,
- const char* expected_source,
- int64_t expected,
- const char* value_source,
- int64_t value) {
- if (V8_UNLIKELY(expected != value)) {
- // Print int64_t values in hex, as two int32s,
- // to avoid platform-dependencies.
- V8_Fatal(file, line,
- "CHECK_EQ(%s, %s) failed\n#"
- " Expected: 0x%08x%08x\n# Found: 0x%08x%08x",
- expected_source, value_source,
- static_cast<uint32_t>(expected >> 32),
- static_cast<uint32_t>(expected),
- static_cast<uint32_t>(value >> 32),
- static_cast<uint32_t>(value));
- }
-}
-
-
-// 32-bit AIX defines intptr_t as long int.
-#if V8_OS_AIX && V8_HOST_ARCH_32_BIT
-// Helper function used by the CHECK_EQ function when given intptr_t
-// arguments. Should not be called directly.
-inline void CheckEqualsHelper(const char* file, int line,
- const char* expected_source, intptr_t expected,
- const char* value_source, intptr_t value) {
- if (expected != value) {
- V8_Fatal(file, line,
- "CHECK_EQ(%s, %s) failed\n#"
- " Expected: 0x%lx\n# Found: 0x%lx",
- expected_source, value_source, expected, value);
- }
-}
-#endif
-
-
-// Helper function used by the CHECK_NE function when given int
-// arguments. Should not be called directly.
-inline void CheckNonEqualsHelper(const char* file,
- int line,
- const char* unexpected_source,
- int unexpected,
- const char* value_source,
- int value) {
- if (V8_UNLIKELY(unexpected == value)) {
- V8_Fatal(file, line, "CHECK_NE(%s, %s) failed\n# Value: %i",
- unexpected_source, value_source, value);
- }
-}
+namespace v8 {
+namespace base {
+// CHECK dies with a fatal error if condition is not true. It is *not*
+// controlled by DEBUG, so the check will be executed regardless of
+// compilation mode.
+//
+// We make sure CHECK et al. always evaluates their arguments, as
+// doing CHECK(FunctionWithSideEffect()) is a common idiom.
+#define CHECK(condition) \
+ do { \
+ if (V8_UNLIKELY(!(condition))) { \
+ V8_Fatal(__FILE__, __LINE__, "Check failed: %s.", #condition); \
+ } \
+ } while (0)
-// Helper function used by the CHECK function when given string
-// arguments. Should not be called directly.
-inline void CheckEqualsHelper(const char* file,
- int line,
- const char* expected_source,
- const char* expected,
- const char* value_source,
- const char* value) {
- if (V8_UNLIKELY((expected == NULL && value != NULL) ||
- (expected != NULL && value == NULL) ||
- (expected != NULL && value != NULL &&
- strcmp(expected, value) != 0))) {
- V8_Fatal(file, line,
- "CHECK_EQ(%s, %s) failed\n# Expected: %s\n# Found: %s",
- expected_source, value_source, expected, value);
- }
-}
+#ifdef DEBUG
-inline void CheckNonEqualsHelper(const char* file,
- int line,
- const char* expected_source,
- const char* expected,
- const char* value_source,
- const char* value) {
- if (V8_UNLIKELY(expected == value || (expected != NULL && value != NULL &&
- strcmp(expected, value) == 0))) {
- V8_Fatal(file, line, "CHECK_NE(%s, %s) failed\n# Value: %s",
- expected_source, value_source, value);
- }
-}
+// Helper macro for binary operators.
+// Don't use this macro directly in your code, use CHECK_EQ et al below.
+#define CHECK_OP(name, op, lhs, rhs) \
+ do { \
+ if (std::string* _msg = ::v8::base::Check##name##Impl( \
+ (lhs), (rhs), #lhs " " #op " " #rhs)) { \
+ V8_Fatal(__FILE__, __LINE__, "Check failed: %s.", _msg->c_str()); \
+ delete _msg; \
+ } \
+ } while (0)
+#else
-// Helper function used by the CHECK function when given pointer
-// arguments. Should not be called directly.
-inline void CheckEqualsHelper(const char* file,
- int line,
- const char* expected_source,
- const void* expected,
- const char* value_source,
- const void* value) {
- if (V8_UNLIKELY(expected != value)) {
- V8_Fatal(file, line,
- "CHECK_EQ(%s, %s) failed\n# Expected: %p\n# Found: %p",
- expected_source, value_source,
- expected, value);
- }
-}
+// Make all CHECK functions discard their log strings to reduce code
+// bloat for official release builds.
+#define CHECK_OP(name, op, lhs, rhs) CHECK((lhs)op(rhs))
-inline void CheckNonEqualsHelper(const char* file,
- int line,
- const char* expected_source,
- const void* expected,
- const char* value_source,
- const void* value) {
- if (V8_UNLIKELY(expected == value)) {
- V8_Fatal(file, line, "CHECK_NE(%s, %s) failed\n# Value: %p",
- expected_source, value_source, value);
- }
-}
+#endif
-inline void CheckNonEqualsHelper(const char* file,
- int line,
- const char* expected_source,
- int64_t expected,
- const char* value_source,
- int64_t value) {
- if (V8_UNLIKELY(expected == value)) {
- V8_Fatal(file, line,
- "CHECK_EQ(%s, %s) failed\n# Expected: %f\n# Found: %f",
- expected_source, value_source, expected, value);
- }
+// Build the error message string. This is separate from the "Impl"
+// function template because it is not performance critical and so can
+// be out of line, while the "Impl" code should be inline. Caller
+// takes ownership of the returned string.
+template <typename Lhs, typename Rhs>
+std::string* MakeCheckOpString(Lhs const& lhs, Rhs const& rhs,
+ char const* msg) {
+ std::ostringstream ss;
+ ss << msg << " (" << lhs << " vs. " << rhs << ")";
+ return new std::string(ss.str());
}
-
-#define CHECK_EQ(expected, value) CheckEqualsHelper(__FILE__, __LINE__, \
- #expected, expected, #value, value)
+// Commonly used instantiations of MakeCheckOpString<>. Explicitly instantiated
+// in logging.cc.
+#define DEFINE_MAKE_CHECK_OP_STRING(type) \
+ extern template std::string* MakeCheckOpString<type, type>( \
+ type const&, type const&, char const*);
+DEFINE_MAKE_CHECK_OP_STRING(int)
+DEFINE_MAKE_CHECK_OP_STRING(long) // NOLINT(runtime/int)
+DEFINE_MAKE_CHECK_OP_STRING(long long) // NOLINT(runtime/int)
+DEFINE_MAKE_CHECK_OP_STRING(unsigned int)
+DEFINE_MAKE_CHECK_OP_STRING(unsigned long) // NOLINT(runtime/int)
+DEFINE_MAKE_CHECK_OP_STRING(unsigned long long) // NOLINT(runtime/int)
+DEFINE_MAKE_CHECK_OP_STRING(char const*)
+DEFINE_MAKE_CHECK_OP_STRING(void const*)
+#undef DEFINE_MAKE_CHECK_OP_STRING
+
+
+// Helper functions for CHECK_OP macro.
+// The (int, int) specialization works around the issue that the compiler
+// will not instantiate the template version of the function on values of
+// unnamed enum type - see comment below.
+// The (float, float) and (double, double) instantiations are explicitly
+// externialized to ensure proper 32/64-bit comparisons on x86.
+#define DEFINE_CHECK_OP_IMPL(NAME, op) \
+ template <typename Lhs, typename Rhs> \
+ V8_INLINE std::string* Check##NAME##Impl(Lhs const& lhs, Rhs const& rhs, \
+ char const* msg) { \
+ return V8_LIKELY(lhs op rhs) ? nullptr : MakeCheckOpString(lhs, rhs, msg); \
+ } \
+ V8_INLINE std::string* Check##NAME##Impl(int lhs, int rhs, \
+ char const* msg) { \
+ return V8_LIKELY(lhs op rhs) ? nullptr : MakeCheckOpString(lhs, rhs, msg); \
+ } \
+ extern template std::string* Check##NAME##Impl<float, float>( \
+ float const& lhs, float const& rhs, char const* msg); \
+ extern template std::string* Check##NAME##Impl<double, double>( \
+ double const& lhs, double const& rhs, char const* msg);
+DEFINE_CHECK_OP_IMPL(EQ, ==)
+DEFINE_CHECK_OP_IMPL(NE, !=)
+DEFINE_CHECK_OP_IMPL(LE, <=)
+DEFINE_CHECK_OP_IMPL(LT, < )
+DEFINE_CHECK_OP_IMPL(GE, >=)
+DEFINE_CHECK_OP_IMPL(GT, > )
+#undef DEFINE_CHECK_OP_IMPL
+
+#define CHECK_EQ(lhs, rhs) CHECK_OP(EQ, ==, lhs, rhs)
+#define CHECK_NE(lhs, rhs) CHECK_OP(NE, !=, lhs, rhs)
+#define CHECK_LE(lhs, rhs) CHECK_OP(LE, <=, lhs, rhs)
+#define CHECK_LT(lhs, rhs) CHECK_OP(LT, <, lhs, rhs)
+#define CHECK_GE(lhs, rhs) CHECK_OP(GE, >=, lhs, rhs)
+#define CHECK_GT(lhs, rhs) CHECK_OP(GT, >, lhs, rhs)
+#define CHECK_NULL(val) CHECK((val) == nullptr)
+#define CHECK_NOT_NULL(val) CHECK((val) != nullptr)
+#define CHECK_IMPLIES(lhs, rhs) CHECK(!(lhs) || (rhs))
-#define CHECK_NE(unexpected, value) CheckNonEqualsHelper(__FILE__, __LINE__, \
- #unexpected, unexpected, #value, value)
-
-
-#define CHECK_GT(a, b) CHECK((a) > (b))
-#define CHECK_GE(a, b) CHECK((a) >= (b))
-#define CHECK_LT(a, b) CHECK((a) < (b))
-#define CHECK_LE(a, b) CHECK((a) <= (b))
-
-
-namespace v8 {
-namespace base {
-
// Exposed for making debugging easier (to see where your function is being
// called, just add a call to DumpBacktrace).
void DumpBacktrace();
-} } // namespace v8::base
+} // namespace base
+} // namespace v8
// The DCHECK macro is equivalent to CHECK except that it only
// generates code in debug builds.
+// TODO(bmeurer): DCHECK_RESULT(expr) must die!
#ifdef DEBUG
#define DCHECK_RESULT(expr) CHECK(expr)
#define DCHECK(condition) CHECK(condition)
#define DCHECK_GE(v1, v2) CHECK_GE(v1, v2)
#define DCHECK_LT(v1, v2) CHECK_LT(v1, v2)
#define DCHECK_LE(v1, v2) CHECK_LE(v1, v2)
+#define DCHECK_NULL(val) CHECK_NULL(val)
+#define DCHECK_NOT_NULL(val) CHECK_NOT_NULL(val)
+#define DCHECK_IMPLIES(v1, v2) CHECK_IMPLIES(v1, v2)
#else
#define DCHECK_RESULT(expr) (expr)
#define DCHECK(condition) ((void) 0)
#define DCHECK_GE(v1, v2) ((void) 0)
#define DCHECK_LT(v1, v2) ((void) 0)
#define DCHECK_LE(v1, v2) ((void) 0)
+#define DCHECK_NULL(val) ((void) 0)
+#define DCHECK_NOT_NULL(val) ((void) 0)
+#define DCHECK_IMPLIES(v1, v2) ((void) 0)
#endif
-#define DCHECK_NOT_NULL(p) DCHECK_NE(NULL, p)
-
#endif // V8_BASE_LOGGING_H_
// Remove the event from the wait list.
for (Event** wep = &waitlist_;; wep = &(*wep)->next_) {
- DCHECK_NE(NULL, *wep);
+ DCHECK(*wep);
if (*wep == event) {
*wep = event->next_;
break;
#include <mach/mach_time.h>
#endif
-#include <string.h>
+#include <cstring>
+#include <ostream>
#if V8_OS_WIN
#include "src/base/lazy-instance.h"
}
+std::ostream& operator<<(std::ostream& os, const Time& time) {
+ return os << time.ToJsTime();
+}
+
+
#if V8_OS_WIN
class TickClock {
#ifndef V8_BASE_PLATFORM_TIME_H_
#define V8_BASE_PLATFORM_TIME_H_
-#include <time.h>
+#include <ctime>
+#include <iosfwd>
#include <limits>
#include "src/base/macros.h"
int64_t us_;
};
+std::ostream& operator<<(std::ostream&, const Time&);
+
inline Time operator+(const TimeDelta& delta, const Time& time) {
return time + delta;
}
.ToHandleChecked());
}
const char* inner = period_pos + 1;
- DCHECK_EQ(NULL, strchr(inner, '.'));
+ DCHECK(!strchr(inner, '.'));
Vector<const char> property(holder_expr,
static_cast<int>(period_pos - holder_expr));
Handle<String> property_string = factory->InternalizeUtf8String(property);
#include "src/checks.h"
-#include "src/v8.h"
-
namespace v8 {
-namespace internal {
-
-intptr_t HeapObjectTagMask() { return kHeapObjectTagMask; }
-
-} } // namespace v8::internal
-
-
-static bool CheckEqualsStrict(volatile double* exp, volatile double* val) {
- v8::internal::DoubleRepresentation exp_rep(*exp);
- v8::internal::DoubleRepresentation val_rep(*val);
- if (std::isnan(exp_rep.value) && std::isnan(val_rep.value)) return true;
- return exp_rep.bits == val_rep.bits;
-}
-
-
-void CheckEqualsHelper(const char* file, int line, const char* expected_source,
- double expected, const char* value_source,
- double value) {
- // Force values to 64 bit memory to truncate 80 bit precision on IA32.
- volatile double* exp = new double[1];
- *exp = expected;
- volatile double* val = new double[1];
- *val = value;
- if (!CheckEqualsStrict(exp, val)) {
- V8_Fatal(file, line,
- "CHECK_EQ(%s, %s) failed\n# Expected: %f\n# Found: %f",
- expected_source, value_source, *exp, *val);
- }
- delete[] exp;
- delete[] val;
-}
-
-
-void CheckNonEqualsHelper(const char* file, int line,
- const char* expected_source, double expected,
- const char* value_source, double value) {
- // Force values to 64 bit memory to truncate 80 bit precision on IA32.
- volatile double* exp = new double[1];
- *exp = expected;
- volatile double* val = new double[1];
- *val = value;
- if (CheckEqualsStrict(exp, val)) {
- V8_Fatal(file, line,
- "CHECK_EQ(%s, %s) failed\n# Expected: %f\n# Found: %f",
- expected_source, value_source, *exp, *val);
- }
- delete[] exp;
- delete[] val;
-}
-
-
-void CheckEqualsHelper(const char* file,
- int line,
- const char* expected_source,
- v8::Handle<v8::Value> expected,
- const char* value_source,
- v8::Handle<v8::Value> value) {
- if (!expected->Equals(value)) {
- v8::String::Utf8Value value_str(value);
- v8::String::Utf8Value expected_str(expected);
- V8_Fatal(file, line,
- "CHECK_EQ(%s, %s) failed\n# Expected: %s\n# Found: %s",
- expected_source, value_source, *expected_str, *value_str);
- }
-}
-
-
-void CheckNonEqualsHelper(const char* file,
- int line,
- const char* unexpected_source,
- v8::Handle<v8::Value> unexpected,
- const char* value_source,
- v8::Handle<v8::Value> value) {
- if (unexpected->Equals(value)) {
- v8::String::Utf8Value value_str(value);
- V8_Fatal(file, line, "CHECK_NE(%s, %s) failed\n# Value: %s",
- unexpected_source, value_source, *value_str);
- }
-}
+namespace internal {} // namespace internal
+} // namespace v8
#ifndef V8_CHECKS_H_
#define V8_CHECKS_H_
+#include "include/v8.h"
#include "src/base/logging.h"
namespace v8 {
namespace internal {
-intptr_t HeapObjectTagMask();
-
#ifdef ENABLE_SLOW_DCHECKS
#define SLOW_DCHECK(condition) \
CHECK(!v8::internal::FLAG_enable_slow_asserts || (condition))
} } // namespace v8::internal
+#define DCHECK_TAG_ALIGNED(address) \
+ DCHECK((reinterpret_cast<intptr_t>(address) & \
+ ::v8::internal::kHeapObjectTagMask) == 0)
-void CheckNonEqualsHelper(const char* file, int line,
- const char* expected_source, double expected,
- const char* value_source, double value);
-
-void CheckEqualsHelper(const char* file, int line, const char* expected_source,
- double expected, const char* value_source, double value);
-
-void CheckNonEqualsHelper(const char* file, int line,
- const char* unexpected_source,
- v8::Handle<v8::Value> unexpected,
- const char* value_source,
- v8::Handle<v8::Value> value);
-
-void CheckEqualsHelper(const char* file,
- int line,
- const char* expected_source,
- v8::Handle<v8::Value> expected,
- const char* value_source,
- v8::Handle<v8::Value> value);
-
-#define DCHECK_TAG_ALIGNED(address) \
- DCHECK((reinterpret_cast<intptr_t>(address) & HeapObjectTagMask()) == 0)
-
-#define DCHECK_SIZE_TAG_ALIGNED(size) DCHECK((size & HeapObjectTagMask()) == 0)
+#define DCHECK_SIZE_TAG_ALIGNED(size) \
+ DCHECK((size & ::v8::internal::kHeapObjectTagMask) == 0)
#endif // V8_CHECKS_H_
// Check that no dependent maps have been added or added dependent maps have
// been rolled back or committed.
for (int i = 0; i < DependentCode::kGroupCount; i++) {
- DCHECK_EQ(NULL, dependencies_[i]);
+ DCHECK(!dependencies_[i]);
}
#endif // DEBUG
}
// Materialize a full 32-bit 1 or 0 value. The result register is always the
// last output of the instruction.
- DCHECK_NE(0, instr->OutputCount());
+ DCHECK_NE(0u, instr->OutputCount());
Register reg = i.OutputRegister(instr->OutputCount() - 1);
Condition cc = FlagsConditionToCondition(condition);
__ mov(reg, Operand(0));
outputs[output_count++] = g.DefineAsRegister(cont->result());
}
- DCHECK_NE(0, input_count);
- DCHECK_NE(0, output_count);
+ DCHECK_NE(0u, input_count);
+ DCHECK_NE(0u, output_count);
DCHECK_GE(arraysize(inputs), input_count);
DCHECK_GE(arraysize(outputs), output_count);
DCHECK_NE(kMode_None, AddressingModeField::decode(opcode));
void EmitUbfx(InstructionSelector* selector, Node* node, Node* left,
uint32_t lsb, uint32_t width) {
- DCHECK_LE(1, width);
- DCHECK_LE(width, 32 - lsb);
+ DCHECK_LE(1u, width);
+ DCHECK_LE(width, 32u - lsb);
ArmOperandGenerator g(selector);
selector->Emit(kArmUbfx, g.DefineAsRegister(node), g.UseRegister(left),
g.TempImmediate(lsb), g.TempImmediate(width));
uint32_t msb = base::bits::CountLeadingZeros32(value);
// Try to interpret this AND as UBFX.
if (IsSupported(ARMv7) && width != 0 && msb + width == 32) {
- DCHECK_EQ(0, base::bits::CountTrailingZeros32(value));
+ DCHECK_EQ(0u, base::bits::CountTrailingZeros32(value));
if (m.left().IsWord32Shr()) {
Int32BinopMatcher mleft(m.left().node());
if (mleft.right().IsInRange(0, 31)) {
}
+namespace {
+
template <typename TryMatchShift>
-static inline void VisitShift(InstructionSelector* selector, Node* node,
- TryMatchShift try_match_shift,
- FlagsContinuation* cont) {
+void VisitShift(InstructionSelector* selector, Node* node,
+ TryMatchShift try_match_shift, FlagsContinuation* cont) {
ArmOperandGenerator g(selector);
InstructionCode opcode = kArmMov;
InstructionOperand* inputs[4];
outputs[output_count++] = g.DefineAsRegister(cont->result());
}
- DCHECK_NE(0, input_count);
- DCHECK_NE(0, output_count);
+ DCHECK_NE(0u, input_count);
+ DCHECK_NE(0u, output_count);
DCHECK_GE(arraysize(inputs), input_count);
DCHECK_GE(arraysize(outputs), output_count);
DCHECK_NE(kMode_None, AddressingModeField::decode(opcode));
template <typename TryMatchShift>
-static inline void VisitShift(InstructionSelector* selector, Node* node,
+void VisitShift(InstructionSelector* selector, Node* node,
TryMatchShift try_match_shift) {
FlagsContinuation cont;
VisitShift(selector, node, try_match_shift, &cont);
}
+} // namespace
+
void InstructionSelector::VisitWord32Shl(Node* node) {
VisitShift(this, node, TryMatchLSL);
Int32BinopMatcher m(node);
if (IsSupported(ARMv7) && m.left().IsWord32And() &&
m.right().IsInRange(0, 31)) {
- int32_t lsb = m.right().Value();
+ uint32_t lsb = m.right().Value();
Int32BinopMatcher mleft(m.left().node());
if (mleft.right().HasValue()) {
uint32_t value = (mleft.right().Value() >> lsb) << lsb;
outputs[output_count++] = g.DefineAsRegister(cont->result());
}
- DCHECK_NE(0, input_count);
+ DCHECK_NE(0u, input_count);
DCHECK_GE(arraysize(inputs), input_count);
DCHECK_GE(arraysize(outputs), output_count);
// Materialize a full 64-bit 1 or 0 value. The result register is always the
// last output of the instruction.
- DCHECK_NE(0, instr->OutputCount());
+ DCHECK_NE(0u, instr->OutputCount());
Register reg = i.OutputRegister(instr->OutputCount() - 1);
Condition cc = FlagsConditionToCondition(condition);
__ Cset(reg, cc);
outputs[output_count++] = g.DefineAsRegister(cont->result());
}
- DCHECK_NE(0, input_count);
- DCHECK_NE(0, output_count);
+ DCHECK_NE(0u, input_count);
+ DCHECK_NE(0u, output_count);
DCHECK_GE(arraysize(inputs), input_count);
DCHECK_GE(arraysize(outputs), output_count);
uint32_t mask_msb = base::bits::CountLeadingZeros32(mask);
if ((mask_width != 0) && (mask_msb + mask_width == 32)) {
// The mask must be contiguous, and occupy the least-significant bits.
- DCHECK_EQ(0, base::bits::CountTrailingZeros32(mask));
+ DCHECK_EQ(0u, base::bits::CountTrailingZeros32(mask));
// Select Ubfx for And(Shr(x, imm), mask) where the mask is in the least
// significant bits.
uint64_t mask_msb = base::bits::CountLeadingZeros64(mask);
if ((mask_width != 0) && (mask_msb + mask_width == 64)) {
// The mask must be contiguous, and occupy the least-significant bits.
- DCHECK_EQ(0, base::bits::CountTrailingZeros64(mask));
+ DCHECK_EQ(0u, base::bits::CountTrailingZeros64(mask));
// Select Ubfx for And(Shr(x, imm), mask) where the mask is in the least
// significant bits.
Arm64OperandGenerator g(this);
Int32BinopMatcher m(node);
if (m.left().IsWord32And() && m.right().IsInRange(0, 31)) {
- int32_t lsb = m.right().Value();
+ uint32_t lsb = m.right().Value();
Int32BinopMatcher mleft(m.left().node());
if (mleft.right().HasValue()) {
uint32_t mask = (mleft.right().Value() >> lsb) << lsb;
Arm64OperandGenerator g(this);
Int64BinopMatcher m(node);
if (m.left().IsWord64And() && m.right().IsInRange(0, 63)) {
- int64_t lsb = m.right().Value();
+ uint64_t lsb = m.right().Value();
Int64BinopMatcher mleft(m.left().node());
if (mleft.right().HasValue()) {
// Select Ubfx for Shr(And(x, mask), imm) where the result of the mask is
for (int i = 0; i < deopt_count; i++) {
DeoptimizationState* deoptimization_state = deoptimization_states_[i];
data->SetAstId(i, deoptimization_state->bailout_id());
- CHECK_NE(NULL, deoptimization_states_[i]);
+ CHECK(deoptimization_states_[i]);
data->SetTranslationIndex(
i, Smi::FromInt(deoptimization_states_[i]->translation_id()));
data->SetArgumentsStackHeight(i, Smi::FromInt(0));
for (size_t j = 0; j < nodes.size(); j++) {
Node* node = nodes[j];
for (Node* const input : node->inputs()) {
- CHECK_NE(NULL, input);
+ CHECK(input);
}
for (Node* const use : node->uses()) {
CHECK(marked.IsReachableFromEnd(use));
// Recurse on an input if necessary.
for (Node* const input : node->inputs()) {
- CHECK_NE(NULL, input);
+ DCHECK(input);
if (Recurse(input)) return;
}
// Materialize a full 32-bit 1 or 0 value. The result register is always the
// last output of the instruction.
Label check;
- DCHECK_NE(0, instr->OutputCount());
+ DCHECK_NE(0u, instr->OutputCount());
Register reg = i.OutputRegister(instr->OutputCount() - 1);
Condition cc = no_condition;
switch (condition) {
outputs[output_count++] = g.DefineAsRegister(cont->result());
}
- DCHECK_NE(0, input_count);
- DCHECK_NE(0, output_count);
+ DCHECK_NE(0u, input_count);
+ DCHECK_NE(0u, output_count);
DCHECK_GE(arraysize(inputs), input_count);
DCHECK_GE(arraysize(outputs), output_count);
BasicBlockVector* blocks = schedule()->rpo_order();
for (auto const block : *blocks) {
if (!block->IsLoopHeader()) continue;
- DCHECK_LE(2, block->PredecessorCount());
+ DCHECK_LE(2u, block->PredecessorCount());
for (Node* const phi : *block) {
if (phi->opcode() != IrOpcode::kPhi) continue;
if (use->opcode() != IrOpcode::kProjection) continue;
size_t const index = ProjectionIndexOf(use->op());
DCHECK_LT(index, buffer->output_nodes.size());
- DCHECK_EQ(nullptr, buffer->output_nodes[index]);
+ DCHECK(!buffer->output_nodes[index]);
buffer->output_nodes[index] = use;
}
}
if (static_cast<size_t>(stack_index) >= buffer->pushed_nodes.size()) {
buffer->pushed_nodes.resize(stack_index + 1, NULL);
}
- DCHECK_EQ(NULL, buffer->pushed_nodes[stack_index]);
+ DCHECK(!buffer->pushed_nodes[stack_index]);
buffer->pushed_nodes[stack_index] = *iter;
pushed_count++;
} else {
void InstructionSelector::VisitBlock(BasicBlock* block) {
- DCHECK_EQ(NULL, current_block_);
+ DCHECK(!current_block_);
current_block_ = block;
int current_block_end = static_cast<int>(instructions_.size());
size_t rpo_number = 0;
for (BasicBlockVector::const_iterator it = schedule->rpo_order()->begin();
it != schedule->rpo_order()->end(); ++it, ++rpo_number) {
- DCHECK_EQ(NULL, (*blocks)[rpo_number]);
+ DCHECK(!(*blocks)[rpo_number]);
DCHECK((*it)->GetRpoNumber().ToSize() == rpo_number);
(*blocks)[rpo_number] = InstructionBlockFor(zone, *it);
}
void set_pointer_map(PointerMap* map) {
DCHECK(NeedsPointerMap());
- DCHECK_EQ(NULL, pointer_map_);
+ DCHECK(!pointer_map_);
pointer_map_ = map;
}
// Counts only formal parameters.
size_t formal_parameters() {
- DCHECK_GE(total_parameters(), 3);
+ DCHECK_GE(total_parameters(), 3u);
return total_parameters() - 3;
}
if (copy == NULL) {
copy = GetSentinel(original);
}
- DCHECK_NE(NULL, copy);
+ DCHECK(copy);
return copy;
}
Node* sentinel = sentinels_[id];
if (sentinel == NULL) continue;
Node* copy = copies_[id];
- DCHECK_NE(NULL, copy);
+ DCHECK(copy);
sentinel->ReplaceUses(copy);
}
}
}
}
// There should be a merge or a return for each exit.
- CHECK_NE(NULL, found);
+ CHECK(found);
}
// Return nodes, the end merge, and the phis associated with the end merge
// must be duplicated as well.
Node* MachineOperatorReducer::Uint32Div(Node* dividend, uint32_t divisor) {
- DCHECK_LT(0, divisor);
+ DCHECK_LT(0u, divisor);
// If the divisor is even, we can avoid using the expensive fixup by shifting
// the dividend upfront.
unsigned const shift = base::bits::CountTrailingZeros32(divisor);
Node* quotient = graph()->NewNode(machine()->Uint32MulHigh(), dividend,
Uint32Constant(mag.multiplier));
if (mag.add) {
- DCHECK_LE(1, mag.shift);
+ DCHECK_LE(1u, mag.shift);
quotient = Word32Shr(
Int32Add(Word32Shr(Int32Sub(dividend, quotient), 1), quotient),
mag.shift - 1);
Node* quotient = dividend;
if (base::bits::IsPowerOfTwo32(Abs(divisor))) {
uint32_t const shift = WhichPowerOf2Abs(divisor);
- DCHECK_NE(0, shift);
+ DCHECK_NE(0u, shift);
if (shift > 1) {
quotient = Word32Sar(quotient, 31);
}
for (auto curr = move_ops->begin(); curr != move_ops->end(); ++curr) {
if (curr->IsEliminated()) continue;
if (curr->destination()->Equals(move->source())) {
- DCHECK_EQ(nullptr, replacement);
+ DCHECK(!replacement);
replacement = curr;
if (to_eliminate != nullptr) break;
} else if (curr->destination()->Equals(move->destination())) {
- DCHECK_EQ(nullptr, to_eliminate);
+ DCHECK(!to_eliminate);
to_eliminate = curr;
if (replacement != nullptr) break;
}
use->from->GetInputRecordPtr(use->input_index)->to = replace_to;
}
if (!replace_to->last_use_) {
- DCHECK_EQ(nullptr, replace_to->first_use_);
+ DCHECK(!replace_to->first_use_);
replace_to->first_use_ = first_use_;
replace_to->last_use_ = last_use_;
} else if (first_use_) {
if (osr_loop_entry == nullptr) {
// No OSR entry found, do nothing.
- CHECK_NE(nullptr, osr_normal_entry);
+ CHECK(osr_normal_entry);
return true;
}
for (Node* use : osr_loop_entry->uses()) {
if (use->opcode() == IrOpcode::kLoop) {
- CHECK_EQ(nullptr, osr_loop); // should be only one OSR loop.
+ CHECK(!osr_loop); // should be only one OSR loop.
osr_loop = use; // found the OSR loop.
}
}
- CHECK_NE(nullptr, osr_loop); // Should have found the OSR loop.
+ CHECK(osr_loop); // Should have found the OSR loop.
// Analyze the graph to determine how deeply nested the OSR loop is.
LoopTree* loop_tree = LoopFinder::BuildLoopTree(graph, tmp_zone);
LoopAssignmentAnalysis* loop_assignment() const { return loop_assignment_; }
void set_loop_assignment(LoopAssignmentAnalysis* loop_assignment) {
- DCHECK_EQ(nullptr, loop_assignment_);
+ DCHECK(!loop_assignment_);
loop_assignment_ = loop_assignment;
}
Node* context_node() const { return context_node_; }
void set_context_node(Node* context_node) {
- DCHECK_EQ(nullptr, context_node_);
+ DCHECK(!context_node_);
context_node_ = context_node;
}
Schedule* schedule() const { return schedule_; }
void set_schedule(Schedule* schedule) {
- DCHECK_EQ(nullptr, schedule_);
+ DCHECK(!schedule_);
schedule_ = schedule;
}
}
void InitializeInstructionSequence() {
- DCHECK_EQ(nullptr, sequence_);
+ DCHECK(!sequence_);
InstructionBlocks* instruction_blocks =
InstructionSequence::InstructionBlocksFor(instruction_zone(),
schedule());
void InitializeRegisterAllocator(Zone* local_zone,
const RegisterConfiguration* config,
const char* debug_name) {
- DCHECK_EQ(nullptr, register_allocator_);
- DCHECK_EQ(nullptr, frame_);
+ DCHECK(!register_allocator_);
+ DCHECK(!frame_);
frame_ = new (instruction_zone()) Frame();
register_allocator_ = new (instruction_zone())
RegisterAllocator(config, local_zone, frame(), sequence(), debug_name);
i <= GapInstruction::LAST_INNER_POSITION; i++) {
GapInstruction::InnerPosition inner_pos =
static_cast<GapInstruction::InnerPosition>(i);
- CHECK_EQ(NULL, gap->GetParallelMove(inner_pos));
+ CHECK(!gap->GetParallelMove(inner_pos));
}
}
for (; p != nullptr; p = p->first_pred_phi) {
if (p->virtual_register == v->use_vreg) break;
}
- CHECK_NE(nullptr, p);
+ CHECK(p);
}
// Mark the use.
it->second->use_vreg = use_vreg;
return;
}
// Use of a phi value without definition.
- CHECK(false);
+ UNREACHABLE();
}
private:
void LiveRange::SetSpillRange(SpillRange* spill_range) {
DCHECK(HasNoSpillType() || HasSpillRange());
- DCHECK_NE(spill_range, nullptr);
+ DCHECK(spill_range);
spill_type_ = SpillType::kSpillRange;
spill_range_ = spill_range;
}
// single-exit region that makes up a minimal component to be scheduled.
if (IsSingleEntrySingleExitRegion(node, exit)) {
Trace("Found SESE at #%d:%s\n", node->id(), node->op()->mnemonic());
- DCHECK_EQ(NULL, component_entry_);
+ DCHECK(!component_entry_);
component_entry_ = node;
continue;
}
Queue(node->InputAt(i));
}
}
- DCHECK_NE(NULL, component_entry_);
+ DCHECK(component_entry_);
for (NodeVector::iterator i = control_.begin(); i != control_.end(); ++i) {
ConnectBlocks(*i); // Connect block to its predecessor/successors.
buffer[1] = NULL;
for (Node* use : node->uses()) {
if (use->opcode() == true_opcode) {
- DCHECK_EQ(NULL, buffer[0]);
+ DCHECK(!buffer[0]);
buffer[0] = use;
}
if (use->opcode() == false_opcode) {
- DCHECK_EQ(NULL, buffer[1]);
+ DCHECK(!buffer[1]);
buffer[1] = use;
}
}
- DCHECK_NE(NULL, buffer[0]);
- DCHECK_NE(NULL, buffer[1]);
+ DCHECK(buffer[0]);
+ DCHECK(buffer[1]);
}
void CollectSuccessorBlocks(Node* node, BasicBlock** buffer,
}
void TraceConnect(Node* node, BasicBlock* block, BasicBlock* succ) {
- DCHECK_NE(NULL, block);
+ DCHECK(block);
if (succ == NULL) {
Trace("Connect #%d:%s, B%d -> end\n", node->id(), node->op()->mnemonic(),
block->id().ToInt());
// that is for the graph spanned between the schedule's start and end blocks.
void ComputeSpecialRPO() {
DCHECK(schedule_->end()->SuccessorCount() == 0);
- DCHECK_EQ(NULL, order_); // Main order does not exist yet.
+ DCHECK(!order_); // Main order does not exist yet.
ComputeAndInsertSpecialRPO(schedule_->start(), schedule_->end());
}
// that is for the graph spanned between the given {entry} and {end} blocks,
// then updates the existing ordering with this new information.
void UpdateSpecialRPO(BasicBlock* entry, BasicBlock* end) {
- DCHECK_NE(NULL, order_); // Main order to be updated is present.
+ DCHECK(order_); // Main order to be updated is present.
ComputeAndInsertSpecialRPO(entry, end);
}
void Verifier::Run(Graph* graph, Typing typing) {
- CHECK_NE(NULL, graph->start());
- CHECK_NE(NULL, graph->end());
+ CHECK_NOT_NULL(graph->start());
+ CHECK_NOT_NULL(graph->end());
Zone zone;
Visitor visitor(&zone, typing);
for (Node* node : AllNodes(&zone, graph).live) visitor.Check(node);
BasicBlock* dom = block->dominator();
if (b == 0) {
// All blocks except start should have a dominator.
- CHECK_EQ(NULL, dom);
+ CHECK_NULL(dom);
} else {
// Check that the immediate dominator appears somewhere before the block.
- CHECK_NE(NULL, dom);
+ CHECK_NOT_NULL(dom);
CHECK_LT(dom->rpo_number(), block->rpo_number());
}
}
zone = new Zone();
}
used_.push_back(zone);
- DCHECK_EQ(0, zone->allocation_size());
+ DCHECK_EQ(0u, zone->allocation_size());
return zone;
}
delete zone;
} else {
zone->DeleteAll();
- DCHECK_EQ(0, zone->allocation_size());
+ DCHECK_EQ(0u, zone->allocation_size());
unused_.push_back(zone);
}
}
Deoptimizer* Deoptimizer::Grab(Isolate* isolate) {
Deoptimizer* result = isolate->deoptimizer_data()->current_;
- CHECK_NE(result, NULL);
+ CHECK_NOT_NULL(result);
result->DeleteFrameDescriptions();
isolate->deoptimizer_data()->current_ = NULL;
return result;
bool is_bottommost = (0 == frame_index);
bool is_topmost = (output_count_ - 1 == frame_index);
CHECK(frame_index >= 0 && frame_index < output_count_);
- CHECK_EQ(output_[frame_index], NULL);
+ CHECK_NULL(output_[frame_index]);
output_[frame_index] = output_frame;
// The top address for the bottommost output frame can be computed from
output_offset -= kPointerSize;
DoTranslateCommand(iterator, frame_index, output_offset);
}
- CHECK_EQ(0, output_offset);
+ CHECK_EQ(0u, output_offset);
// Compute this frame's PC, state, and continuation.
Code* non_optimized_code = function->shared()->code();
top_address + output_offset, output_offset, value);
}
- CHECK_EQ(0, output_offset);
+ CHECK_EQ(0u, output_offset);
intptr_t pc = reinterpret_cast<intptr_t>(
construct_stub->instruction_start() +
// A frame for an accessor stub can not be the topmost or bottommost one.
CHECK(frame_index > 0 && frame_index < output_count_ - 1);
- CHECK_EQ(output_[frame_index], NULL);
+ CHECK_NULL(output_[frame_index]);
output_[frame_index] = output_frame;
// The top address of the frame is computed from the previous frame's top and
DoTranslateCommand(iterator, frame_index, output_offset);
}
- CHECK_EQ(output_offset, 0);
+ CHECK_EQ(0u, output_offset);
Smi* offset = is_setter_stub_frame ?
isolate_->heap()->setter_stub_deopt_pc_offset() :
}
}
- CHECK_EQ(output_frame_offset, 0);
+ CHECK_EQ(0u, output_frame_offset);
if (!arg_count_known) {
CHECK_GE(arguments_length_offset, 0);
SOFT,
// This last bailout type is not really a bailout, but used by the
// debugger to deoptimize stack frames to allow inspection.
- DEBUGGER
+ DEBUGGER,
+ kBailoutTypesWithCodeEntry = SOFT + 1
};
- static const int kBailoutTypesWithCodeEntry = SOFT + 1;
-
struct Reason {
Reason(int r, const char* m, const char* d)
: raw_position(r), mnemonic(m), detail(d) {}
// Create initial objects
CreateInitialObjects();
- CHECK_EQ(0, gc_count_);
+ CHECK_EQ(0u, gc_count_);
set_native_contexts_list(undefined_value());
set_array_buffers_list(undefined_value());
INLINE(void set_top(Address top)) {
SLOW_DCHECK(top == NULL ||
- (reinterpret_cast<intptr_t>(top) & HeapObjectTagMask()) == 0);
+ (reinterpret_cast<intptr_t>(top) & kHeapObjectTagMask) == 0);
top_ = top;
}
INLINE(Address top()) const {
SLOW_DCHECK(top_ == NULL ||
- (reinterpret_cast<intptr_t>(top_) & HeapObjectTagMask()) == 0);
+ (reinterpret_cast<intptr_t>(top_) & kHeapObjectTagMask) == 0);
return top_;
}
INLINE(void set_limit(Address limit)) {
SLOW_DCHECK(limit == NULL ||
- (reinterpret_cast<intptr_t>(limit) & HeapObjectTagMask()) == 0);
+ (reinterpret_cast<intptr_t>(limit) & kHeapObjectTagMask) == 0);
limit_ = limit;
}
INLINE(Address limit()) const {
SLOW_DCHECK(limit_ == NULL ||
- (reinterpret_cast<intptr_t>(limit_) & HeapObjectTagMask()) ==
+ (reinterpret_cast<intptr_t>(limit_) & kHeapObjectTagMask) ==
0);
return limit_;
}
instr->DeleteAndReplaceWith(entry->check_);
INC_STAT(redundant_);
} else if (entry->state_ == HCheckTableEntry::UNCHECKED_STABLE) {
- DCHECK_EQ(NULL, entry->check_);
+ DCHECK_NULL(entry->check_);
TRACE(("Marking redundant CheckMaps #%d at B%d as stability check\n",
instr->id(), instr->block()->block_id()));
instr->set_maps(entry->maps_->Copy(graph->zone()));
bool compact = false;
for (int i = 0; i < size_; i++) {
HCheckTableEntry* entry = &entries_[i];
- DCHECK(entry->object_ != NULL);
+ DCHECK_NOT_NULL(entry->object_);
if (phase_->aliasing_->MayAlias(entry->object_, object)) {
entry->object_ = NULL;
compact = true;
}
}
if (compact) Compact();
- DCHECK(Find(object) == NULL);
+ DCHECK_NULL(Find(object));
}
void Compact() {
case kCallApiGetter:
// Receiver and prototype chain cannot have changed.
DCHECK_EQ(0, argc);
- DCHECK_EQ(NULL, receiver);
+ DCHECK_NULL(receiver);
// Receiver is on expression stack.
receiver = Pop();
Add<HPushArguments>(receiver);
is_store = true;
// Receiver and prototype chain cannot have changed.
DCHECK_EQ(1, argc);
- DCHECK_EQ(NULL, receiver);
+ DCHECK_NULL(receiver);
// Receiver and value are on expression stack.
HValue* value = Pop();
receiver = Pop();
void HOptimizedGraphBuilder::GenerateDateField(CallRuntime* call) {
DCHECK(call->arguments()->length() == 2);
- DCHECK_NE(NULL, call->arguments()->at(1)->AsLiteral());
+ DCHECK_NOT_NULL(call->arguments()->at(1)->AsLiteral());
Smi* index = Smi::cast(*(call->arguments()->at(1)->AsLiteral()->value()));
CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
HValue* date = Pop();
// If either is a Smi (we know that not both are), then they can only
// be equal if the other is a HeapNumber. If so, use the slow case.
STATIC_ASSERT(kSmiTag == 0);
- DCHECK_EQ(0, Smi::FromInt(0));
+ DCHECK_EQ(static_cast<Smi*>(0), Smi::FromInt(0));
__ mov(ecx, Immediate(kSmiTagMask));
__ and_(ecx, eax);
__ test(ecx, edx);
void FullCodeGenerator::EmitDateField(CallRuntime* expr) {
ZoneList<Expression*>* args = expr->arguments();
DCHECK(args->length() == 2);
- DCHECK_NE(NULL, args->at(1)->AsLiteral());
+ DCHECK_NOT_NULL(args->at(1)->AsLiteral());
Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->value()));
VisitForAccumulatorValue(args->at(0)); // Load the object.
ZoneList<Expression*>* args = expr->arguments();
DCHECK_EQ(2, args->length());
- DCHECK_NE(NULL, args->at(0)->AsLiteral());
+ DCHECK_NOT_NULL(args->at(0)->AsLiteral());
int cache_id = Smi::cast(*(args->at(0)->AsLiteral()->value()))->value();
Handle<FixedArray> jsfunction_result_caches(
__ mov(FieldOperand(object_reg, HeapObject::kMapOffset),
Immediate(to_map));
// Write barrier.
- DCHECK_NE(instr->temp(), NULL);
+ DCHECK_NOT_NULL(instr->temp());
__ RecordWriteForMap(object_reg, to_map, new_map_reg,
ToRegister(instr->temp()),
kDontSaveFPRegs);
case LookupIterator::ACCESSOR:
Handle<ExecutableAccessorInfo> info =
Handle<ExecutableAccessorInfo>::cast(it->GetAccessors());
- DCHECK_NE(NULL, info->getter());
+ DCHECK_NOT_NULL(info->getter());
GenerateLoadCallback(reg, info);
}
}
}
+// static
+STATIC_CONST_MEMBER_DEFINITION const int BinaryOpICState::FIRST_TOKEN;
+
+
+// static
+STATIC_CONST_MEMBER_DEFINITION const int BinaryOpICState::LAST_TOKEN;
+
+
BinaryOpICState::BinaryOpICState(Isolate* isolate, ExtraICState extra_ic_state)
: isolate_(isolate) {
op_ =
target = stub.GetCode();
// Sanity check the generic stub.
- DCHECK_EQ(NULL, target->FindFirstAllocationSite());
+ DCHECK_NULL(target->FindFirstAllocationSite());
}
set_target(*target);
: kPointerSizeLog2 == StubCache::kCacheIndexShift);
ScaleFactor scale_factor = kPointerSize == kInt64Size ? times_2 : times_1;
- DCHECK_EQ(3 * kPointerSize, sizeof(StubCache::Entry));
+ DCHECK_EQ(3u * kPointerSize, sizeof(StubCache::Entry));
// The offset register holds the entry offset times four (due to masking
// and shifting optimizations).
ExternalReference key_offset(isolate->stub_cache()->key_reference(table));
// TODO(svenpanne) The assertion below would fire if an embedder does not
// cleanly dispose all Isolates before disposing v8, so we are conservative
// and leave it out for now.
- // DCHECK_EQ(NULL, list_);
+ // DCHECK_NULL(list_);
}
void LoopChoiceNode::AddLoopAlternative(GuardedAlternative alt) {
- DCHECK_EQ(loop_node_, NULL);
+ DCHECK_NULL(loop_node_);
AddAlternative(alt);
loop_node_ = alt.node();
}
void LoopChoiceNode::AddContinueAlternative(GuardedAlternative alt) {
- DCHECK_EQ(continue_node_, NULL);
+ DCHECK_NULL(continue_node_);
AddAlternative(alt);
continue_node_ = alt.node();
}
macro_assembler->GoTo(trace->loop_label());
return;
}
- DCHECK(trace->stop_node() == NULL);
+ DCHECK_NULL(trace->stop_node());
if (!trace->is_trivial()) {
trace->Flush(compiler, this);
return;
ZoneList<CharacterRange>** included,
ZoneList<CharacterRange>** excluded,
Zone* zone) {
- DCHECK_EQ(NULL, *included);
- DCHECK_EQ(NULL, *excluded);
+ DCHECK_NULL(*included);
+ DCHECK_NULL(*excluded);
DispatchTable table(zone);
for (int i = 0; i < base->length(); i++)
table.AddRange(base->at(i), CharacterRangeSplitter::kInBase, zone);
public:
CharacterRange() : from_(0), to_(0) { }
// For compatibility with the CHECK_OK macro
- CharacterRange(void* null) { DCHECK_EQ(NULL, null); } //NOLINT
+ CharacterRange(void* null) { DCHECK_NULL(null); } // NOLINT
CharacterRange(uc16 from, uc16 to) : from_(from), to_(to) { }
static void AddClassEscape(uc16 type, ZoneList<CharacterRange>* ranges,
Zone* zone);
CHECK_NE(size, -1);
perf_output_handle_ =
base::OS::FOpen(perf_dump_name.start(), base::OS::LogFileOpenMode);
- CHECK_NE(perf_output_handle_, NULL);
+ CHECK_NOT_NULL(perf_output_handle_);
setvbuf(perf_output_handle_, NULL, _IOFBF, kLogBufferSize);
}
void FullCodeGenerator::EmitDateField(CallRuntime* expr) {
ZoneList<Expression*>* args = expr->arguments();
DCHECK(args->length() == 2);
- DCHECK_NE(NULL, args->at(1)->AsLiteral());
+ DCHECK_NOT_NULL(args->at(1)->AsLiteral());
Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->value()));
VisitForAccumulatorValue(args->at(0)); // Load the object.
ZoneList<Expression*>* args = expr->arguments();
DCHECK_EQ(2, args->length());
- DCHECK_NE(NULL, args->at(0)->AsLiteral());
+ DCHECK_NOT_NULL(args->at(0)->AsLiteral());
int cache_id = Smi::cast(*(args->at(0)->AsLiteral()->value()))->value();
Handle<FixedArray> jsfunction_result_caches(
void FullCodeGenerator::EmitDateField(CallRuntime* expr) {
ZoneList<Expression*>* args = expr->arguments();
DCHECK(args->length() == 2);
- DCHECK_NE(NULL, args->at(1)->AsLiteral());
+ DCHECK_NOT_NULL(args->at(1)->AsLiteral());
Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->value()));
VisitForAccumulatorValue(args->at(0)); // Load the object.
ZoneList<Expression*>* args = expr->arguments();
DCHECK_EQ(2, args->length());
- DCHECK_NE(NULL, args->at(0)->AsLiteral());
+ DCHECK_NOT_NULL(args->at(0)->AsLiteral());
int cache_id = Smi::cast(*(args->at(0)->AsLiteral()->value()))->value();
Handle<FixedArray> jsfunction_result_caches(
void Symbol::SymbolVerify() {
CHECK(IsSymbol());
CHECK(HasHashCode());
- CHECK_GT(Hash(), 0);
+ CHECK_GT(Hash(), 0u);
CHECK(name()->IsUndefined() || name()->IsString());
CHECK(flags()->IsSmi());
}
return T::kNotFound;
} else {
DCHECK(len >= valid_entries);
- DCHECK_EQ(NULL, out_insertion_index); // Not supported here.
+ DCHECK_NULL(out_insertion_index); // Not supported here.
for (int number = 0; number < valid_entries; number++) {
Name* entry = array->GetKey(number);
uint32_t current_hash = entry->Hash();
CAST_ACCESSOR(WeakHashTable)
+// static
+template <class Traits>
+STATIC_CONST_MEMBER_DEFINITION const InstanceType
+ FixedTypedArray<Traits>::kInstanceType;
+
+
template <class Traits>
FixedTypedArray<Traits>* FixedTypedArray<Traits>::cast(Object* object) {
SLOW_DCHECK(object->IsHeapObject() &&
FixedArray* code_map = FixedArray::cast(optimized_code_map());
if (!bound()) {
FixedArray* cached_literals = FixedArray::cast(code_map->get(index + 1));
- DCHECK_NE(NULL, cached_literals);
+ DCHECK_NOT_NULL(cached_literals);
return cached_literals;
}
return NULL;
DCHECK(index > kEntriesStart);
FixedArray* code_map = FixedArray::cast(optimized_code_map());
Code* code = Code::cast(code_map->get(index));
- DCHECK_NE(NULL, code);
+ DCHECK_NOT_NULL(code);
return code;
}
if (FLAG_concurrent_osr) {
#ifdef DEBUG
for (int i = 0; i < osr_buffer_capacity_; i++) {
- CHECK_EQ(NULL, osr_buffer_[i]);
+ CHECK_NULL(osr_buffer_[i]);
}
#endif
DeleteArray(osr_buffer_);
return NULL;
}
OptimizedCompileJob* job = input_queue_[InputQueueIndex(0)];
- DCHECK_NE(NULL, job);
+ DCHECK_NOT_NULL(job);
input_queue_shift_ = InputQueueIndex(1);
input_queue_length_--;
if (flag) {
void OptimizingCompilerThread::CompileNext(OptimizedCompileJob* job) {
- DCHECK_NE(NULL, job);
+ DCHECK_NOT_NULL(job);
// The function may have already been optimized by OSR. Simply continue.
OptimizedCompileJob::Status status = job->OptimizeGraph();
CHECK_NE(size, -1);
perf_output_handle_ =
base::OS::FOpen(perf_dump_name.start(), base::OS::LogFileOpenMode);
- CHECK_NE(perf_output_handle_, NULL);
+ CHECK_NOT_NULL(perf_output_handle_);
setvbuf(perf_output_handle_, NULL, _IOFBF, kLogBufferSize);
LogWriteHeader();
void FullCodeGenerator::EmitDateField(CallRuntime* expr) {
ZoneList<Expression*>* args = expr->arguments();
DCHECK(args->length() == 2);
- DCHECK_NE(NULL, args->at(1)->AsLiteral());
+ DCHECK_NOT_NULL(args->at(1)->AsLiteral());
Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->value()));
VisitForAccumulatorValue(args->at(0)); // Load the object.
void FullCodeGenerator::EmitGetFromCache(CallRuntime* expr) {
ZoneList<Expression*>* args = expr->arguments();
DCHECK_EQ(2, args->length());
- DCHECK_NE(NULL, args->at(0)->AsLiteral());
+ DCHECK_NOT_NULL(args->at(0)->AsLiteral());
int cache_id = Smi::cast(*(args->at(0)->AsLiteral()->value()))->value();
Handle<FixedArray> jsfunction_result_caches(
case FAST_HOLEY_ELEMENTS:
case FAST_ELEMENTS:
case DICTIONARY_ELEMENTS:
- DCHECK_EQ(0, length);
+ DCHECK_EQ(0u, length);
break;
default:
UNREACHABLE();
TypeCode type,
uint16_t id,
const char* name) {
- DCHECK_NE(NULL, address);
+ DCHECK_NOT_NULL(address);
ExternalReferenceEntry entry;
entry.address = address;
entry.code = EncodeExternal(type, id);
entry.name = name;
- DCHECK_NE(0, entry.code);
+ DCHECK_NE(0u, entry.code);
// Assert that the code is added in ascending order to rule out duplicates.
DCHECK((size() == 0) || (code(size() - 1) < entry.code));
refs_.Add(entry);
void Deserializer::Initialize(Isolate* isolate) {
- DCHECK_EQ(NULL, isolate_);
- DCHECK_NE(NULL, isolate);
+ DCHECK_NULL(isolate_);
+ DCHECK_NOT_NULL(isolate);
isolate_ = isolate;
- DCHECK_EQ(NULL, external_reference_decoder_);
+ DCHECK_NULL(external_reference_decoder_);
external_reference_decoder_ = new ExternalReferenceDecoder(isolate);
}
Initialize(isolate);
if (!ReserveSpace()) FatalProcessOutOfMemory("deserializing context");
// No active threads.
- DCHECK_EQ(NULL, isolate_->thread_manager()->FirstThreadStateInUse());
+ DCHECK_NULL(isolate_->thread_manager()->FirstThreadStateInUse());
// No active handles.
DCHECK(isolate_->handle_scope_implementer()->blocks()->is_empty());
isolate_->heap()->IterateSmiRoots(this);
} else {
DCHECK(space_index < kNumberOfPreallocatedSpaces);
Address address = high_water_[space_index];
- DCHECK_NE(NULL, address);
+ DCHECK_NOT_NULL(address);
high_water_[space_index] += size;
#ifdef DEBUG
// Assert that the current reserved chunk is still big enough.
void StartupSerializer::SerializeStrongReferences() {
Isolate* isolate = this->isolate();
// No active threads.
- CHECK_EQ(NULL, isolate->thread_manager()->FirstThreadStateInUse());
+ CHECK_NULL(isolate->thread_manager()->FirstThreadStateInUse());
// No active or weak handles.
CHECK(isolate->handle_scope_implementer()->blocks()->is_empty());
CHECK_EQ(0, isolate->global_handles()->NumberOfWeakHandles());
void Add(HeapObject* obj, BackReference b) {
DCHECK(b.is_valid());
- DCHECK_EQ(NULL, LookupEntry(map_, obj, false));
+ DCHECK_NULL(LookupEntry(map_, obj, false));
HashMap::Entry* entry = LookupEntry(map_, obj, true);
SetValue(entry, b.bitfield());
}
}
HeapObject* Get(int index) {
- DCHECK_NE(NULL, circular_queue_[index]);
+ DCHECK_NOT_NULL(circular_queue_[index]);
return circular_queue_[index];
}
// TODO(titzer): other immortable immovable objects are also fine.
DCHECK(!AllowHeapAllocation::IsAllowed() || handle->IsMap());
raw_address_ = reinterpret_cast<Address>(*handle);
- DCHECK_NE(raw_address_, NULL); // Non-null should imply non-zero address.
+ DCHECK_NOT_NULL(raw_address_); // Non-null should imply non-zero address.
}
handle_ = handle;
}
}
static void SetArrayBufferAllocator(v8::ArrayBuffer::Allocator *allocator) {
- CHECK_EQ(NULL, array_buffer_allocator_);
+ CHECK_NULL(array_buffer_allocator_);
array_buffer_allocator_ = allocator;
}
UnimplementedInstruction();
return count + 1;
}
- DCHECK_NE(NULL, mnem);
+ DCHECK_NOT_NULL(mnem);
AppendToBuffer("%s%c ", mnem, operand_size_code());
}
count += PrintRightOperand(data + count);
void FullCodeGenerator::EmitDateField(CallRuntime* expr) {
ZoneList<Expression*>* args = expr->arguments();
DCHECK(args->length() == 2);
- DCHECK_NE(NULL, args->at(1)->AsLiteral());
+ DCHECK_NOT_NULL(args->at(1)->AsLiteral());
Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->value()));
VisitForAccumulatorValue(args->at(0)); // Load the object.
ZoneList<Expression*>* args = expr->arguments();
DCHECK_EQ(2, args->length());
- DCHECK_NE(NULL, args->at(0)->AsLiteral());
+ DCHECK_NOT_NULL(args->at(0)->AsLiteral());
int cache_id = Smi::cast(*(args->at(0)->AsLiteral()->value()))->value();
Handle<FixedArray> jsfunction_result_caches(
Check(not_both_smis, kBothRegistersWereSmisInSelectNonSmi);
#endif
STATIC_ASSERT(kSmiTag == 0);
- DCHECK_EQ(0, Smi::FromInt(0));
+ DCHECK_EQ(static_cast<Smi*>(0), Smi::FromInt(0));
movl(kScratchRegister, Immediate(kSmiTagMask));
andp(kScratchRegister, src1);
testl(kScratchRegister, src2);
void FullCodeGenerator::EmitDateField(CallRuntime* expr) {
ZoneList<Expression*>* args = expr->arguments();
DCHECK(args->length() == 2);
- DCHECK_NE(NULL, args->at(1)->AsLiteral());
+ DCHECK_NOT_NUL(args->at(1)->AsLiteral());
Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->value()));
VisitForAccumulatorValue(args->at(0)); // Load the object.
ZoneList<Expression*>* args = expr->arguments();
DCHECK_EQ(2, args->length());
- DCHECK_NE(NULL, args->at(0)->AsLiteral());
+ DCHECK_NOT_NULL(args->at(0)->AsLiteral());
int cache_id = Smi::cast(*(args->at(0)->AsLiteral()->value()))->value();
Handle<FixedArray> jsfunction_result_caches(
'test-bignum.cc',
'test-bignum-dtoa.cc',
'test-bit-vector.cc',
- 'test-checks.cc',
'test-circular-queue.cc',
'test-compiler.cc',
'test-constantpool.cc',
v8::Local<v8::Value> result = CompileRun(code);
CHECK(result->IsString());
v8::String::Utf8Value utf8(result);
- CHECK_EQ(expected, *utf8);
+ CHECK_EQ(0, strcmp(expected, *utf8));
}
public:
HeapObjectsTracker() {
heap_profiler_ = i::Isolate::Current()->heap_profiler();
- CHECK_NE(NULL, heap_profiler_);
+ CHECK_NOT_NULL(heap_profiler_);
heap_profiler_->StartHeapObjectsTracking(true);
}
TEST(ParametersEqual) {
RawMachineAssemblerTester<int32_t> m(kMachInt32, kMachInt32);
Node* p1 = m.Parameter(1);
- CHECK_NE(NULL, p1);
+ CHECK(p1);
Node* p0 = m.Parameter(0);
- CHECK_NE(NULL, p0);
+ CHECK(p0);
CHECK_EQ(p0, m.Parameter(0));
CHECK_EQ(p1, m.Parameter(1));
}
Float64BinopTester bt(&m);
bt.AddReturn(bt.param0);
- FOR_FLOAT64_INPUTS(i) { CHECK_EQ(*i, bt.call(*i, 9.0)); }
+ FOR_FLOAT64_INPUTS(i) { CheckDoubleEq(*i, bt.call(*i, 9.0)); }
}
{
Float64BinopTester bt(&m);
bt.AddReturn(bt.param1);
- FOR_FLOAT64_INPUTS(i) { CHECK_EQ(*i, bt.call(-11.25, *i)); }
+ FOR_FLOAT64_INPUTS(i) { CheckDoubleEq(*i, bt.call(-11.25, *i)); }
}
}
void RunLeft(RawMachineAssemblerTester<int32_t>* m);
void RunRight(RawMachineAssemblerTester<int32_t>* m);
};
+
+// TODO(bmeurer): Drop this crap once we switch to GTest/Gmock.
+static inline void CheckDoubleEq(volatile double x, volatile double y) {
+ if (std::isnan(x)) {
+ CHECK(std::isnan(y));
+ } else {
+ CHECK_EQ(x, y);
+ }
+}
+
} // namespace compiler
} // namespace internal
} // namespace v8
const uint32_t supported_flags = CompilationInfo::kContextSpecializing |
CompilationInfo::kInliningEnabled |
CompilationInfo::kTypingEnabled;
- CHECK_EQ(0, flags_ & ~supported_flags);
+ CHECK_EQ(0u, flags_ & ~supported_flags);
}
explicit FunctionTester(Graph* graph)
void MachineCallHelper::InitParameters(GraphBuilder* builder,
CommonOperatorBuilder* common) {
- DCHECK_EQ(NULL, parameters_);
+ DCHECK(!parameters_);
graph_ = builder->graph();
int param_count = static_cast<int>(parameter_count());
if (param_count == 0) return;
Node* MachineCallHelper::Parameter(size_t index) {
- DCHECK_NE(NULL, parameters_);
+ DCHECK(parameters_);
DCHECK(index < parameter_count());
return parameters_[index];
}
void ResetCounts() { isolate()->basic_block_profiler()->ResetCounts(); }
void Expect(size_t size, uint32_t* expected) {
- CHECK_NE(NULL, isolate()->basic_block_profiler());
+ CHECK(isolate()->basic_block_profiler());
const BasicBlockProfiler::DataList* l =
isolate()->basic_block_profiler()->data_list();
CHECK_NE(0, static_cast<int>(l->size()));
{
Handle<Object> number = t.factory()->NewNumber(input);
t.Call(*number);
- CHECK_EQ(input, result);
+ CheckDoubleEq(input, result);
}
{
Handle<HeapNumber> number = t.factory()->NewHeapNumber(input);
t.Call(*number);
- CHECK_EQ(input, result);
+ CheckDoubleEq(input, result);
}
}
}
CHECK(IsUsedBy(T.start, T.p0));
T.Trim();
CHECK(!IsUsedBy(T.start, T.p0));
- CHECK_EQ(NULL, T.p0->InputAt(0));
+ CHECK(!T.p0->InputAt(0));
}
CHECK(!IsUsedBy(T.one, phi));
CHECK(!IsUsedBy(T.half, phi));
CHECK(!IsUsedBy(T.start, phi));
- CHECK_EQ(NULL, phi->InputAt(0));
- CHECK_EQ(NULL, phi->InputAt(1));
- CHECK_EQ(NULL, phi->InputAt(2));
+ CHECK(!phi->InputAt(0));
+ CHECK(!phi->InputAt(1));
+ CHECK(!phi->InputAt(2));
}
T.Trim();
for (int i = 0; i < kDepth; i++) {
CHECK(!IsUsedBy(live[i], dead[i]));
- CHECK_EQ(NULL, dead[i]->InputAt(0));
+ CHECK(!dead[i]->InputAt(0));
CHECK_EQ(i == 0 ? T.start : live[i - 1], live[i]->InputAt(0));
}
}
CHECK(!IsUsedBy(loop, phi));
CHECK(!IsUsedBy(T.one, phi));
CHECK(!IsUsedBy(T.half, phi));
- CHECK_EQ(NULL, phi->InputAt(0));
- CHECK_EQ(NULL, phi->InputAt(1));
- CHECK_EQ(NULL, phi->InputAt(2));
+ CHECK(!phi->InputAt(0));
+ CHECK(!phi->InputAt(1));
+ CHECK(!phi->InputAt(2));
}
CHECK(IsUsedBy(k, phi));
T->Trim();
CHECK(!IsUsedBy(k, phi));
- CHECK_EQ(NULL, phi->InputAt(0));
- CHECK_EQ(NULL, phi->InputAt(1));
+ CHECK(!phi->InputAt(0));
+ CHECK(!phi->InputAt(1));
}
R.graph.SetEnd(end);
R.ReduceGraph();
CHECK(merge->IsDead());
- CHECK_EQ(NULL, end->InputAt(0)); // end dies.
+ CHECK(!end->InputAt(0)); // end dies.
}
}
for (auto block : *blocks) {
CHECK_EQ(block->rpo_number(), R.BlockAt(block)->rpo_number().ToInt());
CHECK_EQ(block->id().ToInt(), R.BlockAt(block)->id().ToInt());
- CHECK_EQ(NULL, block->loop_end());
+ CHECK(!block->loop_end());
}
}
R.code->AddGapMove(index, op1, op2);
GapInstruction* gap = R.code->GapAt(index);
ParallelMove* move = gap->GetParallelMove(GapInstruction::START);
- CHECK_NE(NULL, move);
+ CHECK(move);
const ZoneList<MoveOperands>* move_operands = move->move_operands();
CHECK_EQ(1, move_operands->length());
MoveOperands* cur = &move_operands->at(0);
double zero_value = OpParameter<double>(zero);
double minus_zero_value = OpParameter<double>(minus_zero);
- CHECK_EQ(0.0, zero_value);
- CHECK_NE(-0.0, zero_value);
- CHECK_EQ(-0.0, minus_zero_value);
- CHECK_NE(0.0, minus_zero_value);
+ CHECK(bit_cast<uint64_t>(0.0) == bit_cast<uint64_t>(zero_value));
+ CHECK(bit_cast<uint64_t>(-0.0) != bit_cast<uint64_t>(zero_value));
+ CHECK(bit_cast<uint64_t>(0.0) != bit_cast<uint64_t>(minus_zero_value));
+ CHECK(bit_cast<uint64_t>(-0.0) == bit_cast<uint64_t>(minus_zero_value));
}
}
}
- CHECK_EQ(NULL, effect_use); // should have done all cases above.
+ CHECK(!effect_use); // should have done all cases above.
}
Linkage linkage(info.zone(), &info);
CallDescriptor* descriptor = linkage.GetIncomingDescriptor();
- CHECK_NE(NULL, descriptor);
+ CHECK(descriptor);
CHECK_EQ(1 + i, static_cast<int>(descriptor->JSParameterCount()));
CHECK_EQ(1, static_cast<int>(descriptor->ReturnCount()));
Linkage linkage(info.zone(), &info);
// TODO(titzer): test linkage creation with a bonafide code stub.
// this just checks current behavior.
- CHECK_EQ(NULL, linkage.GetIncomingDescriptor());
+ CHECK(!linkage.GetIncomingDescriptor());
}
for (int i = 0; i < 32; i++) {
CallDescriptor* descriptor =
linkage.GetJSCallDescriptor(i, CallDescriptor::kNoFlags);
- CHECK_NE(NULL, descriptor);
+ CHECK(descriptor);
CHECK_EQ(i, static_cast<int>(descriptor->JSParameterCount()));
CHECK_EQ(1, static_cast<int>(descriptor->ReturnCount()));
CHECK_EQ(Operator::kNoProperties, descriptor->properties());
void CheckLoop(Node** header, int header_count, Node** body, int body_count) {
LoopTree* tree = GetLoopTree();
LoopTree::Loop* loop = tree->ContainingLoop(header[0]);
- CHECK_NE(NULL, loop);
+ CHECK(loop);
CHECK(header_count == static_cast<int>(loop->HeaderSize()));
for (int i = 0; i < header_count; i++) {
Node* header = chain[i];
// Each header should be in a loop.
LoopTree::Loop* loop = tree->ContainingLoop(header);
- CHECK_NE(NULL, loop);
+ CHECK(loop);
// Check parentage.
LoopTree::Loop* parent =
i == 0 ? NULL : tree->ContainingLoop(chain[i - 1]);
Scope* scope = info.function()->scope();
AstValueFactory* factory = info.ast_value_factory();
- CHECK_NE(NULL, scope);
+ CHECK(scope);
if (result == NULL) {
AstLoopAssignmentAnalyzer analyzer(main_zone(), &info);
result = analyzer.Analyze();
- CHECK_NE(NULL, result);
+ CHECK(result);
}
const i::AstRawString* name = factory->GetOneByteString(var_name);
i::Variable* var = scope->Lookup(name);
- CHECK_NE(NULL, var);
+ CHECK(var);
if (var->location() == Variable::UNALLOCATED) {
CHECK_EQ(0, expected);
// the {expect} value.
template <typename T>
void CheckFoldBinop(volatile T expect, Node* a, Node* b) {
- CHECK_NE(NULL, binop);
+ CHECK(binop);
Node* n = CreateBinopNode(a, b);
MachineOperatorReducer reducer(&jsgraph);
Reduction reduction = reducer.Reduce(n);
// Check that the reduction of this binop applied to {a} and {b} yields
// the {expect} node.
void CheckBinop(Node* expect, Node* a, Node* b) {
- CHECK_NE(NULL, binop);
+ CHECK(binop);
Node* n = CreateBinopNode(a, b);
MachineOperatorReducer reducer(&jsgraph);
Reduction reduction = reducer.Reduce(n);
// this binop applied to {left_expect} and {right_expect}.
void CheckFoldBinop(Node* left_expect, Node* right_expect, Node* left,
Node* right) {
- CHECK_NE(NULL, binop);
+ CHECK(binop);
Node* n = CreateBinopNode(left, right);
MachineOperatorReducer reducer(&jsgraph);
Reduction reduction = reducer.Reduce(n);
template <typename T>
void CheckFoldBinop(volatile T left_expect, const Operator* op_expect,
Node* right_expect, Node* left, Node* right) {
- CHECK_NE(NULL, binop);
+ CHECK(binop);
Node* n = CreateBinopNode(left, right);
MachineOperatorReducer reducer(&jsgraph);
Reduction r = reducer.Reduce(n);
template <typename T>
void CheckFoldBinop(Node* left_expect, const Operator* op_expect,
volatile T right_expect, Node* left, Node* right) {
- CHECK_NE(NULL, binop);
+ CHECK(binop);
Node* n = CreateBinopNode(left, right);
MachineOperatorReducer reducer(&jsgraph);
Reduction r = reducer.Reduce(n);
}
-static void CheckNans(ReducerTester* R) {
- Node* x = R->Parameter();
- std::vector<double> nans = ValueHelper::nan_vector();
- for (std::vector<double>::const_iterator pl = nans.begin(); pl != nans.end();
- ++pl) {
- for (std::vector<double>::const_iterator pr = nans.begin();
- pr != nans.end(); ++pr) {
- Node* nan1 = R->Constant<double>(*pl);
- Node* nan2 = R->Constant<double>(*pr);
- R->CheckBinop(nan1, x, nan1); // x op NaN => NaN
- R->CheckBinop(nan1, nan1, x); // NaN op x => NaN
- R->CheckBinop(nan1, nan2, nan1); // NaN op NaN => NaN
- }
- }
-}
-
-
-TEST(ReduceFloat64Add) {
- ReducerTester R;
- R.binop = R.machine.Float64Add();
-
- FOR_FLOAT64_INPUTS(pl) {
- FOR_FLOAT64_INPUTS(pr) {
- double x = *pl, y = *pr;
- R.CheckFoldBinop<double>(x + y, x, y);
- }
- }
-
- FOR_FLOAT64_INPUTS(i) {
- Double tmp(*i);
- if (!tmp.IsSpecial() || tmp.IsInfinite()) {
- // Don't check NaNs as they are reduced more.
- R.CheckPutConstantOnRight(*i);
- }
- }
-
- CheckNans(&R);
-}
-
-
-TEST(ReduceFloat64Sub) {
- ReducerTester R;
- R.binop = R.machine.Float64Sub();
-
- FOR_FLOAT64_INPUTS(pl) {
- FOR_FLOAT64_INPUTS(pr) {
- double x = *pl, y = *pr;
- R.CheckFoldBinop<double>(x - y, x, y);
- }
- }
-
- Node* zero = R.Constant<double>(0.0);
- Node* x = R.Parameter();
-
- R.CheckBinop(x, x, zero); // x - 0.0 => x
-
- CheckNans(&R);
-}
-
-
-TEST(ReduceFloat64Mul) {
- ReducerTester R;
- R.binop = R.machine.Float64Mul();
-
- FOR_FLOAT64_INPUTS(pl) {
- FOR_FLOAT64_INPUTS(pr) {
- double x = *pl, y = *pr;
- R.CheckFoldBinop<double>(x * y, x, y);
- }
- }
-
- double inf = V8_INFINITY;
- R.CheckPutConstantOnRight(-inf);
- R.CheckPutConstantOnRight(-0.1);
- R.CheckPutConstantOnRight(0.1);
- R.CheckPutConstantOnRight(inf);
-
- Node* x = R.Parameter();
- Node* one = R.Constant<double>(1.0);
-
- R.CheckBinop(x, x, one); // x * 1.0 => x
- R.CheckBinop(x, one, x); // 1.0 * x => x
-
- CheckNans(&R);
-}
-
-
-TEST(ReduceFloat64Div) {
- ReducerTester R;
- R.binop = R.machine.Float64Div();
-
- FOR_FLOAT64_INPUTS(pl) {
- FOR_FLOAT64_INPUTS(pr) {
- double x = *pl, y = *pr;
- R.CheckFoldBinop<double>(x / y, x, y);
- }
- }
-
- Node* x = R.Parameter();
- Node* one = R.Constant<double>(1.0);
-
- R.CheckBinop(x, x, one); // x / 1.0 => x
-
- CheckNans(&R);
-}
-
-
-TEST(ReduceFloat64Mod) {
- ReducerTester R;
- R.binop = R.machine.Float64Mod();
-
- FOR_FLOAT64_INPUTS(pl) {
- FOR_FLOAT64_INPUTS(pr) {
- double x = *pl, y = *pr;
- R.CheckFoldBinop<double>(modulo(x, y), x, y);
- }
- }
-
- Node* x = R.Parameter();
- Node* zero = R.Constant<double>(0.0);
-
- R.CheckFoldBinop<double>(std::numeric_limits<double>::quiet_NaN(), x, zero);
-
- CheckNans(&R);
-}
-
-
// TODO(titzer): test MachineOperatorReducer for Word64And
// TODO(titzer): test MachineOperatorReducer for Word64Or
// TODO(titzer): test MachineOperatorReducer for Word64Xor
// TODO(titzer): test MachineOperatorReducer for ChangeInt32ToFloat64
// TODO(titzer): test MachineOperatorReducer for ChangeFloat64ToInt32
// TODO(titzer): test MachineOperatorReducer for Float64Compare
+// TODO(titzer): test MachineOperatorReducer for Float64Add
+// TODO(titzer): test MachineOperatorReducer for Float64Sub
+// TODO(titzer): test MachineOperatorReducer for Float64Mul
+// TODO(titzer): test MachineOperatorReducer for Float64Div
+// TODO(titzer): test MachineOperatorReducer for Float64Mod
for (int i = -2000000000; i < 2000000000; i += 3315177) {
Node** pos = cache.Find(graph.zone(), i);
- CHECK_NE(NULL, pos);
+ CHECK(pos);
for (int j = 0; j < 3; j++) {
Node** npos = cache.Find(graph.zone(), i);
CHECK_EQ(pos, npos);
for (int64_t i = -2000000000; i < 2000000000; i += 3315177) {
Node** pos = cache.Find(graph.zone(), i);
- CHECK_NE(NULL, pos);
+ CHECK(pos);
for (int j = 0; j < 3; j++) {
Node** npos = cache.Find(graph.zone(), i);
CHECK_EQ(pos, npos);
n1->RemoveAllInputs();
CHECK_EQ(1, n1->InputCount());
CHECK_EQ(1, n0->UseCount());
- CHECK_EQ(NULL, n1->InputAt(0));
+ CHECK(!n1->InputAt(0));
CHECK_EQ(1, n1->UseCount());
n2->RemoveAllInputs();
CHECK_EQ(2, n2->InputCount());
CHECK_EQ(0, n0->UseCount());
CHECK_EQ(0, n1->UseCount());
- CHECK_EQ(NULL, n2->InputAt(0));
- CHECK_EQ(NULL, n2->InputAt(1));
+ CHECK(!n2->InputAt(0));
+ CHECK(!n2->InputAt(1));
}
{
n1->RemoveAllInputs();
CHECK_EQ(1, n1->InputCount());
CHECK_EQ(0, n1->UseCount());
- CHECK_EQ(NULL, n1->InputAt(0));
+ CHECK(!n1->InputAt(0));
}
}
Operator op1a(19, NONE, "Another1", 0, 0, 0, 0, 0, 0);
Operator op1b(19, FOLD, "Another2", 2, 0, 0, 2, 0, 0);
- CHECK_EQ("Another1", OperatorToString(&op1a).get());
- CHECK_EQ("Another2", OperatorToString(&op1b).get());
+ CHECK_EQ(0, strcmp("Another1", OperatorToString(&op1a).get()));
+ CHECK_EQ(0, strcmp("Another2", OperatorToString(&op1b).get()));
Operator op2a(20, NONE, "Flog1", 0, 0, 0, 0, 0, 0);
Operator op2b(20, FOLD, "Flog2", 1, 0, 0, 1, 0, 0);
- CHECK_EQ("Flog1", OperatorToString(&op2a).get());
- CHECK_EQ("Flog2", OperatorToString(&op2b).get());
+ CHECK_EQ(0, strcmp("Flog1", OperatorToString(&op2a).get()));
+ CHECK_EQ(0, strcmp("Flog2", OperatorToString(&op2b).get()));
}
TEST(TestOperator1int_Print) {
Operator1<int> op1(12, NONE, "Op1Test", 0, 0, 0, 1, 0, 0, 0);
- CHECK_EQ("Op1Test[0]", OperatorToString(&op1).get());
+ CHECK_EQ(0, strcmp("Op1Test[0]", OperatorToString(&op1).get()));
Operator1<int> op2(12, NONE, "Op1Test", 0, 0, 0, 1, 0, 0, 66666666);
- CHECK_EQ("Op1Test[66666666]", OperatorToString(&op2).get());
+ CHECK_EQ(0, strcmp("Op1Test[66666666]", OperatorToString(&op2).get()));
Operator1<int> op3(12, NONE, "FooBar", 0, 0, 0, 1, 0, 0, 2347);
- CHECK_EQ("FooBar[2347]", OperatorToString(&op3).get());
+ CHECK_EQ(0, strcmp("FooBar[2347]", OperatorToString(&op3).get()));
Operator1<int> op4(12, NONE, "BarFoo", 0, 0, 0, 1, 0, 0, -879);
- CHECK_EQ("BarFoo[-879]", OperatorToString(&op4).get());
+ CHECK_EQ(0, strcmp("BarFoo[-879]", OperatorToString(&op4).get()));
}
Operator1<double> op1a(23, NONE, "Canary", 0, 0, 0, 0, 0, 0, 0.5);
Operator1<double> op1b(23, FOLD, "Finch", 2, 0, 0, 2, 0, 0, -1.5);
- CHECK_EQ("Canary[0.5]", OperatorToString(&op1a).get());
- CHECK_EQ("Finch[-1.5]", OperatorToString(&op1b).get());
+ CHECK_EQ(0, strcmp("Canary[0.5]", OperatorToString(&op1a).get()));
+ CHECK_EQ(0, strcmp("Finch[-1.5]", OperatorToString(&op1b).get()));
}
#include "src/v8.h"
#include "test/cctest/cctest.h"
+#include "test/cctest/compiler/codegen-tester.h"
#include "test/cctest/compiler/graph-builder-tester.h"
#include "test/cctest/compiler/value-helper.h"
void CheckFloat64Constant(Node* n, double expected) {
Float64Matcher m(n);
CHECK(m.HasValue());
- CHECK_EQ(expected, m.Value());
+ CheckDoubleEq(expected, m.Value());
}
void CheckFloat32Constant(Node* n, float expected) {
NumberMatcher m(n);
CHECK_EQ(IrOpcode::kNumberConstant, n->opcode());
CHECK(m.HasValue());
- CHECK_EQ(expected, m.Value());
+ CheckDoubleEq(expected, m.Value());
}
Node* Parameter(int index = 0) {
#if V8_TURBOFAN_TARGET
using namespace v8::base;
-
-#define CHECK_UINT32_EQ(x, y) \
- CHECK_EQ(static_cast<int32_t>(x), static_cast<int32_t>(y))
-
using namespace v8::internal;
using namespace v8::internal::compiler;
p1 = *j;
p2 = *j - 5;
CHECK_EQ(magic, m.Call());
- CHECK_EQ(p1, p2);
+ CheckDoubleEq(p1, p2);
}
}
}
static const int32_t constant = 987654321;
{
RawMachineAssemblerTester<int32_t> m;
- Uint32BinopTester bt(&m);
+ Int32BinopTester bt(&m);
MLabel blocka, blockb;
m.Branch(
m.Word32Equal(m.Int32Add(bt.param0, bt.param1), m.Int32Constant(0)),
}
{
RawMachineAssemblerTester<int32_t> m;
- Uint32BinopTester bt(&m);
+ Int32BinopTester bt(&m);
MLabel blocka, blockb;
m.Branch(
m.Word32NotEqual(m.Int32Add(bt.param0, bt.param1), m.Int32Constant(0)),
m.Return(m.Int32Constant(0 - constant));
FOR_UINT32_INPUTS(j) {
uint32_t expected = (*i + *j) == 0 ? constant : 0 - constant;
- CHECK_UINT32_EQ(expected, m.Call(*j));
+ CHECK_EQ(expected, m.Call(*j));
}
}
}
m.Return(m.Int32Constant(0 - constant));
FOR_UINT32_INPUTS(j) {
uint32_t expected = (*i + *j) != 0 ? constant : 0 - constant;
- CHECK_UINT32_EQ(expected, m.Call(*j));
+ CHECK_EQ(expected, m.Call(*j));
}
}
}
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
uint32_t expected = (*i + *j) == 0;
- CHECK_UINT32_EQ(expected, bt.call(*i, *j));
+ CHECK_EQ(expected, bt.call(*i, *j));
}
}
}
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
uint32_t expected = (*i + *j) == 0;
- CHECK_UINT32_EQ(expected, bt.call(*i, *j));
+ CHECK_EQ(expected, bt.call(*i, *j));
}
}
}
m.Int32Constant(0)));
FOR_UINT32_INPUTS(j) {
uint32_t expected = (*i + *j) == 0;
- CHECK_UINT32_EQ(expected, m.Call(*j));
+ CHECK_EQ(expected, m.Call(*j));
}
}
}
m.Int32Constant(0)));
FOR_UINT32_INPUTS(j) {
uint32_t expected = (*j + *i) == 0;
- CHECK_UINT32_EQ(expected, m.Call(*j));
+ CHECK_EQ(expected, m.Call(*j));
}
}
}
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
uint32_t expected = static_cast<int32_t>(*i - *j);
- CHECK_UINT32_EQ(expected, bt.call(*i, *j));
+ CHECK_EQ(expected, bt.call(*i, *j));
}
}
}
m.Return(m.Int32Sub(m.Int32Constant(*i), m.Parameter(0)));
FOR_UINT32_INPUTS(j) {
uint32_t expected = *i - *j;
- CHECK_UINT32_EQ(expected, m.Call(*j));
+ CHECK_EQ(expected, m.Call(*j));
}
}
}
m.Return(m.Int32Sub(m.Parameter(0), m.Int32Constant(*i)));
FOR_UINT32_INPUTS(j) {
uint32_t expected = *j - *i;
- CHECK_UINT32_EQ(expected, m.Call(*j));
+ CHECK_EQ(expected, m.Call(*j));
}
}
}
FOR_UINT32_INPUTS(j) {
FOR_UINT32_SHIFTS(shift) {
// Use uint32_t because signed overflow is UB in C.
- int32_t expected = *i - (*j >> shift);
- CHECK_UINT32_EQ(expected, m.Call(*i, *j, shift));
+ uint32_t expected = *i - (*j >> shift);
+ CHECK_EQ(expected, m.Call(*i, *j, shift));
}
}
}
FOR_UINT32_SHIFTS(shift) {
FOR_UINT32_INPUTS(k) {
// Use uint32_t because signed overflow is UB in C.
- int32_t expected = (*i >> shift) - *k;
+ uint32_t expected = (*i >> shift) - *k;
CHECK_EQ(expected, m.Call(*i, shift, *k));
}
}
static const int constant = 987654321;
{
RawMachineAssemblerTester<int32_t> m;
- Uint32BinopTester bt(&m);
+ Int32BinopTester bt(&m);
MLabel blocka, blockb;
m.Branch(
m.Word32Equal(m.Int32Sub(bt.param0, bt.param1), m.Int32Constant(0)),
}
{
RawMachineAssemblerTester<int32_t> m;
- Uint32BinopTester bt(&m);
+ Int32BinopTester bt(&m);
MLabel blocka, blockb;
m.Branch(
m.Word32NotEqual(m.Int32Sub(bt.param0, bt.param1), m.Int32Constant(0)),
m.Bind(&blockb);
m.Return(m.Int32Constant(0 - constant));
FOR_UINT32_INPUTS(j) {
- int32_t expected = (*i - *j) == 0 ? constant : 0 - constant;
+ uint32_t expected = (*i - *j) == 0 ? constant : 0 - constant;
CHECK_EQ(expected, m.Call(*j));
}
}
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
uint32_t expected = (*i - *j) == 0;
- CHECK_UINT32_EQ(expected, bt.call(*i, *j));
+ CHECK_EQ(expected, bt.call(*i, *j));
}
}
}
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
uint32_t expected = (*i - *j) == 0;
- CHECK_UINT32_EQ(expected, bt.call(*i, *j));
+ CHECK_EQ(expected, bt.call(*i, *j));
}
}
}
m.Int32Constant(0)));
FOR_UINT32_INPUTS(j) {
uint32_t expected = (*i - *j) == 0;
- CHECK_UINT32_EQ(expected, m.Call(*j));
+ CHECK_EQ(expected, m.Call(*j));
}
}
}
m.Int32Constant(0)));
FOR_UINT32_INPUTS(j) {
uint32_t expected = (*j - *i) == 0;
- CHECK_UINT32_EQ(expected, m.Call(*j));
+ CHECK_EQ(expected, m.Call(*j));
}
}
}
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
uint32_t expected = *i * *j;
- CHECK_UINT32_EQ(expected, bt.call(*i, *j));
+ CHECK_EQ(expected, bt.call(*i, *j));
}
}
}
m.Return(m.Int32Mul(m.Int32Constant(*i), m.Parameter(0)));
FOR_UINT32_INPUTS(j) {
uint32_t expected = *i * *j;
- CHECK_UINT32_EQ(expected, m.Call(*j));
+ CHECK_EQ(expected, m.Call(*j));
}
}
}
m.Return(m.Int32Mul(m.Parameter(0), m.Int32Constant(*i)));
FOR_UINT32_INPUTS(j) {
uint32_t expected = *j * *i;
- CHECK_UINT32_EQ(expected, m.Call(*j));
+ CHECK_EQ(expected, m.Call(*j));
}
}
}
uint32_t p0 = *i;
uint32_t p1 = *j;
if (p1 != 0) {
- uint32_t expected = static_cast<uint32_t>(p0 / p1);
+ int32_t expected = bit_cast<int32_t>(p0 / p1);
CHECK_EQ(expected, bt.call(p0, p1));
}
}
uint32_t p0 = *i;
uint32_t p1 = *j;
if (p1 != 0) {
- uint32_t expected = static_cast<uint32_t>(p0 + (p0 / p1));
+ int32_t expected = bit_cast<int32_t>(p0 + (p0 / p1));
CHECK_EQ(expected, bt.call(p0, p1));
}
}
TEST(RunUint32ModP) {
{
RawMachineAssemblerTester<int32_t> m;
- Int32BinopTester bt(&m);
+ Uint32BinopTester bt(&m);
bt.AddReturn(m.Uint32Mod(bt.param0, bt.param1));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
}
{
RawMachineAssemblerTester<int32_t> m;
- Int32BinopTester bt(&m);
+ Uint32BinopTester bt(&m);
bt.AddReturn(m.Int32Add(bt.param0, m.Uint32Mod(bt.param0, bt.param1)));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
bt.AddReturn(m.Word32And(bt.param0, bt.param1));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- uint32_t expected = *i & *j;
+ int32_t expected = *i & *j;
CHECK_EQ(expected, bt.call(*i, *j));
}
}
bt.AddReturn(m.Word32And(bt.param0, m.Word32Not(bt.param1)));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- uint32_t expected = *i & ~(*j);
+ int32_t expected = *i & ~(*j);
CHECK_EQ(expected, bt.call(*i, *j));
}
}
bt.AddReturn(m.Word32And(m.Word32Not(bt.param0), bt.param1));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- uint32_t expected = ~(*i) & *j;
+ int32_t expected = ~(*i) & *j;
CHECK_EQ(expected, bt.call(*i, *j));
}
}
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
uint32_t expected = *i << (*j & 0x1f);
- CHECK_UINT32_EQ(expected, bt.call(*i, *j));
+ CHECK_EQ(expected, bt.call(*i, *j));
}
}
}
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
uint32_t expected = *i << (0x1f & *j);
- CHECK_UINT32_EQ(expected, bt.call(*i, *j));
+ CHECK_EQ(expected, bt.call(*i, *j));
}
}
}
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
uint32_t expected = *i >> (*j & 0x1f);
- CHECK_UINT32_EQ(expected, bt.call(*i, *j));
+ CHECK_EQ(expected, bt.call(*i, *j));
}
}
}
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
uint32_t expected = *i >> (0x1f & *j);
- CHECK_UINT32_EQ(expected, bt.call(*i, *j));
+ CHECK_EQ(expected, bt.call(*i, *j));
}
}
}
m.Word32Sar(bt.param0, m.Word32And(m.Int32Constant(0x1f), bt.param1)));
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
- uint32_t expected = *i >> (0x1f & *j);
+ int32_t expected = *i >> (0x1f & *j);
CHECK_EQ(expected, bt.call(*i, *j));
}
}
m.Return(m.Word32And(m.Int32Constant(*i), m.Parameter(0)));
FOR_UINT32_INPUTS(j) {
uint32_t expected = *i & *j;
- CHECK_UINT32_EQ(expected, m.Call(*j));
+ CHECK_EQ(expected, m.Call(*j));
}
}
}
m.Return(m.Word32And(m.Int32Constant(*i), m.Word32Not(m.Parameter(0))));
FOR_UINT32_INPUTS(j) {
uint32_t expected = *i & ~(*j);
- CHECK_UINT32_EQ(expected, m.Call(*j));
+ CHECK_EQ(expected, m.Call(*j));
}
}
}
static const int constant = 987654321;
{
RawMachineAssemblerTester<int32_t> m;
- Uint32BinopTester bt(&m);
+ Int32BinopTester bt(&m);
MLabel blocka, blockb;
m.Branch(
m.Word32Equal(m.Word32And(bt.param0, bt.param1), m.Int32Constant(0)),
}
{
RawMachineAssemblerTester<int32_t> m;
- Uint32BinopTester bt(&m);
+ Int32BinopTester bt(&m);
MLabel blocka, blockb;
m.Branch(
m.Word32NotEqual(m.Word32And(bt.param0, bt.param1), m.Int32Constant(0)),
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
uint32_t expected = (*i & *j) == 0;
- CHECK_UINT32_EQ(expected, bt.call(*i, *j));
+ CHECK_EQ(expected, bt.call(*i, *j));
}
}
}
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
uint32_t expected = (*i & *j) == 0;
- CHECK_UINT32_EQ(expected, bt.call(*i, *j));
+ CHECK_EQ(expected, bt.call(*i, *j));
}
}
}
m.Int32Constant(0)));
FOR_UINT32_INPUTS(j) {
uint32_t expected = (*i & *j) == 0;
- CHECK_UINT32_EQ(expected, m.Call(*j));
+ CHECK_EQ(expected, m.Call(*j));
}
}
}
m.Int32Constant(0)));
FOR_UINT32_INPUTS(j) {
uint32_t expected = (*j & *i) == 0;
- CHECK_UINT32_EQ(expected, m.Call(*j));
+ CHECK_EQ(expected, m.Call(*j));
}
}
}
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
uint32_t expected = *i | *j;
- CHECK_UINT32_EQ(expected, bt.call(*i, *j));
+ CHECK_EQ(expected, bt.call(*i, *j));
}
}
}
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
uint32_t expected = *i | ~(*j);
- CHECK_UINT32_EQ(expected, bt.call(*i, *j));
+ CHECK_EQ(expected, bt.call(*i, *j));
}
}
}
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
uint32_t expected = ~(*i) | *j;
- CHECK_UINT32_EQ(expected, bt.call(*i, *j));
+ CHECK_EQ(expected, bt.call(*i, *j));
}
}
}
m.Return(m.Word32Or(m.Int32Constant(*i), m.Parameter(0)));
FOR_UINT32_INPUTS(j) {
uint32_t expected = *i | *j;
- CHECK_UINT32_EQ(expected, m.Call(*j));
+ CHECK_EQ(expected, m.Call(*j));
}
}
}
m.Return(m.Word32Or(m.Int32Constant(*i), m.Word32Not(m.Parameter(0))));
FOR_UINT32_INPUTS(j) {
uint32_t expected = *i | ~(*j);
- CHECK_UINT32_EQ(expected, m.Call(*j));
+ CHECK_EQ(expected, m.Call(*j));
}
}
}
TEST(RunWord32OrInComparison) {
{
RawMachineAssemblerTester<int32_t> m;
- Uint32BinopTester bt(&m);
+ Int32BinopTester bt(&m);
bt.AddReturn(
m.Word32Equal(m.Word32Or(bt.param0, bt.param1), m.Int32Constant(0)));
FOR_UINT32_INPUTS(i) {
}
{
RawMachineAssemblerTester<int32_t> m;
- Uint32BinopTester bt(&m);
+ Int32BinopTester bt(&m);
bt.AddReturn(
m.Word32Equal(m.Int32Constant(0), m.Word32Or(bt.param0, bt.param1)));
FOR_UINT32_INPUTS(i) {
m.Int32Constant(0)));
FOR_UINT32_INPUTS(j) {
uint32_t expected = (*i | *j) == 0;
- CHECK_UINT32_EQ(expected, m.Call(*j));
+ CHECK_EQ(expected, m.Call(*j));
}
}
}
m.Int32Constant(0)));
FOR_UINT32_INPUTS(j) {
uint32_t expected = (*j | *i) == 0;
- CHECK_UINT32_EQ(expected, m.Call(*j));
+ CHECK_EQ(expected, m.Call(*j));
}
}
}
TEST(RunWord32XorP) {
{
FOR_UINT32_INPUTS(i) {
- RawMachineAssemblerTester<int32_t> m(kMachUint32);
+ RawMachineAssemblerTester<uint32_t> m(kMachUint32);
m.Return(m.Word32Xor(m.Int32Constant(*i), m.Parameter(0)));
FOR_UINT32_INPUTS(j) {
uint32_t expected = *i ^ *j;
- CHECK_UINT32_EQ(expected, m.Call(*j));
+ CHECK_EQ(expected, m.Call(*j));
}
}
}
bt.AddReturn(m.Word32Xor(bt.param0, bt.param1));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- int32_t expected = *i ^ *j;
- CHECK_UINT32_EQ(expected, bt.call(*i, *j));
+ uint32_t expected = *i ^ *j;
+ CHECK_EQ(expected, bt.call(*i, *j));
}
}
}
m.Return(m.Word32Xor(m.Int32Constant(*i), m.Word32Not(m.Parameter(0))));
FOR_UINT32_INPUTS(j) {
uint32_t expected = *i ^ ~(*j);
- CHECK_UINT32_EQ(expected, m.Call(*j));
+ CHECK_EQ(expected, m.Call(*j));
}
}
}
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
uint32_t expected = (*i ^ *j) == 0 ? constant : 0 - constant;
- CHECK_UINT32_EQ(expected, bt.call(*i, *j));
+ CHECK_EQ(expected, bt.call(*i, *j));
}
}
}
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
uint32_t expected = (*i ^ *j) != 0 ? constant : 0 - constant;
- CHECK_UINT32_EQ(expected, bt.call(*i, *j));
+ CHECK_EQ(expected, bt.call(*i, *j));
}
}
}
m.Return(m.Int32Constant(0 - constant));
FOR_UINT32_INPUTS(j) {
uint32_t expected = (*i ^ *j) == 0 ? constant : 0 - constant;
- CHECK_UINT32_EQ(expected, m.Call(*j));
+ CHECK_EQ(expected, m.Call(*j));
}
}
}
m.Return(m.Int32Constant(0 - constant));
FOR_UINT32_INPUTS(j) {
uint32_t expected = (*i ^ *j) != 0 ? constant : 0 - constant;
- CHECK_UINT32_EQ(expected, m.Call(*j));
+ CHECK_EQ(expected, m.Call(*j));
}
}
}
m.Return(m.Word32Shl(m.Parameter(0), m.Int32Constant(shift)));
FOR_UINT32_INPUTS(j) {
uint32_t expected = *j << shift;
- CHECK_UINT32_EQ(expected, m.Call(*j));
+ CHECK_EQ(expected, m.Call(*j));
}
}
}
FOR_UINT32_INPUTS(i) {
FOR_UINT32_SHIFTS(shift) {
uint32_t expected = *i << shift;
- CHECK_UINT32_EQ(expected, bt.call(*i, shift));
+ CHECK_EQ(expected, bt.call(*i, shift));
}
}
}
FOR_UINT32_INPUTS(i) {
FOR_UINT32_SHIFTS(shift) {
uint32_t expected = 0 == (*i << shift);
- CHECK_UINT32_EQ(expected, bt.call(*i, shift));
+ CHECK_EQ(expected, bt.call(*i, shift));
}
}
}
FOR_UINT32_INPUTS(i) {
FOR_UINT32_SHIFTS(shift) {
uint32_t expected = 0 == (*i << shift);
- CHECK_UINT32_EQ(expected, bt.call(*i, shift));
+ CHECK_EQ(expected, bt.call(*i, shift));
}
}
}
{
FOR_UINT32_SHIFTS(shift) {
- RawMachineAssemblerTester<int32_t> m(kMachUint32);
+ RawMachineAssemblerTester<uint32_t> m(kMachUint32);
m.Return(
m.Word32Equal(m.Int32Constant(0),
m.Word32Shl(m.Parameter(0), m.Int32Constant(shift))));
FOR_UINT32_INPUTS(i) {
uint32_t expected = 0 == (*i << shift);
- CHECK_UINT32_EQ(expected, m.Call(*i));
+ CHECK_EQ(expected, m.Call(*i));
}
}
}
{
FOR_UINT32_SHIFTS(shift) {
- RawMachineAssemblerTester<int32_t> m(kMachUint32);
+ RawMachineAssemblerTester<uint32_t> m(kMachUint32);
m.Return(
m.Word32Equal(m.Word32Shl(m.Parameter(0), m.Int32Constant(shift)),
m.Int32Constant(0)));
FOR_UINT32_INPUTS(i) {
uint32_t expected = 0 == (*i << shift);
- CHECK_UINT32_EQ(expected, m.Call(*i));
+ CHECK_EQ(expected, m.Call(*i));
}
}
}
m.Return(m.Word32Shr(m.Parameter(0), m.Int32Constant(shift)));
FOR_UINT32_INPUTS(j) {
uint32_t expected = *j >> shift;
- CHECK_UINT32_EQ(expected, m.Call(*j));
+ CHECK_EQ(expected, m.Call(*j));
}
}
}
FOR_UINT32_INPUTS(i) {
FOR_UINT32_SHIFTS(shift) {
uint32_t expected = *i >> shift;
- CHECK_UINT32_EQ(expected, bt.call(*i, shift));
+ CHECK_EQ(expected, bt.call(*i, shift));
}
}
- CHECK_EQ(0x00010000, bt.call(0x80000000, 15));
+ CHECK_EQ(0x00010000u, bt.call(0x80000000, 15));
}
}
FOR_UINT32_INPUTS(i) {
FOR_UINT32_SHIFTS(shift) {
uint32_t expected = 0 == (*i >> shift);
- CHECK_UINT32_EQ(expected, bt.call(*i, shift));
+ CHECK_EQ(expected, bt.call(*i, shift));
}
}
}
FOR_UINT32_INPUTS(i) {
FOR_UINT32_SHIFTS(shift) {
uint32_t expected = 0 == (*i >> shift);
- CHECK_UINT32_EQ(expected, bt.call(*i, shift));
+ CHECK_EQ(expected, bt.call(*i, shift));
}
}
}
{
FOR_UINT32_SHIFTS(shift) {
- RawMachineAssemblerTester<int32_t> m(kMachUint32);
+ RawMachineAssemblerTester<uint32_t> m(kMachUint32);
m.Return(
m.Word32Equal(m.Int32Constant(0),
m.Word32Shr(m.Parameter(0), m.Int32Constant(shift))));
FOR_UINT32_INPUTS(i) {
uint32_t expected = 0 == (*i >> shift);
- CHECK_UINT32_EQ(expected, m.Call(*i));
+ CHECK_EQ(expected, m.Call(*i));
}
}
}
{
FOR_UINT32_SHIFTS(shift) {
- RawMachineAssemblerTester<int32_t> m(kMachUint32);
+ RawMachineAssemblerTester<uint32_t> m(kMachUint32);
m.Return(
m.Word32Equal(m.Word32Shr(m.Parameter(0), m.Int32Constant(shift)),
m.Int32Constant(0)));
FOR_UINT32_INPUTS(i) {
uint32_t expected = 0 == (*i >> shift);
- CHECK_UINT32_EQ(expected, m.Call(*i));
+ CHECK_EQ(expected, m.Call(*i));
}
}
}
CHECK_EQ(expected, bt.call(*i, shift));
}
}
- CHECK_EQ(0xFFFF0000, bt.call(0x80000000, 15));
+ CHECK_EQ(bit_cast<int32_t>(0xFFFF0000), bt.call(0x80000000, 15));
}
}
m.Word32Equal(m.Word32Sar(m.Parameter(0), m.Int32Constant(shift)),
m.Int32Constant(0)));
FOR_INT32_INPUTS(i) {
- uint32_t expected = 0 == (*i >> shift);
+ int32_t expected = 0 == (*i >> shift);
CHECK_EQ(expected, m.Call(*i));
}
}
FOR_UINT32_INPUTS(i) {
FOR_UINT32_SHIFTS(shift) {
uint32_t expected = bits::RotateRight32(*i, shift);
- CHECK_UINT32_EQ(expected, bt.call(*i, shift));
+ CHECK_EQ(expected, bt.call(*i, shift));
}
}
}
FOR_UINT32_INPUTS(i) {
FOR_UINT32_SHIFTS(shift) {
uint32_t expected = 0 == bits::RotateRight32(*i, shift);
- CHECK_UINT32_EQ(expected, bt.call(*i, shift));
+ CHECK_EQ(expected, bt.call(*i, shift));
}
}
}
FOR_UINT32_INPUTS(i) {
FOR_UINT32_SHIFTS(shift) {
uint32_t expected = 0 == bits::RotateRight32(*i, shift);
- CHECK_UINT32_EQ(expected, bt.call(*i, shift));
+ CHECK_EQ(expected, bt.call(*i, shift));
}
}
}
{
FOR_UINT32_SHIFTS(shift) {
- RawMachineAssemblerTester<int32_t> m(kMachUint32);
+ RawMachineAssemblerTester<uint32_t> m(kMachUint32);
m.Return(
m.Word32Equal(m.Int32Constant(0),
m.Word32Ror(m.Parameter(0), m.Int32Constant(shift))));
FOR_UINT32_INPUTS(i) {
uint32_t expected = 0 == bits::RotateRight32(*i, shift);
- CHECK_UINT32_EQ(expected, m.Call(*i));
+ CHECK_EQ(expected, m.Call(*i));
}
}
}
{
FOR_UINT32_SHIFTS(shift) {
- RawMachineAssemblerTester<int32_t> m(kMachUint32);
+ RawMachineAssemblerTester<uint32_t> m(kMachUint32);
m.Return(
m.Word32Equal(m.Word32Ror(m.Parameter(0), m.Int32Constant(shift)),
m.Int32Constant(0)));
FOR_UINT32_INPUTS(i) {
uint32_t expected = 0 == bits::RotateRight32(*i, shift);
- CHECK_UINT32_EQ(expected, m.Call(*i));
+ CHECK_EQ(expected, m.Call(*i));
}
}
}
FOR_FLOAT64_INPUTS(pl) {
FOR_FLOAT64_INPUTS(pr) {
double expected = *pl + *pr;
- CHECK_EQ(expected, bt.call(*pl, *pr));
+ CheckDoubleEq(expected, bt.call(*pl, *pr));
}
}
}
FOR_FLOAT64_INPUTS(pl) {
FOR_FLOAT64_INPUTS(pr) {
double expected = *pl - *pr;
- CHECK_EQ(expected, bt.call(*pl, *pr));
+ CheckDoubleEq(expected, bt.call(*pl, *pr));
}
}
}
input = *j;
double expected = *i - input;
CHECK_EQ(0, m.Call());
- CHECK_EQ(expected, output);
+ CheckDoubleEq(expected, output);
}
}
}
input = *j;
double expected = input - *i;
CHECK_EQ(0, m.Call());
- CHECK_EQ(expected, output);
+ CheckDoubleEq(expected, output);
}
}
}
FOR_FLOAT64_INPUTS(pl) {
FOR_FLOAT64_INPUTS(pr) {
double expected = *pl * *pr;
- CHECK_EQ(expected, bt.call(*pl, *pr));
+ CheckDoubleEq(expected, bt.call(*pl, *pr));
}
}
}
volatile double temp = input_a * input_b;
volatile double expected = temp + input_c;
CHECK_EQ(0, m.Call());
- CHECK_EQ(expected, output);
+ CheckDoubleEq(expected, output);
}
}
}
volatile double temp = input_b * input_c;
volatile double expected = input_a + temp;
CHECK_EQ(0, m.Call());
- CHECK_EQ(expected, output);
+ CheckDoubleEq(expected, output);
}
}
}
volatile double temp = input_b * input_c;
volatile double expected = input_a - temp;
CHECK_EQ(0, m.Call());
- CHECK_EQ(expected, output);
+ CheckDoubleEq(expected, output);
}
}
}
input = *j;
double expected = *i * input;
CHECK_EQ(0, m.Call());
- CHECK_EQ(expected, output);
+ CheckDoubleEq(expected, output);
}
}
}
input = *j;
double expected = input * *i;
CHECK_EQ(0, m.Call());
- CHECK_EQ(expected, output);
+ CheckDoubleEq(expected, output);
}
}
}
FOR_FLOAT64_INPUTS(pl) {
FOR_FLOAT64_INPUTS(pr) {
double expected = *pl / *pr;
- CHECK_EQ(expected, bt.call(*pl, *pr));
+ CheckDoubleEq(expected, bt.call(*pl, *pr));
}
}
}
FOR_FLOAT64_INPUTS(j) {
double expected = modulo(*i, *j);
double found = bt.call(*i, *j);
- CHECK_EQ(expected, found);
+ CheckDoubleEq(expected, found);
}
}
}
TEST(RunChangeUint32ToFloat64_B) {
- RawMachineAssemblerTester<int32_t> m(kMachUint32);
+ RawMachineAssemblerTester<uint32_t> m(kMachUint32);
double output = 0;
Node* convert = m.ChangeUint32ToFloat64(m.Parameter(0));
TEST(RunChangeFloat64ToUint32_spilled) {
RawMachineAssemblerTester<uint32_t> m;
const int kNumInputs = 32;
- int32_t magic = 0x786234;
+ uint32_t magic = 0x786234;
double input[kNumInputs];
uint32_t result[kNumInputs];
Node* input_node[kNumInputs];
for (int i = 0; i < kNumInputs; i++) {
if (i % 2) {
- CHECK_UINT32_EQ(result[i], static_cast<uint32_t>(100 + i + 2147483648u));
+ CHECK_EQ(result[i], static_cast<uint32_t>(100 + i + 2147483648u));
} else {
- CHECK_UINT32_EQ(result[i], static_cast<uint32_t>(100 + i));
+ CHECK_EQ(result[i], static_cast<uint32_t>(100 + i));
}
}
}
TEST(RunTruncateFloat64ToFloat32_spilled) {
RawMachineAssemblerTester<uint32_t> m;
const int kNumInputs = 32;
- int32_t magic = 0x786234;
+ uint32_t magic = 0x786234;
double input[kNumInputs];
float result[kNumInputs];
Node* input_node[kNumInputs];
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
expected = (static_cast<uint64_t>(*j) << 32) | *i;
- CHECK_UINT32_EQ(expected, m.Call());
+ CHECK_EQ(static_cast<int32_t>(expected), m.Call());
}
}
}
input = *i;
volatile double expected = DoubleToFloat32(input);
CHECK_EQ(0, m.Call());
- CHECK_EQ(expected, actual);
+ CheckDoubleEq(expected, actual);
}
}
void CheckUint32Constant(int32_t expected, Node* node) {
CHECK_EQ(IrOpcode::kInt32Constant, node->opcode());
- CHECK_EQ(expected, OpParameter<uint32_t>(node));
+ CHECK_EQ(expected, OpParameter<int32_t>(node));
}
void CheckHeapConstant(Object* expected, Node* node) {
ApiTestFuzzer::Fuzz();
v8::Isolate* isolate = CcTest::isolate();
CHECK_EQ(isolate, info.GetIsolate());
- CHECK_EQ(x_receiver, info.This());
+ CHECK(x_receiver->Equals(info.This()));
info.GetReturnValue().Set(v8_num(x_register[offset]));
}
static void XGetter(Local<String> name,
const v8::PropertyCallbackInfo<v8::Value>& info) {
- CHECK_EQ(x_holder, info.Holder());
+ CHECK(x_holder->Equals(info.Holder()));
XGetter(info, 0);
}
static void XGetter(const v8::FunctionCallbackInfo<v8::Value>& info) {
- CHECK_EQ(x_receiver, info.Holder());
+ CHECK(x_receiver->Equals(info.Holder()));
XGetter(info, 1);
}
static void XSetter(Local<Value> value, const Info& info, int offset) {
v8::Isolate* isolate = CcTest::isolate();
CHECK_EQ(isolate, info.GetIsolate());
- CHECK_EQ(x_holder, info.This());
- CHECK_EQ(x_holder, info.Holder());
+ CHECK(x_holder->Equals(info.This()));
+ CHECK(x_holder->Equals(info.Holder()));
x_register[offset] = value->Int32Value();
info.GetReturnValue().Set(v8_num(-1));
}
" result.push(obj[key_1]);"
"}"
"result"));
- CHECK_EQ(80, array->Length());
+ CHECK_EQ(80u, array->Length());
for (int i = 0; i < 80; i++) {
v8::Handle<Value> entry = array->Get(v8::Integer::New(isolate, i));
- CHECK_EQ(v8::Integer::New(isolate, i/2), entry);
+ CHECK(v8::Integer::New(isolate, i / 2)->Equals(entry));
}
}
"for (var i = 0; i < 5; i++) {"
" try { obj.x; } catch (e) { result += e; }"
"}; result"))->Run();
- CHECK_EQ(v8_str("ggggg"), result);
+ CHECK(v8_str("ggggg")->Equals(result));
result = Script::Compile(String::NewFromUtf8(
isolate,
"for (var i = 0; i < 5; i++) {"
" try { obj.x = i; } catch (e) { result += e; }"
"}; result"))->Run();
- CHECK_EQ(v8_str("01234"), result);
+ CHECK(v8_str("01234")->Equals(result));
}
const v8::FunctionCallbackInfo<v8::Value>& args) {
ApiTestFuzzer::Fuzz();
signature_callback_count++;
- CHECK_EQ(signature_expected_receiver, args.Holder());
- CHECK_EQ(signature_expected_receiver, args.This());
+ CHECK(signature_expected_receiver->Equals(args.Holder()));
+ CHECK(signature_expected_receiver->Equals(args.This()));
v8::Handle<v8::Array> result =
v8::Array::New(args.GetIsolate(), args.Length());
for (int i = 0; i < args.Length(); i++)
if (!expected_to_throw) {
CHECK_EQ(10, signature_callback_count);
} else {
- CHECK_EQ(v8_str("TypeError: Illegal invocation"),
- try_catch.Exception()->ToString(isolate));
+ CHECK(v8_str("TypeError: Illegal invocation")
+ ->Equals(try_catch.Exception()->ToString(isolate)));
}
}
Local<Value> foo_after = obj->Get(v8_str("foo"));
CHECK(!foo_after->IsUndefined());
CHECK(foo_after->IsString());
- CHECK_EQ(bar_str, foo_after);
+ CHECK(bar_str->Equals(foo_after));
}
Local<Value> after = obj->Get(1);
CHECK(!after->IsUndefined());
CHECK(after->IsString());
- CHECK_EQ(bar_str, after);
+ CHECK(bar_str->Equals(after));
Local<v8::Array> value = CompileRun("[\"a\", \"b\"]").As<v8::Array>();
- CHECK_EQ(v8_str("a"), value->Get(0));
- CHECK_EQ(v8_str("b"), value->Get(1));
+ CHECK(v8_str("a")->Equals(value->Get(0)));
+ CHECK(v8_str("b")->Equals(value->Get(1)));
}
CHECK_EQ(source->IsExternal(), false);
CHECK_EQ(source->IsExternalOneByte(), false);
String::Encoding encoding = String::UNKNOWN_ENCODING;
- CHECK_EQ(NULL, source->GetExternalStringResourceBase(&encoding));
+ CHECK(!source->GetExternalStringResourceBase(&encoding));
CHECK_EQ(String::ONE_BYTE_ENCODING, encoding);
bool success = source->MakeExternal(new TestResource(two_byte_source,
&dispose_count));
CHECK(str.IsEmpty());
CHECK(try_catch.HasCaught());
String::Utf8Value exception_value(try_catch.Exception());
- CHECK_EQ("RangeError: Invalid string length", *exception_value);
+ CHECK_EQ(0, strcmp("RangeError: Invalid string length", *exception_value));
}
{
CHECK(str.IsEmpty());
CHECK(try_catch.HasCaught());
String::Utf8Value exception_value(try_catch.Exception());
- CHECK_EQ("RangeError: Invalid string length", *exception_value);
+ CHECK_EQ(0, strcmp("RangeError: Invalid string length", *exception_value));
}
}
Local<Function> fun = fun_templ->GetFunction();
env->Global()->Set(v8_str("obj"), fun);
Local<Value> result = v8_compile("(new obj()).toString()")->Run();
- CHECK_EQ(v8_str("[object funky]"), result);
+ CHECK(v8_str("[object funky]")->Equals(result));
CompileRun("var obj_instance = new obj();");
Local<Script> script;
script = v8_compile("obj_instance.x");
other_instance->Set(v8_str("__proto__"), derived_instance2);
// base_instance is only an instance of base.
- CHECK_EQ(base_instance,
- base_instance->FindInstanceInPrototypeChain(base));
+ CHECK(
+ base_instance->Equals(base_instance->FindInstanceInPrototypeChain(base)));
CHECK(base_instance->FindInstanceInPrototypeChain(derived).IsEmpty());
CHECK(base_instance->FindInstanceInPrototypeChain(other).IsEmpty());
// derived_instance is an instance of base and derived.
- CHECK_EQ(derived_instance,
- derived_instance->FindInstanceInPrototypeChain(base));
- CHECK_EQ(derived_instance,
- derived_instance->FindInstanceInPrototypeChain(derived));
+ CHECK(derived_instance->Equals(
+ derived_instance->FindInstanceInPrototypeChain(base)));
+ CHECK(derived_instance->Equals(
+ derived_instance->FindInstanceInPrototypeChain(derived)));
CHECK(derived_instance->FindInstanceInPrototypeChain(other).IsEmpty());
// other_instance is an instance of other and its immediate
// Note, derived_instance is an instance of base and derived too,
// but it comes after derived_instance2 in the prototype chain of
// other_instance.
- CHECK_EQ(derived_instance2,
- other_instance->FindInstanceInPrototypeChain(base));
- CHECK_EQ(derived_instance2,
- other_instance->FindInstanceInPrototypeChain(derived));
- CHECK_EQ(other_instance,
- other_instance->FindInstanceInPrototypeChain(other));
+ CHECK(derived_instance2->Equals(
+ other_instance->FindInstanceInPrototypeChain(base)));
+ CHECK(derived_instance2->Equals(
+ other_instance->FindInstanceInPrototypeChain(derived)));
+ CHECK(other_instance->Equals(
+ other_instance->FindInstanceInPrototypeChain(other)));
}
static void EchoNamedProperty(Local<Name> name,
const v8::PropertyCallbackInfo<v8::Value>& info) {
ApiTestFuzzer::Fuzz();
- CHECK_EQ(v8_str("data"), info.Data());
+ CHECK(v8_str("data")->Equals(info.Data()));
echo_named_call_count++;
info.GetReturnValue().Set(name);
}
const char* code = "var str = 'oddle'; obj[str] + obj.poddle;";
v8::Handle<Value> str = CompileRun(code);
String::Utf8Value value(str);
- CHECK_EQ(*value, "oddlepoddle");
+ CHECK_EQ(0, strcmp(*value, "oddlepoddle"));
// Check default behavior
- CHECK_EQ(v8_compile("obj.flob = 10;")->Run()->Int32Value(), 10);
+ CHECK_EQ(10, v8_compile("obj.flob = 10;")->Run()->Int32Value());
CHECK(v8_compile("'myProperty' in obj")->Run()->BooleanValue());
CHECK(v8_compile("delete obj.myProperty")->Run()->BooleanValue());
}
uint32_t index,
const v8::PropertyCallbackInfo<v8::Value>& info) {
ApiTestFuzzer::Fuzz();
- CHECK_EQ(v8_num(637), info.Data());
+ CHECK(v8_num(637)->Equals(info.Data()));
echo_indexed_call_count++;
info.GetReturnValue().Set(v8_num(index));
}
LocalContext env(NULL, desc->InstanceTemplate());
CompileRun("var pre = 'Object: pre'; var on = 'Object: on';");
v8::Handle<Value> result_pre = CompileRun("pre");
- CHECK_EQ(v8_str("PrePropertyHandler: pre"), result_pre);
+ CHECK(v8_str("PrePropertyHandler: pre")->Equals(result_pre));
v8::Handle<Value> result_on = CompileRun("on");
- CHECK_EQ(v8_str("Object: on"), result_on);
+ CHECK(v8_str("Object: on")->Equals(result_on));
v8::Handle<Value> result_post = CompileRun("post");
CHECK(result_post.IsEmpty());
}
env->Global()->Set(v8_str("obj"), obj->NewInstance());
v8::Handle<Value> otto = CompileRun(
"try { with (obj) { otto; } } catch (e) { e; }");
- CHECK_EQ(v8_str("otto"), otto);
+ CHECK(v8_str("otto")->Equals(otto));
v8::Handle<Value> netto = CompileRun(
"try { with (obj) { netto = 4; } } catch (e) { e; }");
- CHECK_EQ(v8_str("netto"), netto);
+ CHECK(v8_str("netto")->Equals(netto));
}
CHECK_EQ(2002, obj->Get(sym1)->Int32Value());
CHECK_EQ(v8::None, obj->GetPropertyAttributes(sym1));
- CHECK_EQ(0, obj->GetOwnPropertyNames()->Length());
- int num_props = obj->GetPropertyNames()->Length();
+ CHECK_EQ(0u, obj->GetOwnPropertyNames()->Length());
+ unsigned num_props = obj->GetPropertyNames()->Length();
CHECK(obj->Set(v8::String::NewFromUtf8(isolate, "bla"),
v8::Integer::New(isolate, 20)));
- CHECK_EQ(1, obj->GetOwnPropertyNames()->Length());
+ CHECK_EQ(1u, obj->GetOwnPropertyNames()->Length());
CHECK_EQ(num_props + 1, obj->GetPropertyNames()->Length());
CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
CHECK_EQ(2002, obj->Get(sym1)->Int32Value());
CHECK_EQ(2008, obj->Get(sym2)->Int32Value());
CHECK_EQ(2002, obj->Get(sym1)->Int32Value());
- CHECK_EQ(2, obj->GetOwnPropertyNames()->Length());
+ CHECK_EQ(2u, obj->GetOwnPropertyNames()->Length());
CHECK(obj->Has(sym1));
CHECK(obj->Has(sym2));
CHECK(obj->Get(sym3)->Equals(v8::Integer::New(isolate, 42)));
CHECK(obj->Get(v8::String::NewFromUtf8(isolate, "accessor_sym3"))->Equals(
v8::Integer::New(isolate, 42)));
- CHECK_EQ(2, obj->GetOwnPropertyNames()->Length());
+ CHECK_EQ(2u, obj->GetOwnPropertyNames()->Length());
// Symbol properties are inherited.
v8::Local<v8::Object> child = v8::Object::New(isolate);
CHECK(obj->Get(sym3)->Equals(v8::Integer::New(isolate, 42)));
CHECK(obj->Get(v8::String::NewFromUtf8(isolate, "accessor_sym3"))->Equals(
v8::Integer::New(isolate, 42)));
- CHECK_EQ(0, child->GetOwnPropertyNames()->Length());
+ CHECK_EQ(0u, child->GetOwnPropertyNames()->Length());
}
CHECK(obj->HasPrivate(priv1));
CHECK_EQ(2002, obj->GetPrivate(priv1)->Int32Value());
- CHECK_EQ(0, obj->GetOwnPropertyNames()->Length());
- int num_props = obj->GetPropertyNames()->Length();
+ CHECK_EQ(0u, obj->GetOwnPropertyNames()->Length());
+ unsigned num_props = obj->GetPropertyNames()->Length();
CHECK(obj->Set(v8::String::NewFromUtf8(isolate, "bla"),
v8::Integer::New(isolate, 20)));
- CHECK_EQ(1, obj->GetOwnPropertyNames()->Length());
+ CHECK_EQ(1u, obj->GetOwnPropertyNames()->Length());
CHECK_EQ(num_props + 1, obj->GetPropertyNames()->Length());
CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
CHECK_EQ(2002, obj->GetPrivate(priv1)->Int32Value());
CHECK_EQ(2008, obj->GetPrivate(priv2)->Int32Value());
CHECK_EQ(2002, obj->GetPrivate(priv1)->Int32Value());
- CHECK_EQ(1, obj->GetOwnPropertyNames()->Length());
+ CHECK_EQ(1u, obj->GetOwnPropertyNames()->Length());
CHECK(obj->HasPrivate(priv1));
CHECK(obj->HasPrivate(priv2));
CHECK(obj->HasPrivate(priv1));
CHECK(!obj->HasPrivate(priv2));
CHECK_EQ(2002, obj->GetPrivate(priv1)->Int32Value());
- CHECK_EQ(1, obj->GetOwnPropertyNames()->Length());
+ CHECK_EQ(1u, obj->GetOwnPropertyNames()->Length());
// Private properties are inherited (for the time being).
v8::Local<v8::Object> child = v8::Object::New(isolate);
child->SetPrototype(obj);
CHECK(child->HasPrivate(priv1));
CHECK_EQ(2002, child->GetPrivate(priv1)->Int32Value());
- CHECK_EQ(0, child->GetOwnPropertyNames()->Length());
+ CHECK_EQ(0u, child->GetOwnPropertyNames()->Length());
}
map.Set(7, expected);
CHECK_EQ(1, static_cast<int>(map.Size()));
obj = map.Get(7);
- CHECK_EQ(expected, obj);
+ CHECK(expected->Equals(obj));
{
typename Map::PersistentValueReference ref = map.GetReference(7);
- CHECK_EQ(expected, ref.NewLocal(isolate));
+ CHECK(expected->Equals(ref.NewLocal(isolate)));
}
v8::UniquePersistent<v8::Object> removed = map.Remove(7);
CHECK_EQ(0, static_cast<int>(map.Size()));
v8::UniquePersistent<v8::Object>(isolate, expected2), &ref);
CHECK_EQ(1, static_cast<int>(map.Size()));
CHECK(expected == removed);
- CHECK_EQ(expected2, ref.NewLocal(isolate));
+ CHECK(expected2->Equals(ref.NewLocal(isolate)));
}
}
CHECK_EQ(initial_handle_count + 1, global_handles->global_handles_count());
CHECK(!vector.IsEmpty());
CHECK_EQ(5, static_cast<int>(vector.Size()));
CHECK(obj3.IsEmpty());
- CHECK_EQ(obj1, vector.Get(0));
- CHECK_EQ(obj1, vector.Get(2));
- CHECK_EQ(obj1, vector.Get(4));
- CHECK_EQ(obj2, vector.Get(1));
+ CHECK(obj1->Equals(vector.Get(0)));
+ CHECK(obj1->Equals(vector.Get(2)));
+ CHECK(obj1->Equals(vector.Get(4)));
+ CHECK(obj2->Equals(vector.Get(1)));
CHECK_EQ(5 + handle_count, global_handles->global_handles_count());
CHECK(result.IsEmpty());
CHECK(try_catch.HasCaught());
String::Utf8Value exception_value(try_catch.Exception());
- CHECK_EQ(*exception_value, "panama!");
+ CHECK_EQ(0, strcmp(*exception_value, "panama!"));
}
CHECK_EQ(v8::None, context->Global()->GetPropertyAttributes(exception));
CHECK(try_catch.HasCaught());
String::Utf8Value exception_value(try_catch.Exception());
- CHECK_EQ("exception", *exception_value);
+ CHECK_EQ(0, strcmp("exception", *exception_value));
try_catch.Reset();
}
LocalContext context;
v8::HandleScope scope(context->GetIsolate());
Local<v8::Array> array = v8::Array::New(context->GetIsolate());
- CHECK_EQ(0, array->Length());
+ CHECK_EQ(0u, array->Length());
CHECK(array->Get(0)->IsUndefined());
CHECK(!array->Has(0));
CHECK(array->Get(100)->IsUndefined());
CHECK(!array->Has(100));
array->Set(2, v8_num(7));
- CHECK_EQ(3, array->Length());
+ CHECK_EQ(3u, array->Length());
CHECK(!array->Has(0));
CHECK(!array->Has(1));
CHECK(array->Has(2));
CHECK_EQ(7, array->Get(2)->Int32Value());
Local<Value> obj = CompileRun("[1, 2, 3]");
Local<v8::Array> arr = obj.As<v8::Array>();
- CHECK_EQ(3, arr->Length());
+ CHECK_EQ(3u, arr->Length());
CHECK_EQ(1, arr->Get(0)->Int32Value());
CHECK_EQ(2, arr->Get(1)->Int32Value());
CHECK_EQ(3, arr->Get(2)->Int32Value());
array = v8::Array::New(context->GetIsolate(), 27);
- CHECK_EQ(27, array->Length());
+ CHECK_EQ(27u, array->Length());
array = v8::Array::New(context->GetIsolate(), -27);
- CHECK_EQ(0, array->Length());
+ CHECK_EQ(0u, array->Length());
}
const char* fun = "f()";
Local<v8::Array> a0 = CompileRun(fun).As<v8::Array>();
- CHECK_EQ(0, a0->Length());
+ CHECK_EQ(0u, a0->Length());
const char* fun2 = "f(11)";
Local<v8::Array> a1 = CompileRun(fun2).As<v8::Array>();
- CHECK_EQ(1, a1->Length());
+ CHECK_EQ(1u, a1->Length());
CHECK_EQ(11, a1->Get(0)->Int32Value());
const char* fun3 = "f(12, 13)";
Local<v8::Array> a2 = CompileRun(fun3).As<v8::Array>();
- CHECK_EQ(2, a2->Length());
+ CHECK_EQ(2u, a2->Length());
CHECK_EQ(12, a2->Get(0)->Int32Value());
CHECK_EQ(13, a2->Get(1)->Int32Value());
const char* fun4 = "f(14, 15, 16)";
Local<v8::Array> a3 = CompileRun(fun4).As<v8::Array>();
- CHECK_EQ(3, a3->Length());
+ CHECK_EQ(3u, a3->Length());
CHECK_EQ(14, a3->Get(0)->Int32Value());
CHECK_EQ(15, a3->Get(1)->Int32Value());
CHECK_EQ(16, a3->Get(2)->Int32Value());
const char* fun5 = "f(17, 18, 19, 20)";
Local<v8::Array> a4 = CompileRun(fun5).As<v8::Array>();
- CHECK_EQ(4, a4->Length());
+ CHECK_EQ(4u, a4->Length());
CHECK_EQ(17, a4->Get(0)->Int32Value());
CHECK_EQ(18, a4->Get(1)->Int32Value());
CHECK_EQ(19, a4->Get(2)->Int32Value());
v8::Handle<Value>* args0 = NULL;
Local<v8::Array> a0 = Local<v8::Array>::Cast(Foo->Call(Foo, 0, args0));
- CHECK_EQ(0, a0->Length());
+ CHECK_EQ(0u, a0->Length());
v8::Handle<Value> args1[] = { v8_num(1.1) };
Local<v8::Array> a1 = Local<v8::Array>::Cast(Foo->Call(Foo, 1, args1));
- CHECK_EQ(1, a1->Length());
+ CHECK_EQ(1u, a1->Length());
CHECK_EQ(1.1, a1->Get(v8::Integer::New(isolate, 0))->NumberValue());
v8::Handle<Value> args2[] = { v8_num(2.2),
v8_num(3.3) };
Local<v8::Array> a2 = Local<v8::Array>::Cast(Foo->Call(Foo, 2, args2));
- CHECK_EQ(2, a2->Length());
+ CHECK_EQ(2u, a2->Length());
CHECK_EQ(2.2, a2->Get(v8::Integer::New(isolate, 0))->NumberValue());
CHECK_EQ(3.3, a2->Get(v8::Integer::New(isolate, 1))->NumberValue());
v8_num(5.5),
v8_num(6.6) };
Local<v8::Array> a3 = Local<v8::Array>::Cast(Foo->Call(Foo, 3, args3));
- CHECK_EQ(3, a3->Length());
+ CHECK_EQ(3u, a3->Length());
CHECK_EQ(4.4, a3->Get(v8::Integer::New(isolate, 0))->NumberValue());
CHECK_EQ(5.5, a3->Get(v8::Integer::New(isolate, 1))->NumberValue());
CHECK_EQ(6.6, a3->Get(v8::Integer::New(isolate, 2))->NumberValue());
v8_num(9.9),
v8_num(10.11) };
Local<v8::Array> a4 = Local<v8::Array>::Cast(Foo->Call(Foo, 4, args4));
- CHECK_EQ(4, a4->Length());
+ CHECK_EQ(4u, a4->Length());
CHECK_EQ(7.7, a4->Get(v8::Integer::New(isolate, 0))->NumberValue());
CHECK_EQ(8.8, a4->Get(v8::Integer::New(isolate, 1))->NumberValue());
CHECK_EQ(9.9, a4->Get(v8::Integer::New(isolate, 2))->NumberValue());
v8::Handle<Value>* args0 = NULL;
Local<v8::Array> a0 = Local<v8::Array>::Cast(Foo->NewInstance(0, args0));
- CHECK_EQ(0, a0->Length());
+ CHECK_EQ(0u, a0->Length());
v8::Handle<Value> args1[] = { v8_num(1.1) };
Local<v8::Array> a1 = Local<v8::Array>::Cast(Foo->NewInstance(1, args1));
- CHECK_EQ(1, a1->Length());
+ CHECK_EQ(1u, a1->Length());
CHECK_EQ(1.1, a1->Get(v8::Integer::New(isolate, 0))->NumberValue());
v8::Handle<Value> args2[] = { v8_num(2.2),
v8_num(3.3) };
Local<v8::Array> a2 = Local<v8::Array>::Cast(Foo->NewInstance(2, args2));
- CHECK_EQ(2, a2->Length());
+ CHECK_EQ(2u, a2->Length());
CHECK_EQ(2.2, a2->Get(v8::Integer::New(isolate, 0))->NumberValue());
CHECK_EQ(3.3, a2->Get(v8::Integer::New(isolate, 1))->NumberValue());
v8_num(5.5),
v8_num(6.6) };
Local<v8::Array> a3 = Local<v8::Array>::Cast(Foo->NewInstance(3, args3));
- CHECK_EQ(3, a3->Length());
+ CHECK_EQ(3u, a3->Length());
CHECK_EQ(4.4, a3->Get(v8::Integer::New(isolate, 0))->NumberValue());
CHECK_EQ(5.5, a3->Get(v8::Integer::New(isolate, 1))->NumberValue());
CHECK_EQ(6.6, a3->Get(v8::Integer::New(isolate, 2))->NumberValue());
v8_num(9.9),
v8_num(10.11) };
Local<v8::Array> a4 = Local<v8::Array>::Cast(Foo->NewInstance(4, args4));
- CHECK_EQ(4, a4->Length());
+ CHECK_EQ(4u, a4->Length());
CHECK_EQ(7.7, a4->Get(v8::Integer::New(isolate, 0))->NumberValue());
CHECK_EQ(8.8, a4->Get(v8::Integer::New(isolate, 1))->NumberValue());
CHECK_EQ(9.9, a4->Get(v8::Integer::New(isolate, 2))->NumberValue());
static void CheckUncle(v8::TryCatch* try_catch) {
CHECK(try_catch->HasCaught());
String::Utf8Value str_value(try_catch->Exception());
- CHECK_EQ(*str_value, "uncle?");
+ CHECK_EQ(0, strcmp(*str_value, "uncle?"));
try_catch->Reset();
}
CheckUncle(&try_catch);
uint32_t uint32_value = obj->Uint32Value();
- CHECK_EQ(0, uint32_value);
+ CHECK_EQ(0u, uint32_value);
CheckUncle(&try_catch);
double number_value = obj->NumberValue();
- CHECK_NE(0, std::isnan(number_value));
+ CHECK(std::isnan(number_value));
CheckUncle(&try_catch);
int64_t integer_value = obj->IntegerValue();
- CHECK_EQ(0.0, static_cast<double>(integer_value));
+ CHECK_EQ(0, integer_value);
CheckUncle(&try_catch);
}
CHECK(result.IsEmpty());
CHECK(try_catch.HasCaught());
String::Utf8Value exception_value(try_catch.Exception());
- CHECK_EQ("konto", *exception_value);
+ CHECK_EQ(0, strcmp("konto", *exception_value));
}
" return 'no exception';"
"}"
"[Run('str'), Run(1), Run(0), Run(null), Run(void 0)];"));
- CHECK_EQ(5, result->Length());
+ CHECK_EQ(5u, result->Length());
CHECK(result->Get(v8::Integer::New(isolate, 0))->IsString());
CHECK(result->Get(v8::Integer::New(isolate, 1))->IsNumber());
CHECK_EQ(1, result->Get(v8::Integer::New(isolate, 1))->Int32Value());
CHECK(v8_str("a")->Equals(v8_str("a")));
CHECK(!v8_str("a")->Equals(v8_str("b")));
- CHECK_EQ(v8_str("a"), v8_str("a"));
- CHECK_NE(v8_str("a"), v8_str("b"));
- CHECK_EQ(v8_num(1), v8_num(1));
- CHECK_EQ(v8_num(1.00), v8_num(1));
- CHECK_NE(v8_num(1), v8_num(2));
+ CHECK(v8_str("a")->Equals(v8_str("a")));
+ CHECK(!v8_str("a")->Equals(v8_str("b")));
+ CHECK(v8_num(1)->Equals(v8_num(1)));
+ CHECK(v8_num(1.00)->Equals(v8_num(1)));
+ CHECK(!v8_num(1)->Equals(v8_num(2)));
// Assume String is not internalized.
CHECK(v8_str("a")->StrictEquals(v8_str("a")));
static void GetXValue(Local<String> name,
const v8::PropertyCallbackInfo<v8::Value>& info) {
ApiTestFuzzer::Fuzz();
- CHECK_EQ(info.Data(), v8_str("donut"));
- CHECK_EQ(name, v8_str("x"));
+ CHECK(info.Data()->Equals(v8_str("donut")));
+ CHECK(name->Equals(v8_str("x")));
info.GetReturnValue().Set(name);
}
Local<Script> script = v8_compile("obj.x");
for (int i = 0; i < 10; i++) {
Local<Value> result = script->Run();
- CHECK_EQ(result, v8_str("x"));
+ CHECK(result->Equals(v8_str("x")));
}
}
"Object.defineProperty(obj, 'x', desc);"
"obj.x");
result = script_define->Run();
- CHECK_EQ(result, v8_num(42));
+ CHECK(result->Equals(v8_num(42)));
// Check that the accessor is still configurable
result = script_desc->Run();
"Object.defineProperty(obj, 'x', desc);"
"obj.x");
result = script_define->Run();
- CHECK_EQ(result, v8_num(43));
+ CHECK(result->Equals(v8_num(43)));
result = script_desc->Run();
CHECK_EQ(result->BooleanValue(), false);
result = script_define->Run();
CHECK(try_catch.HasCaught());
String::Utf8Value exception_value(try_catch.Exception());
- CHECK_EQ(*exception_value, "TypeError: Cannot redefine property: x");
+ CHECK_EQ(0,
+ strcmp(*exception_value, "TypeError: Cannot redefine property: x"));
}
"Object.defineProperty(obj, 'x', desc);"
"obj.x");
result = script_define->Run();
- CHECK_EQ(result, v8_num(42));
+ CHECK(result->Equals(v8_num(42)));
result = script_desc->Run();
"Object.defineProperty(obj, 'x', desc);"
"obj.x");
result = script_define->Run();
- CHECK_EQ(result, v8_num(43));
+ CHECK(result->Equals(v8_num(43)));
result = script_desc->Run();
CHECK_EQ(result->BooleanValue(), false);
result = script_define->Run();
CHECK(try_catch.HasCaught());
String::Utf8Value exception_value(try_catch.Exception());
- CHECK_EQ(*exception_value, "TypeError: Cannot redefine property: x");
+ CHECK_EQ(0,
+ strcmp(*exception_value, "TypeError: Cannot redefine property: x"));
}
"{get: function() { return 'func'; }})");
CHECK(try_catch.HasCaught());
String::Utf8Value exception_value(try_catch.Exception());
- CHECK_EQ(*exception_value, "TypeError: Cannot redefine property: x");
+ CHECK_EQ(
+ 0, strcmp(*exception_value, "TypeError: Cannot redefine property: x"));
}
{
v8::TryCatch try_catch;
"{get: function() { return 'func'; }})");
CHECK(try_catch.HasCaught());
String::Utf8Value exception_value(try_catch.Exception());
- CHECK_EQ(*exception_value, "TypeError: Cannot redefine property: x");
+ CHECK_EQ(
+ 0, strcmp(*exception_value, "TypeError: Cannot redefine property: x"));
}
}
static void Get239Value(Local<String> name,
const v8::PropertyCallbackInfo<v8::Value>& info) {
ApiTestFuzzer::Fuzz();
- CHECK_EQ(info.Data(), v8_str("donut"));
- CHECK_EQ(name, v8_str("239"));
+ CHECK(info.Data()->Equals(v8_str("donut")));
+ CHECK(name->Equals(v8_str("239")));
info.GetReturnValue().Set(name);
}
static void SetXValue(Local<String> name,
Local<Value> value,
const v8::PropertyCallbackInfo<void>& info) {
- CHECK_EQ(value, v8_num(4));
- CHECK_EQ(info.Data(), v8_str("donut"));
- CHECK_EQ(name, v8_str("x"));
+ CHECK(value->Equals(v8_num(4)));
+ CHECK(info.Data()->Equals(v8_str("donut")));
+ CHECK(name->Equals(v8_str("x")));
CHECK(xValue.IsEmpty());
xValue.Reset(info.GetIsolate(), value);
}
for (int i = 0; i < 10; i++) {
CHECK(xValue.IsEmpty());
script->Run();
- CHECK_EQ(v8_num(4), Local<Value>::New(CcTest::isolate(), xValue));
+ CHECK(v8_num(4)->Equals(Local<Value>::New(CcTest::isolate(), xValue)));
xValue.Reset();
}
}
for (int i = 0; i < 10; i++) {
CHECK(xValue.IsEmpty());
script->Run();
- CHECK_EQ(v8_num(4), Local<Value>::New(CcTest::isolate(), xValue));
+ CHECK(v8_num(4)->Equals(Local<Value>::New(CcTest::isolate(), xValue)));
xValue.Reset();
}
}
Local<Script> script = v8_compile("obj.x");
for (int i = 0; i < 10; i++) {
Local<Value> result = script->Run();
- CHECK_EQ(result, v8_str("x"));
+ CHECK(result->Equals(v8_str("x")));
}
}
Local<Script> script = v8_compile("interceptor_obj.x");
for (int i = 0; i < 10; i++) {
Local<Value> result = script->Run();
- CHECK_EQ(result, v8_str("x"));
+ CHECK(result->Equals(v8_str("x")));
}
// Create a slow case object and a function accessing a property in
// that slow case object (with dictionary probing in generated
"interceptor_obj.y = 10;"
"delete interceptor_obj.y;"
"get_x(interceptor_obj)");
- CHECK_EQ(result, v8_str("x"));
+ CHECK(result->Equals(v8_str("x")));
}
"}"
"get_x(interceptor_obj)");
// Check that the interceptor was actually invoked.
- CHECK_EQ(result, v8_str("x"));
+ CHECK(result->Equals(v8_str("x")));
}
// Return to the original context and force some object to the slow case
Local<Script> interceptor_getter_script = v8_compile(
"obj[37];");
Local<Value> result = getter_script->Run();
- CHECK_EQ(v8_num(5), result);
+ CHECK(v8_num(5)->Equals(result));
result = setter_script->Run();
- CHECK_EQ(v8_num(23), result);
+ CHECK(v8_num(23)->Equals(result));
result = interceptor_setter_script->Run();
- CHECK_EQ(v8_num(23), result);
+ CHECK(v8_num(23)->Equals(result));
result = interceptor_getter_script->Run();
- CHECK_EQ(v8_num(625), result);
+ CHECK(v8_num(625)->Equals(result));
}
CHECK(result->ToObject(isolate)->HasRealIndexedProperty(2000));
Local<Script> key_count_check = v8_compile("key_count;");
result = key_count_check->Run();
- CHECK_EQ(v8_num(40013), result);
+ CHECK(v8_num(40013)->Equals(result));
}
"var key_count = 0;"
"for (x in obj) {key_count++;} key_count;");
Local<Value> result = create_args_script->Run();
- CHECK_EQ(v8_num(4), result);
+ CHECK(v8_num(4)->Equals(result));
}
context1->SetSecurityToken(password);
v8::Handle<v8::Object> global1 = context1->Global();
global1->Set(v8_str("custom"), v8_num(1234));
- CHECK_NE(global0, global1);
+ CHECK(!global0->Equals(global1));
CHECK_EQ(1234, global0->Get(v8_str("custom"))->Int32Value());
CHECK_EQ(1234, global1->Get(v8_str("custom"))->Int32Value());
LocalContext context2(0, templ, global1);
context2->SetSecurityToken(password);
v8::Handle<v8::Object> global2 = context2->Global();
- CHECK_EQ(global1, global2);
+ CHECK(global1->Equals(global2));
CHECK_EQ(0, global1->Get(v8_str("custom"))->Int32Value());
CHECK_EQ(0, global2->Get(v8_str("custom"))->Int32Value());
}
Local<Script> script = v8_compile(source);
- CHECK_EQ(v8::Integer::New(isolate, 42), script->Run());
+ CHECK(v8::Integer::New(isolate, 42)->Equals(script->Run()));
ExpectBoolean("Object.isExtensible(undetectable)", true);
Context::New(CcTest::isolate(), &extensions);
Context::Scope lock(context);
v8::Handle<Value> result = CompileRun("Foo()");
- CHECK_EQ(result, v8::Integer::New(CcTest::isolate(), 4));
+ CHECK(result->Equals(v8::Integer::New(CcTest::isolate(), 4)));
}
Context::New(CcTest::isolate(), &extensions);
Context::Scope lock(context);
v8::Handle<Value> result = CompileRun("1+3");
- CHECK_EQ(result, v8::Integer::New(CcTest::isolate(), 4));
+ CHECK(result->Equals(v8::Integer::New(CcTest::isolate(), 4)));
}
v8::ExtensionConfiguration extensions(1, extension_names);
v8::Handle<Context> context =
Context::New(CcTest::isolate(), &extensions);
- CHECK_EQ(0, *context);
+ CHECK(0 == *context);
}
if (source_len == kEmbeddedExtensionSourceValidLen) {
Context::Scope lock(context);
v8::Handle<Value> result = CompileRun("Ret54321()");
- CHECK_EQ(v8::Integer::New(CcTest::isolate(), 54321), result);
+ CHECK(v8::Integer::New(CcTest::isolate(), 54321)->Equals(result));
} else {
// Anything but exactly the right length should fail to compile.
- CHECK_EQ(0, *context);
+ CHECK(0 == *context);
}
}
}
Context::New(CcTest::isolate(), &extensions);
Context::Scope lock(context);
v8::Handle<Value> result = CompileRun("UseEval1()");
- CHECK_EQ(result, v8::Integer::New(CcTest::isolate(), 42));
+ CHECK(result->Equals(v8::Integer::New(CcTest::isolate(), 42)));
result = CompileRun("UseEval2()");
- CHECK_EQ(result, v8::Integer::New(CcTest::isolate(), 42));
+ CHECK(result->Equals(v8::Integer::New(CcTest::isolate(), 42)));
}
Context::New(CcTest::isolate(), &extensions);
Context::Scope lock(context);
v8::Handle<Value> result = CompileRun("UseWith1()");
- CHECK_EQ(result, v8::Integer::New(CcTest::isolate(), 87));
+ CHECK(result->Equals(v8::Integer::New(CcTest::isolate(), 87)));
result = CompileRun("UseWith2()");
- CHECK_EQ(result, v8::Integer::New(CcTest::isolate(), 87));
+ CHECK(result->Equals(v8::Integer::New(CcTest::isolate(), 87)));
}
Context::New(CcTest::isolate());
Context::Scope lock(context);
v8::Handle<Value> result = CompileRun("Foo()");
- CHECK_EQ(result, v8::Integer::New(CcTest::isolate(), 4));
+ CHECK(result->Equals(v8::Integer::New(CcTest::isolate(), 4)));
}
Context::New(CcTest::isolate(), &extensions);
Context::Scope lock(context);
v8::Handle<Value> result = CompileRun(kNativeCallTest);
- CHECK_EQ(result, v8::Integer::New(CcTest::isolate(), 3));
+ CHECK(result->Equals(v8::Integer::New(CcTest::isolate(), 3)));
}
Context::New(CcTest::isolate(), &extensions);
Context::Scope lock(context);
v8::Handle<Value> result = CompileRun("foo(42);");
- CHECK_EQ(result, v8::Integer::New(CcTest::isolate(), 42));
+ CHECK(result->Equals(v8::Integer::New(CcTest::isolate(), 42)));
}
v8::HandleScope handle_scope(CcTest::isolate());
v8::ExtensionConfiguration config(1, &name);
LocalContext context(&config);
- CHECK_EQ(String::NewFromUtf8(CcTest::isolate(), expected),
- context->Global()->Get(v8_str("loaded")));
+ CHECK(String::NewFromUtf8(CcTest::isolate(), expected)
+ ->Equals(context->Global()->Get(v8_str("loaded"))));
}
static const char* exts[2] = { "C", "E" };
v8::ExtensionConfiguration config(2, exts);
LocalContext context(&config);
- CHECK_EQ(v8_str("undefinedACBDE"), context->Global()->Get(v8_str("loaded")));
+ CHECK(v8_str("undefinedACBDE")
+ ->Equals(context->Global()->Get(v8_str("loaded"))));
}
v8::ExtensionConfiguration config(1, exts);
LocalContext context(&config);
CHECK_EQ(3, lookup_count);
- CHECK_EQ(v8::Integer::New(CcTest::isolate(), 8),
- CompileRun("Foo(0)"));
- CHECK_EQ(v8::Integer::New(CcTest::isolate(), 7),
- CompileRun("Foo(1)"));
- CHECK_EQ(v8::Integer::New(CcTest::isolate(), 6),
- CompileRun("Foo(2)"));
+ CHECK(v8::Integer::New(CcTest::isolate(), 8)->Equals(CompileRun("Foo(0)")));
+ CHECK(v8::Integer::New(CcTest::isolate(), 7)->Equals(CompileRun("Foo(1)")));
+ CHECK(v8::Integer::New(CcTest::isolate(), 6)->Equals(CompileRun("Foo(2)")));
}
for (int i = 0; i < 10; i++) {
// Run a few times to ensure that allocation of objects doesn't
// change behavior of a constructor function.
- CHECK_EQ(v8::Integer::New(CcTest::isolate(), 8),
- CompileRun("(new A()).data"));
- CHECK_EQ(v8::Integer::New(CcTest::isolate(), 7),
- CompileRun("(new B()).data"));
- CHECK_EQ(v8::Integer::New(CcTest::isolate(), 6),
- CompileRun("(new C()).data"));
+ CHECK(v8::Integer::New(CcTest::isolate(), 8)
+ ->Equals(CompileRun("(new A()).data")));
+ CHECK(v8::Integer::New(CcTest::isolate(), 7)
+ ->Equals(CompileRun("(new B()).data")));
+ CHECK(v8::Integer::New(CcTest::isolate(), 6)
+ ->Equals(CompileRun("(new C()).data")));
}
}
v8::Handle<Context> context =
Context::New(CcTest::isolate(), &config);
CHECK(context.IsEmpty());
- CHECK_NE(last_location, NULL);
+ CHECK(last_location);
}
static void MissingScriptInfoMessageListener(v8::Handle<v8::Message> message,
v8::Handle<Value> data) {
CHECK(message->GetScriptOrigin().ResourceName()->IsUndefined());
- CHECK_EQ(v8::Undefined(CcTest::isolate()),
- message->GetScriptOrigin().ResourceName());
+ CHECK(v8::Undefined(CcTest::isolate())
+ ->Equals(message->GetScriptOrigin().ResourceName()));
message->GetLineNumber();
message->GetSourceLine();
}
v8::Local<v8::Object> o =
v8::Local<v8::Object>::New(isolate, object.handle);
v8::Local<String> y_str = v8_str("y");
- CHECK_EQ(v8::Integer::New(isolate, 1), o->Get(v8_str("x")));
+ CHECK(v8::Integer::New(isolate, 1)->Equals(o->Get(v8_str("x"))));
CHECK(o->Get(y_str)->Equals(y_str));
}
}
const v8::FunctionCallbackInfo<v8::Value>& args) {
ApiTestFuzzer::Fuzz();
v8::Isolate* isolate = args.GetIsolate();
- CHECK_EQ(args_fun, args.Callee());
+ CHECK(args_fun->Equals(args.Callee()));
CHECK_EQ(3, args.Length());
- CHECK_EQ(v8::Integer::New(isolate, 1), args[0]);
- CHECK_EQ(v8::Integer::New(isolate, 2), args[1]);
- CHECK_EQ(v8::Integer::New(isolate, 3), args[2]);
- CHECK_EQ(v8::Undefined(isolate), args[3]);
+ CHECK(v8::Integer::New(isolate, 1)->Equals(args[0]));
+ CHECK(v8::Integer::New(isolate, 2)->Equals(args[1]));
+ CHECK(v8::Integer::New(isolate, 3)->Equals(args[2]));
+ CHECK(v8::Undefined(isolate)->Equals(args[3]));
v8::HandleScope scope(args.GetIsolate());
CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
}
CHECK(v8_compile("delete k.foo")->Run()->IsFalse());
CHECK(v8_compile("delete k.bar")->Run()->IsTrue());
- CHECK_EQ(v8_compile("k.foo")->Run(), v8_str("foo"));
+ CHECK(v8_compile("k.foo")->Run()->Equals(v8_str("foo")));
CHECK(v8_compile("k.bar")->Run()->IsUndefined());
CHECK(v8_compile("delete k[2]")->Run()->IsFalse());
CHECK(v8_compile("delete k[4]")->Run()->IsTrue());
- CHECK_EQ(v8_compile("k[2]")->Run(), v8_num(2));
+ CHECK(v8_compile("k[2]")->Run()->Equals(v8_num(2)));
CHECK(v8_compile("k[4]")->Run()->IsUndefined());
}
// properties in insertion order, named interceptor properties.
// This order is not mandated by the spec, so this test is just
// documenting our behavior.
- CHECK_EQ(17, result->Length());
+ CHECK_EQ(17u, result->Length());
// Indexed properties in numerical order.
- CHECK_EQ(v8_str("5"), result->Get(v8::Integer::New(isolate, 0)));
- CHECK_EQ(v8_str("10"), result->Get(v8::Integer::New(isolate, 1)));
- CHECK_EQ(v8_str("140000"), result->Get(v8::Integer::New(isolate, 2)));
- CHECK_EQ(v8_str("4294967295"), result->Get(v8::Integer::New(isolate, 3)));
+ CHECK(v8_str("5")->Equals(result->Get(v8::Integer::New(isolate, 0))));
+ CHECK(v8_str("10")->Equals(result->Get(v8::Integer::New(isolate, 1))));
+ CHECK(v8_str("140000")->Equals(result->Get(v8::Integer::New(isolate, 2))));
+ CHECK(
+ v8_str("4294967295")->Equals(result->Get(v8::Integer::New(isolate, 3))));
// Indexed interceptor properties in the order they are returned
// from the enumerator interceptor.
- CHECK_EQ(v8_str("0"), result->Get(v8::Integer::New(isolate, 4)));
- CHECK_EQ(v8_str("1"), result->Get(v8::Integer::New(isolate, 5)));
+ CHECK(v8_str("0")->Equals(result->Get(v8::Integer::New(isolate, 4))));
+ CHECK(v8_str("1")->Equals(result->Get(v8::Integer::New(isolate, 5))));
// Named properties in insertion order.
- CHECK_EQ(v8_str("a"), result->Get(v8::Integer::New(isolate, 6)));
- CHECK_EQ(v8_str("b"), result->Get(v8::Integer::New(isolate, 7)));
- CHECK_EQ(v8_str("c"), result->Get(v8::Integer::New(isolate, 8)));
- CHECK_EQ(v8_str("4294967296"), result->Get(v8::Integer::New(isolate, 9)));
- CHECK_EQ(v8_str("d"), result->Get(v8::Integer::New(isolate, 10)));
- CHECK_EQ(v8_str("e"), result->Get(v8::Integer::New(isolate, 11)));
- CHECK_EQ(v8_str("30000000000"), result->Get(v8::Integer::New(isolate, 12)));
- CHECK_EQ(v8_str("f"), result->Get(v8::Integer::New(isolate, 13)));
+ CHECK(v8_str("a")->Equals(result->Get(v8::Integer::New(isolate, 6))));
+ CHECK(v8_str("b")->Equals(result->Get(v8::Integer::New(isolate, 7))));
+ CHECK(v8_str("c")->Equals(result->Get(v8::Integer::New(isolate, 8))));
+ CHECK(
+ v8_str("4294967296")->Equals(result->Get(v8::Integer::New(isolate, 9))));
+ CHECK(v8_str("d")->Equals(result->Get(v8::Integer::New(isolate, 10))));
+ CHECK(v8_str("e")->Equals(result->Get(v8::Integer::New(isolate, 11))));
+ CHECK(v8_str("30000000000")
+ ->Equals(result->Get(v8::Integer::New(isolate, 12))));
+ CHECK(v8_str("f")->Equals(result->Get(v8::Integer::New(isolate, 13))));
// Named interceptor properties.
- CHECK_EQ(v8_str("foo"), result->Get(v8::Integer::New(isolate, 14)));
- CHECK_EQ(v8_str("bar"), result->Get(v8::Integer::New(isolate, 15)));
- CHECK_EQ(v8_str("baz"), result->Get(v8::Integer::New(isolate, 16)));
+ CHECK(v8_str("foo")->Equals(result->Get(v8::Integer::New(isolate, 14))));
+ CHECK(v8_str("bar")->Equals(result->Get(v8::Integer::New(isolate, 15))));
+ CHECK(v8_str("baz")->Equals(result->Get(v8::Integer::New(isolate, 16))));
}
p_getter_count++;
v8::Handle<v8::Object> global =
info.GetIsolate()->GetCurrentContext()->Global();
- CHECK_EQ(info.Holder(), global->Get(v8_str("o1")));
+ CHECK(info.Holder()->Equals(global->Get(v8_str("o1"))));
if (name->Equals(v8_str("p1"))) {
- CHECK_EQ(info.This(), global->Get(v8_str("o1")));
+ CHECK(info.This()->Equals(global->Get(v8_str("o1"))));
} else if (name->Equals(v8_str("p2"))) {
- CHECK_EQ(info.This(), global->Get(v8_str("o2")));
+ CHECK(info.This()->Equals(global->Get(v8_str("o2"))));
} else if (name->Equals(v8_str("p3"))) {
- CHECK_EQ(info.This(), global->Get(v8_str("o3")));
+ CHECK(info.This()->Equals(global->Get(v8_str("o3"))));
} else if (name->Equals(v8_str("p4"))) {
- CHECK_EQ(info.This(), global->Get(v8_str("o4")));
+ CHECK(info.This()->Equals(global->Get(v8_str("o4"))));
}
}
p_getter_count2++;
v8::Handle<v8::Object> global =
info.GetIsolate()->GetCurrentContext()->Global();
- CHECK_EQ(info.Holder(), global->Get(v8_str("o1")));
+ CHECK(info.Holder()->Equals(global->Get(v8_str("o1"))));
if (name->Equals(v8_str("p1"))) {
- CHECK_EQ(info.This(), global->Get(v8_str("o1")));
+ CHECK(info.This()->Equals(global->Get(v8_str("o1"))));
} else if (name->Equals(v8_str("p2"))) {
- CHECK_EQ(info.This(), global->Get(v8_str("o2")));
+ CHECK(info.This()->Equals(global->Get(v8_str("o2"))));
} else if (name->Equals(v8_str("p3"))) {
- CHECK_EQ(info.This(), global->Get(v8_str("o3")));
+ CHECK(info.This()->Equals(global->Get(v8_str("o3"))));
} else if (name->Equals(v8_str("p4"))) {
- CHECK_EQ(info.This(), global->Get(v8_str("o4")));
+ CHECK(info.This()->Equals(global->Get(v8_str("o4"))));
}
}
for (int i = 0; i < 100; i++) {
v8::HandleScope inner_scope(CcTest::isolate());
v8::Handle<v8::Object> obj = templ->NewInstance();
- CHECK_NE(obj, context->Global()->Get(v8_str("o")));
+ CHECK(!obj->Equals(context->Global()->Get(v8_str("o"))));
context->Global()->Set(v8_str("o2"), obj);
v8::Handle<Value> value =
CompileRun("o.__proto__ === o2.__proto__");
- CHECK_EQ(v8::True(isolate), value);
+ CHECK(v8::True(isolate)->Equals(value));
context->Global()->Set(v8_str("o"), obj);
}
}
uint16_t lead = StringGet(string, nchars - 2);
if (((lead & 0xfc00) == 0xd800) &&
((trail & 0xfc00) == 0xdc00)) {
- unsigned char u1 = buffer2[utf8_written2 - 4];
- unsigned char u2 = buffer2[utf8_written2 - 3];
- unsigned char u3 = buffer2[utf8_written2 - 2];
- unsigned char u4 = buffer2[utf8_written2 - 1];
- CHECK_EQ((u1 & 0xf8), 0xf0);
- CHECK_EQ((u2 & 0xc0), 0x80);
- CHECK_EQ((u3 & 0xc0), 0x80);
- CHECK_EQ((u4 & 0xc0), 0x80);
+ unsigned u1 = buffer2[utf8_written2 - 4];
+ unsigned u2 = buffer2[utf8_written2 - 3];
+ unsigned u3 = buffer2[utf8_written2 - 2];
+ unsigned u4 = buffer2[utf8_written2 - 1];
+ CHECK_EQ((u1 & 0xf8), 0xf0u);
+ CHECK_EQ((u2 & 0xc0), 0x80u);
+ CHECK_EQ((u3 & 0xc0), 0x80u);
+ CHECK_EQ((u4 & 0xc0), 0x80u);
uint32_t c = 0x10000 + ((lead & 0x3ff) << 10) + (trail & 0x3ff);
CHECK_EQ((u4 & 0x3f), (c & 0x3f));
CHECK_EQ((u3 & 0x3f), ((c >> 6) & 0x3f));
context->Global()->Set(v8_str("holder"), holder);
v8::Handle<Value> result = CompileRun(
"holder.y = 11; holder.y = 12; holder.y");
- CHECK_EQ(12, result->Uint32Value());
+ CHECK_EQ(12u, result->Uint32Value());
}
v8::Handle<v8::Value> name_val = message->GetScriptOrigin().ResourceName();
CHECK(!name_val.IsEmpty() && name_val->IsString());
v8::String::Utf8Value name(message->GetScriptOrigin().ResourceName());
- CHECK_EQ(script_resource_name, *name);
+ CHECK_EQ(0, strcmp(script_resource_name, *name));
CHECK_EQ(3, message->GetLineNumber());
v8::String::Utf8Value source_line(message->GetSourceLine());
- CHECK_EQ(" new o.foo();", *source_line);
+ CHECK_EQ(0, strcmp(" new o.foo();", *source_line));
}
v8::HandleScope scope(env->GetIsolate());
v8::TryCatch try_catch;
v8_compile("This doesn't &*&@#$&*^ compile.");
- CHECK_NE(NULL, *try_catch.Exception());
+ CHECK(*try_catch.Exception());
CHECK(try_catch.HasCaught());
}
CHECK(try_catch.HasCaught());
CHECK(!try_catch.Message().IsEmpty());
String::Utf8Value exception_value(try_catch.Exception());
- CHECK_EQ(*exception_value, "1");
+ CHECK_EQ(0, strcmp(*exception_value, "1"));
try_catch.Reset();
CompileRun("try {"
" CEvaluate('throw 1;');"
CHECK(try_catch.HasCaught());
CHECK(!try_catch.Message().IsEmpty());
String::Utf8Value finally_exception_value(try_catch.Exception());
- CHECK_EQ(*finally_exception_value, "2");
+ CHECK_EQ(0, strcmp(*finally_exception_value, "2"));
}
env3->Enter();
Local<v8::Object> global3 = env3->Global();
- CHECK_EQ(global2, global3);
+ CHECK(global2->Equals(global3));
CHECK(global3->Get(v8_str("prop"))->IsUndefined());
CHECK(global3->Get(v8_str("getProp"))->IsUndefined());
global3->Set(v8_str("prop"), v8::Integer::New(env3->GetIsolate(), -1));
0,
v8::Handle<v8::ObjectTemplate>(),
global2);
- CHECK_EQ(global2, env3->Global());
+ CHECK(global2->Equals(env3->Global()));
// Start by using the same security token for env3 as for env1 and env2.
env3->SetSecurityToken(foo);
Local<Value> result;
result = CompileRun("bound_x()");
- CHECK_EQ(v8_str("env2_x"), result);
+ CHECK(v8_str("env2_x")->Equals(result));
result = CompileRun("get_x()");
CHECK(result.IsEmpty());
result = CompileRun("get_x_w()");
CHECK(result.IsEmpty());
result = CompileRun("this_x()");
- CHECK_EQ(v8_str("env2_x"), result);
+ CHECK(v8_str("env2_x")->Equals(result));
// Reattach env2's proxy
env2 = Context::New(env1->GetIsolate(),
"}"
"results");
Local<v8::Array> results = Local<v8::Array>::Cast(result);
- CHECK_EQ(16, results->Length());
+ CHECK_EQ(16u, results->Length());
for (int i = 0; i < 16; i += 4) {
- CHECK_EQ(v8_str("env2_x"), results->Get(i + 0));
- CHECK_EQ(v8_str("env1_x"), results->Get(i + 1));
- CHECK_EQ(v8_str("env3_x"), results->Get(i + 2));
- CHECK_EQ(v8_str("env2_x"), results->Get(i + 3));
+ CHECK(v8_str("env2_x")->Equals(results->Get(i + 0)));
+ CHECK(v8_str("env1_x")->Equals(results->Get(i + 1)));
+ CHECK(v8_str("env3_x")->Equals(results->Get(i + 2)));
+ CHECK(v8_str("env2_x")->Equals(results->Get(i + 3)));
}
}
"}"
"results");
Local<v8::Array> results = Local<v8::Array>::Cast(result);
- CHECK_EQ(16, results->Length());
+ CHECK_EQ(16u, results->Length());
for (int i = 0; i < 16; i += 4) {
- CHECK_EQ(v8_str("env2_x"), results->Get(i + 0));
- CHECK_EQ(v8_str("env3_x"), results->Get(i + 1));
- CHECK_EQ(v8_str("env3_x"), results->Get(i + 2));
- CHECK_EQ(v8_str("env2_x"), results->Get(i + 3));
+ CHECK(v8_str("env2_x")->Equals(results->Get(i + 0)));
+ CHECK(v8_str("env3_x")->Equals(results->Get(i + 1)));
+ CHECK(v8_str("env3_x")->Equals(results->Get(i + 2)));
+ CHECK(v8_str("env2_x")->Equals(results->Get(i + 3)));
}
result = CompileRun(
"}"
"results");
results = Local<v8::Array>::Cast(result);
- CHECK_EQ(16, results->Length());
+ CHECK_EQ(16u, results->Length());
for (int i = 0; i < 16; i += 4) {
- CHECK_EQ(v8_str("env2_x"), results->Get(i + 0));
- CHECK_EQ(v8_str("env1_x"), results->Get(i + 1));
- CHECK_EQ(v8_str("env3_x"), results->Get(i + 2));
- CHECK_EQ(v8_str("env2_x"), results->Get(i + 3));
+ CHECK(v8_str("env2_x")->Equals(results->Get(i + 0)));
+ CHECK(v8_str("env1_x")->Equals(results->Get(i + 1)));
+ CHECK(v8_str("env3_x")->Equals(results->Get(i + 2)));
+ CHECK(v8_str("env2_x")->Equals(results->Get(i + 3)));
}
}
CompileRun("Object.getOwnPropertyNames(object)");
CHECK(result->IsArray());
v8::Handle<v8::Array> result_array = v8::Handle<v8::Array>::Cast(result);
- CHECK_EQ(2, result_array->Length());
+ CHECK_EQ(2u, result_array->Length());
CHECK(result_array->Get(0)->IsString());
CHECK(result_array->Get(1)->IsString());
- CHECK_EQ(v8_str("7"), result_array->Get(0));
- CHECK_EQ(v8_str("x"), result_array->Get(1));
+ CHECK(v8_str("7")->Equals(result_array->Get(0)));
+ CHECK(v8_str("x")->Equals(result_array->Get(1)));
result = CompileRun("var ret = []; for (var k in object) ret.push(k); ret");
CHECK(result->IsArray());
result_array = v8::Handle<v8::Array>::Cast(result);
- CHECK_EQ(2, result_array->Length());
+ CHECK_EQ(2u, result_array->Length());
CHECK(result_array->Get(0)->IsString());
CHECK(result_array->Get(1)->IsString());
- CHECK_EQ(v8_str("7"), result_array->Get(0));
- CHECK_EQ(v8_str("x"), result_array->Get(1));
+ CHECK(v8_str("7")->Equals(result_array->Get(0)));
+ CHECK(v8_str("x")->Equals(result_array->Get(1)));
result = CompileRun("Object.getOwnPropertySymbols(object)");
CHECK(result->IsArray());
result_array = v8::Handle<v8::Array>::Cast(result);
- CHECK_EQ(1, result_array->Length());
- CHECK_EQ(result_array->Get(0), v8::Symbol::GetIterator(isolate));
+ CHECK_EQ(1u, result_array->Length());
+ CHECK(result_array->Get(0)->Equals(v8::Symbol::GetIterator(isolate)));
}
// object.
Local<Value> proto = o0->Get(v8_str("__proto__"));
CHECK(proto->IsObject());
- CHECK_EQ(proto.As<v8::Object>(), o3);
+ CHECK(proto.As<v8::Object>()->Equals(o3));
// However, Object::GetPrototype ignores hidden prototype.
Local<Value> proto0 = o0->GetPrototype();
CHECK(proto0->IsObject());
- CHECK_EQ(proto0.As<v8::Object>(), o1);
+ CHECK(proto0.As<v8::Object>()->Equals(o1));
Local<Value> proto1 = o1->GetPrototype();
CHECK(proto1->IsObject());
- CHECK_EQ(proto1.As<v8::Object>(), o2);
+ CHECK(proto1.As<v8::Object>()->Equals(o2));
Local<Value> proto2 = o2->GetPrototype();
CHECK(proto2->IsObject());
- CHECK_EQ(proto2.As<v8::Object>(), o3);
+ CHECK(proto2.As<v8::Object>()->Equals(o3));
}
CHECK(!try_catch.HasCaught());
CHECK(value->IsString());
String::Utf8Value string_value1(value->ToString(isolate));
- CHECK_EQ("tipli", *string_value1);
+ CHECK_EQ(0, strcmp("tipli", *string_value1));
Local<Value> args2[] = { v8_str("tipli") };
Local<Value> value_obj2 = instance->CallAsConstructor(1, args2);
CHECK(!try_catch.HasCaught());
CHECK(value->IsString());
String::Utf8Value string_value2(value->ToString(isolate));
- CHECK_EQ("tipli", *string_value2);
+ CHECK_EQ(0, strcmp("tipli", *string_value2));
// Call the Object's constructor with a Boolean.
value = CompileRun("(function() { var o = new obj(true); return o.a; })()");
value = CompileRun("new obj2(28)");
CHECK(try_catch.HasCaught());
String::Utf8Value exception_value1(try_catch.Exception());
- CHECK_EQ("TypeError: obj2 is not a function", *exception_value1);
+ CHECK_EQ(0, strcmp("TypeError: obj2 is not a function", *exception_value1));
try_catch.Reset();
Local<Value> args[] = { v8_num(29) };
value = instance->CallAsConstructor(1, args);
CHECK(try_catch.HasCaught());
String::Utf8Value exception_value2(try_catch.Exception());
- CHECK_EQ("TypeError: #<Object> is not a function", *exception_value2);
+ CHECK_EQ(
+ 0, strcmp("TypeError: #<Object> is not a function", *exception_value2));
try_catch.Reset();
}
value = CompileRun("new obj3(22)");
CHECK(try_catch.HasCaught());
String::Utf8Value exception_value1(try_catch.Exception());
- CHECK_EQ("22", *exception_value1);
+ CHECK_EQ(0, strcmp("22", *exception_value1));
try_catch.Reset();
Local<Value> args[] = { v8_num(23) };
value = instance->CallAsConstructor(1, args);
CHECK(try_catch.HasCaught());
String::Utf8Value exception_value2(try_catch.Exception());
- CHECK_EQ("23", *exception_value2);
+ CHECK_EQ(0, strcmp("23", *exception_value2));
try_catch.Reset();
}
CHECK(try_catch.HasCaught());
String::Utf8Value exception_value1(try_catch.Exception());
// TODO(verwaest): Better message
- CHECK_EQ("TypeError: obj2 is not a function", *exception_value1);
+ CHECK_EQ(0, strcmp("TypeError: obj2 is not a function", *exception_value1));
try_catch.Reset();
// Call an object without call-as-function handler through the API
CHECK(value.IsEmpty());
CHECK(try_catch.HasCaught());
String::Utf8Value exception_value2(try_catch.Exception());
- CHECK_EQ("TypeError: [object Object] is not a function", *exception_value2);
+ CHECK_EQ(0, strcmp("TypeError: [object Object] is not a function",
+ *exception_value2));
try_catch.Reset();
}
value = CompileRun("obj3(22)");
CHECK(try_catch.HasCaught());
String::Utf8Value exception_value1(try_catch.Exception());
- CHECK_EQ("22", *exception_value1);
+ CHECK_EQ(0, strcmp("22", *exception_value1));
try_catch.Reset();
v8::Handle<Value> args[] = { v8_num(23) };
value = instance->CallAsFunction(instance, 1, args);
CHECK(try_catch.HasCaught());
String::Utf8Value exception_value2(try_catch.Exception());
- CHECK_EQ("23", *exception_value2);
+ CHECK_EQ(0, strcmp("23", *exception_value2));
try_catch.Reset();
}
ApiTestFuzzer::Fuzz();
v8::Isolate* isolate = CcTest::isolate();
CHECK_EQ(isolate, info.GetIsolate());
- CHECK_EQ(v8_str("data"), info.Data());
- CHECK_EQ(v8_str("x"), name);
+ CHECK(v8_str("data")->Equals(info.Data()));
+ CHECK(v8_str("x")->Equals(name));
info.GetReturnValue().Set(v8::Integer::New(isolate, 42));
}
CheckReturnValue(args, FUNCTION_ADDR(FastApiCallback_TrivialSignature));
v8::Isolate* isolate = CcTest::isolate();
CHECK_EQ(isolate, args.GetIsolate());
- CHECK_EQ(args.This(), args.Holder());
+ CHECK(args.This()->Equals(args.Holder()));
CHECK(args.Data()->Equals(v8_str("method_data")));
args.GetReturnValue().Set(args[0]->Int32Value() + 1);
}
CheckReturnValue(args, FUNCTION_ADDR(FastApiCallback_SimpleSignature));
v8::Isolate* isolate = CcTest::isolate();
CHECK_EQ(isolate, args.GetIsolate());
- CHECK_EQ(args.This()->GetPrototype(), args.Holder());
+ CHECK(args.This()->GetPrototype()->Equals(args.Holder()));
CHECK(args.Data()->Equals(v8_str("method_data")));
// Note, we're using HasRealNamedProperty instead of Has to avoid
// invoking the interceptor again.
" }"
"}"
"f(); result;");
- CHECK_EQ(v8_str("ggggg"), result);
+ CHECK(v8_str("ggggg")->Equals(result));
}
" return o1.p1"
"}"
"f();");
- CHECK_EQ(v8_str("Direct Getter Result"), result);
+ CHECK(v8_str("Direct Getter Result")->Equals(result));
CHECK_EQ(31, p_getter_count);
}
" try { o1.p1; } catch (e) { result += e; }"
"}"
"result;");
- CHECK_EQ(v8_str("ggggg"), result);
+ CHECK(v8_str("ggggg")->Equals(result));
}
"}");
CHECK(try_catch.HasCaught());
// TODO(verwaest): Adjust message.
- CHECK_EQ(v8_str("TypeError: receiver.method is not a function"),
- try_catch.Exception()->ToString(isolate));
+ CHECK(v8_str("TypeError: receiver.method is not a function")
+ ->Equals(try_catch.Exception()->ToString(isolate)));
CHECK_EQ(42, context->Global()->Get(v8_str("saved_result"))->Int32Value());
CHECK_GE(interceptor_call_count, 50);
}
" }"
"}");
CHECK(try_catch.HasCaught());
- CHECK_EQ(v8_str("TypeError: Illegal invocation"),
- try_catch.Exception()->ToString(isolate));
+ CHECK(v8_str("TypeError: Illegal invocation")
+ ->Equals(try_catch.Exception()->ToString(isolate)));
CHECK_EQ(42, context->Global()->Get(v8_str("saved_result"))->Int32Value());
CHECK_GE(interceptor_call_count, 50);
}
"}");
CHECK(try_catch.HasCaught());
// TODO(verwaest): Adjust message.
- CHECK_EQ(v8_str("TypeError: receiver.method is not a function"),
- try_catch.Exception()->ToString(isolate));
+ CHECK(v8_str("TypeError: receiver.method is not a function")
+ ->Equals(try_catch.Exception()->ToString(isolate)));
CHECK_EQ(42, context->Global()->Get(v8_str("saved_result"))->Int32Value());
}
" }"
"}");
CHECK(try_catch.HasCaught());
- CHECK_EQ(v8_str("TypeError: Illegal invocation"),
- try_catch.Exception()->ToString(isolate));
+ CHECK(v8_str("TypeError: Illegal invocation")
+ ->Equals(try_catch.Exception()->ToString(isolate)));
CHECK_EQ(42, context->Global()->Get(v8_str("saved_result"))->Int32Value());
}
// notifications, we could compare two collections, one created by listening
// from the time of creation of an isolate, and the other by subscribing
// with EnumExisting.
- CHECK_LT(0, code.occupancy());
+ CHECK_LT(0u, code.occupancy());
code_map = NULL;
}
CHECK_EQ(2, message->GetStartColumn());
CHECK_EQ(3, message->GetEndColumn());
v8::String::Utf8Value line(message->GetSourceLine());
- CHECK_EQ(" throw 'nirk';", *line);
+ CHECK_EQ(0, strcmp(" throw 'nirk';", *line));
v8::String::Utf8Value name(message->GetScriptOrigin().ResourceName());
- CHECK_EQ(resource_name, *name);
+ CHECK_EQ(0, strcmp(resource_name, *name));
}
v8::Handle<v8::Value> value = CompileRun("obj.asdf.name");
CHECK(value->IsString());
v8::String::Utf8Value name(value);
- CHECK_EQ("asdf", *name);
+ CHECK_EQ(0, strcmp("asdf", *name));
}
}
-void CheckProperties(v8::Isolate* isolate,
- v8::Handle<v8::Value> val,
- int elmc,
- const char* elmv[]) {
+void CheckProperties(v8::Isolate* isolate, v8::Handle<v8::Value> val,
+ unsigned elmc, const char* elmv[]) {
v8::Handle<v8::Object> obj = val.As<v8::Object>();
v8::Handle<v8::Array> props = obj->GetPropertyNames();
CHECK_EQ(elmc, props->Length());
- for (int i = 0; i < elmc; i++) {
+ for (unsigned i = 0; i < elmc; i++) {
v8::String::Utf8Value elm(props->Get(v8::Integer::New(isolate, i)));
- CHECK_EQ(elmv[i], *elm);
+ CHECK_EQ(0, strcmp(elmv[i], *elm));
}
}
-void CheckOwnProperties(v8::Isolate* isolate,
- v8::Handle<v8::Value> val,
- int elmc,
- const char* elmv[]) {
+void CheckOwnProperties(v8::Isolate* isolate, v8::Handle<v8::Value> val,
+ unsigned elmc, const char* elmv[]) {
v8::Handle<v8::Object> obj = val.As<v8::Object>();
v8::Handle<v8::Array> props = obj->GetOwnPropertyNames();
CHECK_EQ(elmc, props->Length());
- for (int i = 0; i < elmc; i++) {
+ for (unsigned i = 0; i < elmc; i++) {
v8::String::Utf8Value elm(props->Get(v8::Integer::New(isolate, i)));
- CHECK_EQ(elmv[i], *elm);
+ CHECK_EQ(0, strcmp(elmv[i], *elm));
}
}
"result[3] = x;"
"result;");
v8::Handle<v8::Array> elms = obj.As<v8::Array>();
- CHECK_EQ(4, elms->Length());
+ CHECK_EQ(4u, elms->Length());
int elmc0 = 0;
const char** elmv0 = NULL;
CheckProperties(
"result[3] = x;"
"result;");
v8::Handle<v8::Array> elms = obj.As<v8::Array>();
- CHECK_EQ(4, elms->Length());
+ CHECK_EQ(4u, elms->Length());
int elmc0 = 0;
const char** elmv0 = NULL;
CheckProperties(isolate,
v8::Handle<v8::Value> val = elms->Get(v8::Integer::New(isolate, 0));
v8::Handle<v8::Array> props = val.As<v8::Object>()->GetPropertyNames();
- CHECK_EQ(0, props->Length());
+ CHECK_EQ(0u, props->Length());
for (uint32_t i = 0; i < props->Length(); i++) {
printf("p[%u]\n", i);
}
Local<v8::Object> obj = val.As<v8::Object>();
obj->Set(v8_str("gamma"), v8_str("cloneme"));
- CHECK_EQ(v8_str("hello"), obj->Get(v8_str("alpha")));
- CHECK_EQ(v8::Integer::New(isolate, 123), obj->Get(v8_str("beta")));
- CHECK_EQ(v8_str("cloneme"), obj->Get(v8_str("gamma")));
+ CHECK(v8_str("hello")->Equals(obj->Get(v8_str("alpha"))));
+ CHECK(v8::Integer::New(isolate, 123)->Equals(obj->Get(v8_str("beta"))));
+ CHECK(v8_str("cloneme")->Equals(obj->Get(v8_str("gamma"))));
// Clone it.
Local<v8::Object> clone = obj->Clone();
- CHECK_EQ(v8_str("hello"), clone->Get(v8_str("alpha")));
- CHECK_EQ(v8::Integer::New(isolate, 123), clone->Get(v8_str("beta")));
- CHECK_EQ(v8_str("cloneme"), clone->Get(v8_str("gamma")));
+ CHECK(v8_str("hello")->Equals(clone->Get(v8_str("alpha"))));
+ CHECK(v8::Integer::New(isolate, 123)->Equals(clone->Get(v8_str("beta"))));
+ CHECK(v8_str("cloneme")->Equals(clone->Get(v8_str("gamma"))));
// Set a property on the clone, verify each object.
clone->Set(v8_str("beta"), v8::Integer::New(isolate, 456));
- CHECK_EQ(v8::Integer::New(isolate, 123), obj->Get(v8_str("beta")));
- CHECK_EQ(v8::Integer::New(isolate, 456), clone->Get(v8_str("beta")));
+ CHECK(v8::Integer::New(isolate, 123)->Equals(obj->Get(v8_str("beta"))));
+ CHECK(v8::Integer::New(isolate, 456)->Equals(clone->Get(v8_str("beta"))));
}
const char* expected_slice_on_cons =
"ow is the time for all good men to come to the aid of the party"
"Now is the time for all good men to come to the aid of the part";
- CHECK_EQ(String::NewFromUtf8(env->GetIsolate(), expected_cons),
- env->Global()->Get(v8_str("cons")));
- CHECK_EQ(String::NewFromUtf8(env->GetIsolate(), expected_slice),
- env->Global()->Get(v8_str("slice")));
- CHECK_EQ(String::NewFromUtf8(env->GetIsolate(), expected_slice_on_cons),
- env->Global()->Get(v8_str("slice_on_cons")));
+ CHECK(String::NewFromUtf8(env->GetIsolate(), expected_cons)
+ ->Equals(env->Global()->Get(v8_str("cons"))));
+ CHECK(String::NewFromUtf8(env->GetIsolate(), expected_slice)
+ ->Equals(env->Global()->Get(v8_str("slice"))));
+ CHECK(String::NewFromUtf8(env->GetIsolate(), expected_slice_on_cons)
+ ->Equals(env->Global()->Get(v8_str("slice_on_cons"))));
}
i::DeleteArray(two_byte_string);
}
// Check without 'eval' or 'with'.
v8::Handle<v8::Value> res =
CompileRun("function f() { x = 42; return x; }; f()");
- CHECK_EQ(v8::Integer::New(isolate, 0), res);
+ CHECK(v8::Integer::New(isolate, 0)->Equals(res));
// Check with 'eval'.
res = CompileRun("function f() { eval('1'); y = 43; return y; }; f()");
- CHECK_EQ(v8::Integer::New(isolate, 0), res);
+ CHECK(v8::Integer::New(isolate, 0)->Equals(res));
// Check with 'with'.
res = CompileRun("function f() { with (this) { y = 44 }; return y; }; f()");
- CHECK_EQ(v8::Integer::New(isolate, 0), res);
+ CHECK(v8::Integer::New(isolate, 0)->Equals(res));
}
static int force_set_set_count = 0;
last_location = last_message = NULL;
obj->SetIndexedPropertiesToExternalArrayData(NULL, array_type, size);
CHECK(!obj->HasIndexedPropertiesInExternalArrayData());
- CHECK_NE(NULL, last_location);
- CHECK_NE(NULL, last_message);
+ CHECK(last_location);
+ CHECK(last_message);
}
TypedArray::New(ab, 2*sizeof(ElementType), kElementCount);
CheckInternalFieldsAreZero<v8::ArrayBufferView>(ta);
CHECK_EQ(kElementCount, static_cast<int>(ta->Length()));
- CHECK_EQ(2*sizeof(ElementType), static_cast<int>(ta->ByteOffset()));
- CHECK_EQ(kElementCount*sizeof(ElementType),
- static_cast<int>(ta->ByteLength()));
- CHECK_EQ(ab, ta->Buffer());
+ CHECK_EQ(2 * sizeof(ElementType), ta->ByteOffset());
+ CHECK_EQ(kElementCount * sizeof(ElementType), ta->ByteLength());
+ CHECK(ab->Equals(ta->Buffer()));
ElementType* data = backing_store.start() + 2;
for (int i = 0; i < kElementCount; i++) {
Local<v8::DataView> dv =
v8::DataView::New(ab, 2, kSize);
CheckInternalFieldsAreZero<v8::ArrayBufferView>(dv);
- CHECK_EQ(2, static_cast<int>(dv->ByteOffset()));
+ CHECK_EQ(2u, dv->ByteOffset());
CHECK_EQ(kSize, static_cast<int>(dv->ByteLength()));
- CHECK_EQ(ab, dv->Buffer());
+ CHECK(ab->Equals(dv->Buffer()));
}
v8::Handle<v8::String> name =
stackTrace->GetFrame(i)->GetScriptNameOrSourceURL();
CHECK(!name.IsEmpty());
- CHECK_EQ(url, name);
+ CHECK(url->Equals(name));
}
}
v8::Handle<v8::String> name =
stackTrace->GetFrame(i)->GetScriptNameOrSourceURL();
CHECK(!name.IsEmpty());
- CHECK_EQ(url, name);
+ CHECK(url->Equals(name));
}
}
v8::Handle<v8::String> name =
stackTrace->GetFrame(i)->GetScriptNameOrSourceURL();
CHECK(!name.IsEmpty());
- CHECK_EQ(url, name);
+ CHECK(url->Equals(name));
}
}
Local<v8::Message> message = try_catch.Message();
Handle<Value> sourceURL =
message->GetScriptOrigin().ResourceName();
- CHECK_EQ(*v8::String::Utf8Value(sourceURL), "source_url");
+ CHECK_EQ(0, strcmp(*v8::String::Utf8Value(sourceURL), "source_url"));
}
Local<v8::Message> message = try_catch.Message();
Handle<Value> sourceURL =
message->GetScriptOrigin().ResourceName();
- CHECK_EQ(*v8::String::Utf8Value(sourceURL), "source_url");
+ CHECK_EQ(0, strcmp(*v8::String::Utf8Value(sourceURL), "source_url"));
}
LocalContext c1;
v8::HandleScope scope(c1->GetIsolate());
v8::HeapStatistics heap_statistics;
- CHECK_EQ(static_cast<int>(heap_statistics.total_heap_size()), 0);
- CHECK_EQ(static_cast<int>(heap_statistics.used_heap_size()), 0);
+ CHECK_EQ(0u, heap_statistics.total_heap_size());
+ CHECK_EQ(0u, heap_statistics.used_heap_size());
c1->GetIsolate()->GetHeapStatistics(&heap_statistics);
CHECK_NE(static_cast<int>(heap_statistics.total_heap_size()), 0);
CHECK_NE(static_cast<int>(heap_statistics.used_heap_size()), 0);
env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "g")));
v8::ScriptOrigin script_origin_f = f->GetScriptOrigin();
- CHECK_EQ("test", *v8::String::Utf8Value(script_origin_f.ResourceName()));
+ CHECK_EQ(0, strcmp("test",
+ *v8::String::Utf8Value(script_origin_f.ResourceName())));
CHECK_EQ(1, script_origin_f.ResourceLineOffset()->Int32Value());
CHECK(script_origin_f.ResourceIsSharedCrossOrigin()->Value());
CHECK(script_origin_f.ResourceIsEmbedderDebugScript()->Value());
v8::ScriptOrigin script_origin_g = g->GetScriptOrigin();
- CHECK_EQ("test", *v8::String::Utf8Value(script_origin_g.ResourceName()));
+ CHECK_EQ(0, strcmp("test",
+ *v8::String::Utf8Value(script_origin_g.ResourceName())));
CHECK_EQ(1, script_origin_g.ResourceLineOffset()->Int32Value());
CHECK(script_origin_g.ResourceIsSharedCrossOrigin()->Value());
CHECK(script_origin_g.ResourceIsEmbedderDebugScript()->Value());
v8::Script::Compile(script, &origin)->Run();
v8::Local<v8::Function> f = v8::Local<v8::Function>::Cast(
env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "f")));
- CHECK_EQ("foo.bar.baz", *v8::String::Utf8Value(f->GetInferredName()));
+ CHECK_EQ(0,
+ strcmp("foo.bar.baz", *v8::String::Utf8Value(f->GetInferredName())));
}
v8::Local<v8::Function> g = v8::Local<v8::Function>::Cast(
env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "g")));
CHECK_EQ(false, error->BooleanValue());
- CHECK_EQ("display_a", *v8::String::Utf8Value(a->GetDisplayName()));
- CHECK_EQ("display_b", *v8::String::Utf8Value(b->GetDisplayName()));
+ CHECK_EQ(0, strcmp("display_a", *v8::String::Utf8Value(a->GetDisplayName())));
+ CHECK_EQ(0, strcmp("display_b", *v8::String::Utf8Value(b->GetDisplayName())));
CHECK(c->GetDisplayName()->IsUndefined());
CHECK(d->GetDisplayName()->IsUndefined());
CHECK(e->GetDisplayName()->IsUndefined());
CHECK(f->GetDisplayName()->IsUndefined());
- CHECK_EQ("set_in_runtime", *v8::String::Utf8Value(g->GetDisplayName()));
+ CHECK_EQ(
+ 0, strcmp("set_in_runtime", *v8::String::Utf8Value(g->GetDisplayName())));
}
CHECK(g->GetBoundFunction()->IsFunction());
Local<v8::Function> original_function = Local<v8::Function>::Cast(
g->GetBoundFunction());
- CHECK_EQ(f->GetName(), original_function->GetName());
+ CHECK(f->GetName()->Equals(original_function->GetName()));
CHECK_EQ(f->GetScriptLineNumber(), original_function->GetScriptLineNumber());
CHECK_EQ(f->GetScriptColumnNumber(),
original_function->GetScriptColumnNumber());
v8::V8::SetFatalErrorHandler(StoringErrorCallback);
last_location = last_message = NULL;
isolate->Dispose();
- CHECK_EQ(last_location, NULL);
- CHECK_EQ(last_message, NULL);
+ CHECK(!last_location);
+ CHECK(!last_message);
}
last_location = last_message = NULL;
// Still entered, should fail.
isolate->Dispose();
- CHECK_NE(last_location, NULL);
- CHECK_NE(last_message, NULL);
+ CHECK(last_location);
+ CHECK(last_message);
}
isolate->Dispose();
}
last_location = last_message = NULL;
isolate1->Dispose();
- CHECK_EQ(last_location, NULL);
- CHECK_EQ(last_message, NULL);
+ CHECK(!last_location);
+ CHECK(!last_message);
isolate2->Dispose();
- CHECK_EQ(last_location, NULL);
- CHECK_EQ(last_message, NULL);
+ CHECK(!last_location);
+ CHECK(!last_message);
// Check that default isolate still runs.
{
v8::Handle<v8::Value> object =
v8::Local<v8::Object>::New(isolate, *object_);
CHECK(handle->IsObject());
- CHECK_EQ(Handle<Object>::Cast(handle), object);
+ CHECK(Handle<Object>::Cast(handle)->Equals(object));
++counter_;
}
context->Global()->Set(v8_str("o"), tmpl->NewInstance());
v8::Handle<v8::Array> result = v8::Handle<v8::Array>::Cast(CompileRun(
"var result = []; for (var k in o) result.push(k); result"));
- CHECK_EQ(1, result->Length());
- CHECK_EQ(v8_str("universalAnswer"), result->Get(0));
+ CHECK_EQ(1u, result->Length());
+ CHECK(v8_str("universalAnswer")->Equals(result->Get(0)));
}
context->Global()->Set(v8_str("obj"), obj);
obj->ForceSet(v8_str("1"), v8_str("DONT_CHANGE"), v8::ReadOnly);
obj->Set(v8_str("1"), v8_str("foobar"));
- CHECK_EQ(v8_str("DONT_CHANGE"), obj->Get(v8_str("1")));
+ CHECK(v8_str("DONT_CHANGE")->Equals(obj->Get(v8_str("1"))));
obj->ForceSet(v8_num(2), v8_str("DONT_CHANGE"), v8::ReadOnly);
obj->Set(v8_num(2), v8_str("foobar"));
- CHECK_EQ(v8_str("DONT_CHANGE"), obj->Get(v8_num(2)));
+ CHECK(v8_str("DONT_CHANGE")->Equals(obj->Get(v8_num(2))));
// Test non-smi case.
obj->ForceSet(v8_str("2000000000"), v8_str("DONT_CHANGE"), v8::ReadOnly);
obj->Set(v8_str("2000000000"), v8_str("foobar"));
- CHECK_EQ(v8_str("DONT_CHANGE"), obj->Get(v8_str("2000000000")));
+ CHECK(v8_str("DONT_CHANGE")->Equals(obj->Get(v8_str("2000000000"))));
}
g_passed_to_three = NULL;
env->GetIsolate()->EnqueueMicrotask(MicrotaskThree);
CompileRun("1+1;");
- CHECK_EQ(NULL, g_passed_to_three);
+ CHECK(!g_passed_to_three);
CHECK_EQ(2, CompileRun("ext1Calls")->Int32Value());
CHECK_EQ(2, CompileRun("ext2Calls")->Int32Value());
isolate->Enter();
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
for (uint32_t slot = 0; slot < v8::Isolate::GetNumberOfDataSlots(); ++slot) {
- CHECK_EQ(NULL, isolate->GetData(slot));
- CHECK_EQ(NULL, i_isolate->GetData(slot));
+ CHECK(!isolate->GetData(slot));
+ CHECK(!i_isolate->GetData(slot));
}
for (uint32_t slot = 0; slot < v8::Isolate::GetNumberOfDataSlots(); ++slot) {
void* data = reinterpret_cast<void*>(0xacce55ed + slot);
static void InstanceCheckedGetter(
Local<String> name,
const v8::PropertyCallbackInfo<v8::Value>& info) {
- CHECK_EQ(name, v8_str("foo"));
+ CHECK(name->Equals(v8_str("foo")));
instance_checked_getter_count++;
info.GetReturnValue().Set(v8_num(11));
}
static void InstanceCheckedSetter(Local<String> name,
Local<Value> value,
const v8::PropertyCallbackInfo<void>& info) {
- CHECK_EQ(name, v8_str("foo"));
- CHECK_EQ(value, v8_num(23));
+ CHECK(name->Equals(v8_str("foo")));
+ CHECK(value->Equals(v8_num(23)));
instance_checked_setter_count++;
}
static Local<Value> function_new_expected_env;
static void FunctionNewCallback(const v8::FunctionCallbackInfo<Value>& info) {
- CHECK_EQ(function_new_expected_env, info.Data());
+ CHECK(function_new_expected_env->Equals(info.Data()));
info.GetReturnValue().Set(17);
}
Local<Function> func = Function::New(isolate, FunctionNewCallback, data);
env->Global()->Set(v8_str("func"), func);
Local<Value> result = CompileRun("func();");
- CHECK_EQ(v8::Integer::New(isolate, 17), result);
+ CHECK(v8::Integer::New(isolate, 17)->Equals(result));
// Verify function not cached
int serial_number =
i::Smi::cast(v8::Utils::OpenHandle(*func)
function_new_expected_env = data2;
Local<Function> func2 = Function::New(isolate, FunctionNewCallback, data2);
CHECK(!func2->IsNull());
- CHECK_NE(func, func2);
+ CHECK(!func->Equals(func2));
env->Global()->Set(v8_str("func2"), func2);
Local<Value> result2 = CompileRun("func2();");
- CHECK_EQ(v8::Integer::New(isolate, 17), result2);
+ CHECK(v8::Integer::New(isolate, 17)->Equals(result2));
}
for (int i = 0; i < runs; i++) {
Local<String> expected;
if (i != 0) {
- CHECK_EQ(v8_str("escape value"), values[i]);
+ CHECK(v8_str("escape value")->Equals(values[i]));
} else {
CHECK(values[i].IsEmpty());
}
CHECK(data == info.Data());
CHECK(receiver == info.This());
if (info.Length() == 1) {
- CHECK_EQ(v8_num(1), info[0]);
+ CHECK(v8_num(1)->Equals(info[0]));
}
CHECK(holder == info.Holder());
count++;
"V8.Test", 0, 10000, v8::internal::HistogramTimer::MILLISECOND, 50,
reinterpret_cast<v8::internal::Isolate*>(isolate));
histogramTimer.Start();
- CHECK_EQ("V8.Test", last_event_message);
+ CHECK_EQ(0, strcmp("V8.Test", last_event_message));
CHECK_EQ(0, last_event_status);
histogramTimer.Stop();
- CHECK_EQ("V8.Test", last_event_message);
+ CHECK_EQ(0, strcmp("V8.Test", last_event_message));
CHECK_EQ(1, last_event_status);
}
CHECK_EQ(0, global->Get(v8_str("x1"))->Int32Value());
isolate->RunMicrotasks();
CHECK(!global->Get(v8_str("x1"))->IsNumber());
- CHECK_EQ(p, global->Get(v8_str("x1")));
+ CHECK(p->Equals(global->Get(v8_str("x1"))));
// Then
CompileRun("x1 = x2 = 0;");
CHECK(!script_name.IsEmpty());
CHECK(script_name->IsString());
String::Utf8Value utf8_name(script_name);
- CHECK_EQ(url, *utf8_name);
+ CHECK_EQ(0, strcmp(url, *utf8_name));
int line_number = script->GetUnboundScript()->GetLineNumber(0);
CHECK_EQ(13, line_number);
}
const char* expected_source_mapping_url) {
if (expected_source_url != NULL) {
v8::String::Utf8Value url(script->GetUnboundScript()->GetSourceURL());
- CHECK_EQ(expected_source_url, *url);
+ CHECK_EQ(0, strcmp(expected_source_url, *url));
} else {
CHECK(script->GetUnboundScript()->GetSourceURL()->IsUndefined());
}
if (expected_source_mapping_url != NULL) {
v8::String::Utf8Value url(
script->GetUnboundScript()->GetSourceMappingURL());
- CHECK_EQ(expected_source_mapping_url, *url);
+ CHECK_EQ(0, strcmp(expected_source_mapping_url, *url));
} else {
CHECK(script->GetUnboundScript()->GetSourceMappingURL()->IsUndefined());
}
Local<Value> desc = x->GetOwnPropertyDescriptor(v8_str("no_prop"));
CHECK(desc->IsUndefined());
desc = x->GetOwnPropertyDescriptor(v8_str("p0"));
- CHECK_EQ(v8_num(12), Local<Object>::Cast(desc)->Get(v8_str("value")));
+ CHECK(v8_num(12)->Equals(Local<Object>::Cast(desc)->Get(v8_str("value"))));
desc = x->GetOwnPropertyDescriptor(v8_str("p1"));
Local<Function> set =
Local<Function>::Cast(Local<Object>::Cast(desc)->Get(v8_str("set")));
Local<Function> get =
Local<Function>::Cast(Local<Object>::Cast(desc)->Get(v8_str("get")));
- CHECK_EQ(v8_num(13), get->Call(x, 0, NULL));
+ CHECK(v8_num(13)->Equals(get->Call(x, 0, NULL)));
Handle<Value> args[] = { v8_num(14) };
set->Call(x, 1, args);
- CHECK_EQ(v8_num(14), get->Call(x, 0, NULL));
+ CHECK(v8_num(14)->Equals(get->Call(x, 0, NULL)));
}
Object* dummy = CALL_GENERATED_CODE(f, &i, 0, 0, 0, 0);
USE(dummy);
- CHECK_EQ(0xabcd0001, i.a);
+ CHECK_EQ(static_cast<int32_t>(0xabcd0001), i.a);
CHECK_EQ(static_cast<int32_t>(0xabcd0000) >> 1, i.b);
CHECK_EQ(0x00000000, i.c);
- CHECK_EQ(0xffffffff, i.d);
+ CHECK_EQ(static_cast<int32_t>(0xffffffff), i.d);
}
CHECK_EQ(14.7610017472335499, t.i);
CHECK_EQ(16.0, t.j);
CHECK_EQ(73.8818412254460241, t.k);
- CHECK_EQ(372106121, t.low);
- CHECK_EQ(1079146608, t.high);
+ CHECK_EQ(372106121u, t.low);
+ CHECK_EQ(1079146608u, t.high);
}
}
t.dstA7 = 0;
Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0);
USE(dummy);
- CHECK_EQ(0x01020304, t.dst0);
- CHECK_EQ(0x11121314, t.dst1);
- CHECK_EQ(0x21222324, t.dst2);
- CHECK_EQ(0x31323334, t.dst3);
- CHECK_EQ(0x41424344, t.dst4);
- CHECK_EQ(0x51525354, t.dst5);
- CHECK_EQ(0x61626364, t.dst6);
- CHECK_EQ(0x71727374, t.dst7);
- CHECK_EQ(0x00430044, t.dstA0);
- CHECK_EQ(0x00410042, t.dstA1);
- CHECK_EQ(0x00830084, t.dstA2);
- CHECK_EQ(0x00810082, t.dstA3);
- CHECK_EQ(0x00430044, t.dstA4);
- CHECK_EQ(0x00410042, t.dstA5);
- CHECK_EQ(0x00830084, t.dstA6);
- CHECK_EQ(0x00810082, t.dstA7);
+ CHECK_EQ(0x01020304u, t.dst0);
+ CHECK_EQ(0x11121314u, t.dst1);
+ CHECK_EQ(0x21222324u, t.dst2);
+ CHECK_EQ(0x31323334u, t.dst3);
+ CHECK_EQ(0x41424344u, t.dst4);
+ CHECK_EQ(0x51525354u, t.dst5);
+ CHECK_EQ(0x61626364u, t.dst6);
+ CHECK_EQ(0x71727374u, t.dst7);
+ CHECK_EQ(0x00430044u, t.dstA0);
+ CHECK_EQ(0x00410042u, t.dstA1);
+ CHECK_EQ(0x00830084u, t.dstA2);
+ CHECK_EQ(0x00810082u, t.dstA3);
+ CHECK_EQ(0x00430044u, t.dstA4);
+ CHECK_EQ(0x00410042u, t.dstA5);
+ CHECK_EQ(0x00830084u, t.dstA6);
+ CHECK_EQ(0x00810082u, t.dstA7);
}
}
t.dst4 = 0;
Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0);
USE(dummy);
- CHECK_EQ(0x12130304, t.dst0);
- CHECK_EQ(0x01021213, t.dst1);
- CHECK_EQ(0x00010003, t.dst2);
- CHECK_EQ(0x00000003, t.dst3);
- CHECK_EQ(0x11121313, t.dst4);
+ CHECK_EQ(0x12130304u, t.dst0);
+ CHECK_EQ(0x01021213u, t.dst1);
+ CHECK_EQ(0x00010003u, t.dst2);
+ CHECK_EQ(0x00000003u, t.dst3);
+ CHECK_EQ(0x11121313u, t.dst4);
}
#endif
F3 f = FUNCTION_CAST<F3>(code->entry());
Object* dummy;
- TEST_UDIV(0, 0, 0);
- TEST_UDIV(0, 1024, 0);
- TEST_UDIV(5, 10, 2);
- TEST_UDIV(3, 10, 3);
+ TEST_UDIV(0u, 0, 0);
+ TEST_UDIV(0u, 1024, 0);
+ TEST_UDIV(5u, 10, 2);
+ TEST_UDIV(3u, 10, 3);
USE(dummy);
}
}
__ Add(x0, x0, 0);
__ Sub(x1, x1, 0);
__ Sub(x2, x2, xzr);
- CHECK_EQ(0, __ SizeOfCodeGeneratedSince(&blob1));
+ CHECK_EQ(0u, __ SizeOfCodeGeneratedSince(&blob1));
Label blob2;
__ Bind(&blob2);
__ Add(w3, w3, 0);
- CHECK_NE(0, __ SizeOfCodeGeneratedSince(&blob2));
+ CHECK_NE(0u, __ SizeOfCodeGeneratedSince(&blob2));
Label blob3;
__ Bind(&blob3);
__ Sub(w3, w3, wzr);
- CHECK_NE(0, __ SizeOfCodeGeneratedSince(&blob3));
+ CHECK_NE(0u, __ SizeOfCodeGeneratedSince(&blob3));
END();
__ DropBySMI(xzr, 8);
__ ClaimBySMI(xzr, 0);
__ DropBySMI(xzr, 0);
- CHECK_EQ(0, __ SizeOfCodeGeneratedSince(&start));
+ CHECK_EQ(0u, __ SizeOfCodeGeneratedSince(&start));
END();
#ifdef __GNUC__
-#define ELEMENT_COUNT 4
+#define ELEMENT_COUNT 4u
void DoSSE2(const v8::FunctionCallbackInfo<v8::Value>& args) {
Isolate* isolate = reinterpret_cast<Isolate*>(CcTest::isolate());
__ pop(ecx);
// Store input vector on the stack.
- for (int i = 0; i < ELEMENT_COUNT; ++i) {
+ for (unsigned i = 0; i < ELEMENT_COUNT; ++i) {
__ push(Immediate(vec->Get(i)->Int32Value()));
}
int32_t vec[ELEMENT_COUNT] = { -1, 1, 1, 1 };
v8::Local<v8::Array> v8_vec = v8::Array::New(isolate, ELEMENT_COUNT);
- for (int i = 0; i < ELEMENT_COUNT; i++) {
+ for (unsigned i = 0; i < ELEMENT_COUNT; i++) {
v8_vec->Set(i, v8_num(vec[i]));
}
uint64_t value1 = V8_2PART_UINT64_C(0x12345678, 87654321);
CHECK_EQ(0x12345678, f(uint64_to_double(value1)));
uint64_t value2 = V8_2PART_UINT64_C(0x87654321, 12345678);
- CHECK_EQ(0x87654321, f(uint64_to_double(value2)));
+ CHECK_EQ(static_cast<int>(0x87654321), f(uint64_to_double(value2)));
}
typedef int (*F0)();
typedef int (*F1)(int64_t x);
typedef int (*F2)(int64_t x, int64_t y);
-typedef int (*F3)(double x);
-typedef int64_t (*F4)(int64_t* x, int64_t* y);
-typedef int64_t (*F5)(int64_t x);
+typedef unsigned (*F3)(double x);
+typedef uint64_t (*F4)(uint64_t* x, uint64_t* y);
+typedef uint64_t (*F5)(uint64_t x);
#ifdef _WIN64
static const Register arg1 = rcx;
CodeDesc desc;
assm.GetCode(&desc);
// Call the function from C++.
- int64_t left = V8_2PART_UINT64_C(0x10000000, 20000000);
- int64_t right = V8_2PART_UINT64_C(0x30000000, 40000000);
- int64_t result = FUNCTION_CAST<F4>(buffer)(&left, &right);
+ uint64_t left = V8_2PART_UINT64_C(0x10000000, 20000000);
+ uint64_t right = V8_2PART_UINT64_C(0x30000000, 40000000);
+ uint64_t result = FUNCTION_CAST<F4>(buffer)(&left, &right);
CHECK_EQ(V8_2PART_UINT64_C(0x00000000, 40000000), left);
CHECK_EQ(V8_2PART_UINT64_C(0x00000000, 20000000), right);
USE(result);
CodeDesc desc;
assm.GetCode(&desc);
// Call the function from C++.
- int64_t left = V8_2PART_UINT64_C(0x10000000, 20000000);
- int64_t right = V8_2PART_UINT64_C(0x30000000, 40000000);
- int64_t result = FUNCTION_CAST<F4>(buffer)(&left, &right);
+ uint64_t left = V8_2PART_UINT64_C(0x10000000, 20000000);
+ uint64_t right = V8_2PART_UINT64_C(0x30000000, 40000000);
+ uint64_t result = FUNCTION_CAST<F4>(buffer)(&left, &right);
CHECK_EQ(V8_2PART_UINT64_C(0x10000000, 60000000), left);
USE(result);
}
CodeDesc desc;
assm.GetCode(&desc);
// Call the function from C++.
- int64_t src = V8_2PART_UINT64_C(0x10000000, C0000000);
- int64_t result = FUNCTION_CAST<F5>(buffer)(src);
+ uint64_t src = V8_2PART_UINT64_C(0x10000000, C0000000);
+ uint64_t result = FUNCTION_CAST<F5>(buffer)(src);
CHECK_EQ(V8_2PART_UINT64_C(0x00000000, 80000001), result);
}
CodeDesc desc;
assm.GetCode(&desc);
// Call the function from C++.
- int64_t left = V8_2PART_UINT64_C(0x10000000, 20000000);
- int64_t right = V8_2PART_UINT64_C(0x30000000, 40000000);
- int64_t result = FUNCTION_CAST<F4>(buffer)(&left, &right);
+ uint64_t left = V8_2PART_UINT64_C(0x10000000, 20000000);
+ uint64_t right = V8_2PART_UINT64_C(0x30000000, 40000000);
+ uint64_t result = FUNCTION_CAST<F4>(buffer)(&left, &right);
CHECK_EQ(V8_2PART_UINT64_C(0x10000000, e0000000), left);
USE(result);
}
CodeDesc desc;
assm.GetCode(&desc);
// Call the function from C++.
- int64_t left = V8_2PART_UINT64_C(0x10000000, 20000000);
- int64_t right = V8_2PART_UINT64_C(0x30000000, 00000000);
- int64_t result = FUNCTION_CAST<F4>(buffer)(&left, &right);
- CHECK_EQ(static_cast<int64_t>(1), result);
+ uint64_t left = V8_2PART_UINT64_C(0x10000000, 20000000);
+ uint64_t right = V8_2PART_UINT64_C(0x30000000, 00000000);
+ uint64_t result = FUNCTION_CAST<F4>(buffer)(&left, &right);
+ CHECK_EQ(1u, result);
}
CodeDesc desc;
assm.GetCode(&desc);
// Call the function from C++.
- int64_t left = V8_2PART_UINT64_C(0x10000000, 20000000);
- int64_t right = V8_2PART_UINT64_C(0x30000000, 60000000);
- int64_t result = FUNCTION_CAST<F4>(buffer)(&left, &right);
+ uint64_t left = V8_2PART_UINT64_C(0x10000000, 20000000);
+ uint64_t right = V8_2PART_UINT64_C(0x30000000, 60000000);
+ uint64_t result = FUNCTION_CAST<F4>(buffer)(&left, &right);
CHECK_EQ(V8_2PART_UINT64_C(0x10000000, 40000000), left);
USE(result);
}
#ifdef __GNUC__
-#define ELEMENT_COUNT 4
+#define ELEMENT_COUNT 4u
void DoSSE2(const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::HandleScope scope(CcTest::isolate());
__ popq(rcx);
// Store input vector on the stack.
- for (int i = 0; i < ELEMENT_COUNT; i++) {
+ for (unsigned i = 0; i < ELEMENT_COUNT; i++) {
__ movl(rax, Immediate(vec->Get(i)->Int32Value()));
__ shlq(rax, Immediate(0x20));
__ orq(rax, Immediate(vec->Get(++i)->Int32Value()));
int32_t vec[ELEMENT_COUNT] = { -1, 1, 1, 1 };
v8::Local<v8::Array> v8_vec = v8::Array::New(isolate, ELEMENT_COUNT);
- for (int i = 0; i < ELEMENT_COUNT; i++) {
+ for (unsigned i = 0; i < ELEMENT_COUNT; i++) {
v8_vec->Set(i, v8_num(vec[i]));
}
F3 f = FUNCTION_CAST<F3>(code->entry());
uint64_t value1 = V8_2PART_UINT64_C(0x12345678, 87654321);
- CHECK_EQ(0x12345678, f(uint64_to_double(value1)));
+ CHECK_EQ(0x12345678u, f(uint64_to_double(value1)));
uint64_t value2 = V8_2PART_UINT64_C(0x87654321, 12345678);
- CHECK_EQ(0x87654321, f(uint64_to_double(value2)));
+ CHECK_EQ(0x87654321u, f(uint64_to_double(value2)));
}
int point;
BignumDtoa(1.0, BIGNUM_DTOA_SHORTEST, 0, buffer, &length, &point);
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(1, point);
BignumDtoa(1.0, BIGNUM_DTOA_FIXED, 3, buffer, &length, &point);
CHECK_GE(3, length - point);
TrimRepresentation(buffer);
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(1, point);
BignumDtoa(1.0, BIGNUM_DTOA_PRECISION, 3, buffer, &length, &point);
CHECK_GE(3, length);
TrimRepresentation(buffer);
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(1, point);
BignumDtoa(1.5, BIGNUM_DTOA_SHORTEST, 0, buffer, &length, &point);
- CHECK_EQ("15", buffer.start());
+ CHECK_EQ(0, strcmp("15", buffer.start()));
CHECK_EQ(1, point);
BignumDtoa(1.5, BIGNUM_DTOA_FIXED, 10, buffer, &length, &point);
CHECK_GE(10, length - point);
TrimRepresentation(buffer);
- CHECK_EQ("15", buffer.start());
+ CHECK_EQ(0, strcmp("15", buffer.start()));
CHECK_EQ(1, point);
BignumDtoa(1.5, BIGNUM_DTOA_PRECISION, 10, buffer, &length, &point);
CHECK_GE(10, length);
TrimRepresentation(buffer);
- CHECK_EQ("15", buffer.start());
+ CHECK_EQ(0, strcmp("15", buffer.start()));
CHECK_EQ(1, point);
double min_double = 5e-324;
BignumDtoa(min_double, BIGNUM_DTOA_SHORTEST, 0, buffer, &length, &point);
- CHECK_EQ("5", buffer.start());
+ CHECK_EQ(0, strcmp("5", buffer.start()));
CHECK_EQ(-323, point);
BignumDtoa(min_double, BIGNUM_DTOA_FIXED, 5, buffer, &length, &point);
CHECK_GE(5, length - point);
TrimRepresentation(buffer);
- CHECK_EQ("", buffer.start());
+ CHECK_EQ(0, strcmp("", buffer.start()));
BignumDtoa(min_double, BIGNUM_DTOA_PRECISION, 5, buffer, &length, &point);
CHECK_GE(5, length);
TrimRepresentation(buffer);
- CHECK_EQ("49407", buffer.start());
+ CHECK_EQ(0, strcmp("49407", buffer.start()));
CHECK_EQ(-323, point);
double max_double = 1.7976931348623157e308;
BignumDtoa(max_double, BIGNUM_DTOA_SHORTEST, 0, buffer, &length, &point);
- CHECK_EQ("17976931348623157", buffer.start());
+ CHECK_EQ(0, strcmp("17976931348623157", buffer.start()));
CHECK_EQ(309, point);
BignumDtoa(max_double, BIGNUM_DTOA_PRECISION, 7, buffer, &length, &point);
CHECK_GE(7, length);
TrimRepresentation(buffer);
- CHECK_EQ("1797693", buffer.start());
+ CHECK_EQ(0, strcmp("1797693", buffer.start()));
CHECK_EQ(309, point);
BignumDtoa(4294967272.0, BIGNUM_DTOA_SHORTEST, 0, buffer, &length, &point);
- CHECK_EQ("4294967272", buffer.start());
+ CHECK_EQ(0, strcmp("4294967272", buffer.start()));
CHECK_EQ(10, point);
BignumDtoa(4294967272.0, BIGNUM_DTOA_FIXED, 5, buffer, &length, &point);
- CHECK_EQ("429496727200000", buffer.start());
+ CHECK_EQ(0, strcmp("429496727200000", buffer.start()));
CHECK_EQ(10, point);
BignumDtoa(4294967272.0, BIGNUM_DTOA_PRECISION, 14, buffer, &length, &point);
CHECK_GE(14, length);
TrimRepresentation(buffer);
- CHECK_EQ("4294967272", buffer.start());
+ CHECK_EQ(0, strcmp("4294967272", buffer.start()));
CHECK_EQ(10, point);
BignumDtoa(4.1855804968213567e298, BIGNUM_DTOA_SHORTEST, 0,
buffer, &length, &point);
- CHECK_EQ("4185580496821357", buffer.start());
+ CHECK_EQ(0, strcmp("4185580496821357", buffer.start()));
CHECK_EQ(299, point);
BignumDtoa(4.1855804968213567e298, BIGNUM_DTOA_PRECISION, 20,
buffer, &length, &point);
CHECK_GE(20, length);
TrimRepresentation(buffer);
- CHECK_EQ("41855804968213567225", buffer.start());
+ CHECK_EQ(0, strcmp("41855804968213567225", buffer.start()));
CHECK_EQ(299, point);
BignumDtoa(5.5626846462680035e-309, BIGNUM_DTOA_SHORTEST, 0,
buffer, &length, &point);
- CHECK_EQ("5562684646268003", buffer.start());
+ CHECK_EQ(0, strcmp("5562684646268003", buffer.start()));
CHECK_EQ(-308, point);
BignumDtoa(5.5626846462680035e-309, BIGNUM_DTOA_PRECISION, 1,
buffer, &length, &point);
CHECK_GE(1, length);
TrimRepresentation(buffer);
- CHECK_EQ("6", buffer.start());
+ CHECK_EQ(0, strcmp("6", buffer.start()));
CHECK_EQ(-308, point);
BignumDtoa(2147483648.0, BIGNUM_DTOA_SHORTEST, 0,
buffer, &length, &point);
- CHECK_EQ("2147483648", buffer.start());
+ CHECK_EQ(0, strcmp("2147483648", buffer.start()));
CHECK_EQ(10, point);
buffer, &length, &point);
CHECK_GE(2, length - point);
TrimRepresentation(buffer);
- CHECK_EQ("2147483648", buffer.start());
+ CHECK_EQ(0, strcmp("2147483648", buffer.start()));
CHECK_EQ(10, point);
BignumDtoa(2147483648.0, BIGNUM_DTOA_PRECISION, 5,
buffer, &length, &point);
CHECK_GE(5, length);
TrimRepresentation(buffer);
- CHECK_EQ("21475", buffer.start());
+ CHECK_EQ(0, strcmp("21475", buffer.start()));
CHECK_EQ(10, point);
BignumDtoa(3.5844466002796428e+298, BIGNUM_DTOA_SHORTEST, 0,
buffer, &length, &point);
- CHECK_EQ("35844466002796428", buffer.start());
+ CHECK_EQ(0, strcmp("35844466002796428", buffer.start()));
CHECK_EQ(299, point);
BignumDtoa(3.5844466002796428e+298, BIGNUM_DTOA_PRECISION, 10,
buffer, &length, &point);
CHECK_GE(10, length);
TrimRepresentation(buffer);
- CHECK_EQ("35844466", buffer.start());
+ CHECK_EQ(0, strcmp("35844466", buffer.start()));
CHECK_EQ(299, point);
uint64_t smallest_normal64 = V8_2PART_UINT64_C(0x00100000, 00000000);
double v = Double(smallest_normal64).value();
BignumDtoa(v, BIGNUM_DTOA_SHORTEST, 0, buffer, &length, &point);
- CHECK_EQ("22250738585072014", buffer.start());
+ CHECK_EQ(0, strcmp("22250738585072014", buffer.start()));
CHECK_EQ(-307, point);
BignumDtoa(v, BIGNUM_DTOA_PRECISION, 20, buffer, &length, &point);
CHECK_GE(20, length);
TrimRepresentation(buffer);
- CHECK_EQ("22250738585072013831", buffer.start());
+ CHECK_EQ(0, strcmp("22250738585072013831", buffer.start()));
CHECK_EQ(-307, point);
uint64_t largest_denormal64 = V8_2PART_UINT64_C(0x000FFFFF, FFFFFFFF);
v = Double(largest_denormal64).value();
BignumDtoa(v, BIGNUM_DTOA_SHORTEST, 0, buffer, &length, &point);
- CHECK_EQ("2225073858507201", buffer.start());
+ CHECK_EQ(0, strcmp("2225073858507201", buffer.start()));
CHECK_EQ(-307, point);
BignumDtoa(v, BIGNUM_DTOA_PRECISION, 20, buffer, &length, &point);
CHECK_GE(20, length);
TrimRepresentation(buffer);
- CHECK_EQ("2225073858507200889", buffer.start());
+ CHECK_EQ(0, strcmp("2225073858507200889", buffer.start()));
CHECK_EQ(-307, point);
BignumDtoa(4128420500802942e-24, BIGNUM_DTOA_SHORTEST, 0,
buffer, &length, &point);
- CHECK_EQ("4128420500802942", buffer.start());
+ CHECK_EQ(0, strcmp("4128420500802942", buffer.start()));
CHECK_EQ(-8, point);
v = 3.9292015898194142585311918e-10;
BignumDtoa(v, BIGNUM_DTOA_SHORTEST, 0, buffer, &length, &point);
- CHECK_EQ("39292015898194143", buffer.start());
+ CHECK_EQ(0, strcmp("39292015898194143", buffer.start()));
v = 4194304.0;
BignumDtoa(v, BIGNUM_DTOA_FIXED, 5, buffer, &length, &point);
CHECK_GE(5, length - point);
TrimRepresentation(buffer);
- CHECK_EQ("4194304", buffer.start());
+ CHECK_EQ(0, strcmp("4194304", buffer.start()));
v = 3.3161339052167390562200598e-237;
BignumDtoa(v, BIGNUM_DTOA_PRECISION, 19, buffer, &length, &point);
CHECK_GE(19, length);
TrimRepresentation(buffer);
- CHECK_EQ("3316133905216739056", buffer.start());
+ CHECK_EQ(0, strcmp("3316133905216739056", buffer.start()));
CHECK_EQ(-236, point);
v = 7.9885183916008099497815232e+191;
BignumDtoa(v, BIGNUM_DTOA_PRECISION, 4, buffer, &length, &point);
CHECK_GE(4, length);
TrimRepresentation(buffer);
- CHECK_EQ("7989", buffer.start());
+ CHECK_EQ(0, strcmp("7989", buffer.start()));
CHECK_EQ(192, point);
v = 1.0000000000000012800000000e+17;
BignumDtoa(v, BIGNUM_DTOA_FIXED, 1, buffer, &length, &point);
CHECK_GE(1, length - point);
TrimRepresentation(buffer);
- CHECK_EQ("100000000000000128", buffer.start());
+ CHECK_EQ(0, strcmp("100000000000000128", buffer.start()));
CHECK_EQ(18, point);
}
double v = current_test.v;
BignumDtoa(v, BIGNUM_DTOA_SHORTEST, 0, buffer, &length, &point);
CHECK_EQ(current_test.decimal_point, point);
- CHECK_EQ(current_test.representation, buffer.start());
+ CHECK_EQ(0, strcmp(current_test.representation, buffer.start()));
}
}
CHECK_EQ(current_test.decimal_point, point);
CHECK_GE(number_digits, length - point);
TrimRepresentation(buffer);
- CHECK_EQ(current_test.representation, buffer.start());
+ CHECK_EQ(0, strcmp(current_test.representation, buffer.start()));
}
}
CHECK_EQ(current_test.decimal_point, point);
CHECK_GE(number_digits, length);
TrimRepresentation(buffer);
- CHECK_EQ(current_test.representation, buffer.start());
+ CHECK_EQ(0, strcmp(current_test.representation, buffer.start()));
}
}
Bignum bignum2;
bignum.AssignUInt16(0);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("0", buffer);
+ CHECK_EQ(0, strcmp("0", buffer));
bignum.AssignUInt16(0xA);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("A", buffer);
+ CHECK_EQ(0, strcmp("A", buffer));
bignum.AssignUInt16(0x20);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("20", buffer);
+ CHECK_EQ(0, strcmp("20", buffer));
bignum.AssignUInt64(0);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("0", buffer);
+ CHECK_EQ(0, strcmp("0", buffer));
bignum.AssignUInt64(0xA);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("A", buffer);
+ CHECK_EQ(0, strcmp("A", buffer));
bignum.AssignUInt64(0x20);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("20", buffer);
+ CHECK_EQ(0, strcmp("20", buffer));
bignum.AssignUInt64(0x100);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("100", buffer);
+ CHECK_EQ(0, strcmp("100", buffer));
// The first real test, since this will not fit into one bigit.
bignum.AssignUInt64(0x12345678);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("12345678", buffer);
+ CHECK_EQ(0, strcmp("12345678", buffer));
uint64_t big = V8_2PART_UINT64_C(0xFFFFFFFF, FFFFFFFF);
bignum.AssignUInt64(big);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("FFFFFFFFFFFFFFFF", buffer);
+ CHECK_EQ(0, strcmp("FFFFFFFFFFFFFFFF", buffer));
big = V8_2PART_UINT64_C(0x12345678, 9ABCDEF0);
bignum.AssignUInt64(big);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("123456789ABCDEF0", buffer);
+ CHECK_EQ(0, strcmp("123456789ABCDEF0", buffer));
bignum2.AssignBignum(bignum);
CHECK(bignum2.ToHexString(buffer, kBufferSize));
- CHECK_EQ("123456789ABCDEF0", buffer);
+ CHECK_EQ(0, strcmp("123456789ABCDEF0", buffer));
AssignDecimalString(&bignum, "0");
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("0", buffer);
+ CHECK_EQ(0, strcmp("0", buffer));
AssignDecimalString(&bignum, "1");
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("1", buffer);
+ CHECK_EQ(0, strcmp("1", buffer));
AssignDecimalString(&bignum, "1234567890");
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("499602D2", buffer);
+ CHECK_EQ(0, strcmp("499602D2", buffer));
AssignHexString(&bignum, "0");
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("0", buffer);
+ CHECK_EQ(0, strcmp("0", buffer));
AssignHexString(&bignum, "123456789ABCDEF0");
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("123456789ABCDEF0", buffer);
+ CHECK_EQ(0, strcmp("123456789ABCDEF0", buffer));
}
AssignHexString(&bignum, "0");
bignum.ShiftLeft(100);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("0", buffer);
+ CHECK_EQ(0, strcmp("0", buffer));
AssignHexString(&bignum, "1");
bignum.ShiftLeft(1);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("2", buffer);
+ CHECK_EQ(0, strcmp("2", buffer));
AssignHexString(&bignum, "1");
bignum.ShiftLeft(4);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("10", buffer);
+ CHECK_EQ(0, strcmp("10", buffer));
AssignHexString(&bignum, "1");
bignum.ShiftLeft(32);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("100000000", buffer);
+ CHECK_EQ(0, strcmp("100000000", buffer));
AssignHexString(&bignum, "1");
bignum.ShiftLeft(64);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("10000000000000000", buffer);
+ CHECK_EQ(0, strcmp("10000000000000000", buffer));
AssignHexString(&bignum, "123456789ABCDEF");
bignum.ShiftLeft(64);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("123456789ABCDEF0000000000000000", buffer);
+ CHECK_EQ(0, strcmp("123456789ABCDEF0000000000000000", buffer));
bignum.ShiftLeft(1);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("2468ACF13579BDE0000000000000000", buffer);
+ CHECK_EQ(0, strcmp("2468ACF13579BDE0000000000000000", buffer));
}
AssignHexString(&bignum, "0");
bignum.AddUInt64(0xA);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("A", buffer);
+ CHECK_EQ(0, strcmp("A", buffer));
AssignHexString(&bignum, "1");
bignum.AddUInt64(0xA);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("B", buffer);
+ CHECK_EQ(0, strcmp("B", buffer));
AssignHexString(&bignum, "1");
bignum.AddUInt64(0x100);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("101", buffer);
+ CHECK_EQ(0, strcmp("101", buffer));
AssignHexString(&bignum, "1");
bignum.AddUInt64(0xFFFF);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("10000", buffer);
+ CHECK_EQ(0, strcmp("10000", buffer));
AssignHexString(&bignum, "FFFFFFF");
bignum.AddUInt64(0x1);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("10000000", buffer);
+ CHECK_EQ(0, strcmp("10000000", buffer));
AssignHexString(&bignum, "10000000000000000000000000000000000000000000");
bignum.AddUInt64(0xFFFF);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("1000000000000000000000000000000000000000FFFF", buffer);
+ CHECK_EQ(0, strcmp("1000000000000000000000000000000000000000FFFF", buffer));
AssignHexString(&bignum, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF");
bignum.AddUInt64(0x1);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("100000000000000000000000000000000000000000000", buffer);
+ CHECK_EQ(0, strcmp("100000000000000000000000000000000000000000000", buffer));
bignum.AssignUInt16(0x1);
bignum.ShiftLeft(100);
bignum.AddUInt64(1);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("10000000000000000000000001", buffer);
+ CHECK_EQ(0, strcmp("10000000000000000000000001", buffer));
bignum.AssignUInt16(0x1);
bignum.ShiftLeft(100);
bignum.AddUInt64(0xFFFF);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("1000000000000000000000FFFF", buffer);
+ CHECK_EQ(0, strcmp("1000000000000000000000FFFF", buffer));
AssignHexString(&bignum, "0");
bignum.AddUInt64(V8_2PART_UINT64_C(0xA, 00000000));
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("A00000000", buffer);
+ CHECK_EQ(0, strcmp("A00000000", buffer));
AssignHexString(&bignum, "1");
bignum.AddUInt64(V8_2PART_UINT64_C(0xA, 00000000));
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("A00000001", buffer);
+ CHECK_EQ(0, strcmp("A00000001", buffer));
AssignHexString(&bignum, "1");
bignum.AddUInt64(V8_2PART_UINT64_C(0x100, 00000000));
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("10000000001", buffer);
+ CHECK_EQ(0, strcmp("10000000001", buffer));
AssignHexString(&bignum, "1");
bignum.AddUInt64(V8_2PART_UINT64_C(0xFFFF, 00000000));
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("FFFF00000001", buffer);
+ CHECK_EQ(0, strcmp("FFFF00000001", buffer));
AssignHexString(&bignum, "FFFFFFF");
bignum.AddUInt64(V8_2PART_UINT64_C(0x1, 00000000));
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("10FFFFFFF", buffer);
+ CHECK_EQ(0, strcmp("10FFFFFFF", buffer));
AssignHexString(&bignum, "10000000000000000000000000000000000000000000");
bignum.AddUInt64(V8_2PART_UINT64_C(0xFFFF, 00000000));
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("10000000000000000000000000000000FFFF00000000", buffer);
+ CHECK_EQ(0, strcmp("10000000000000000000000000000000FFFF00000000", buffer));
AssignHexString(&bignum, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF");
bignum.AddUInt64(V8_2PART_UINT64_C(0x1, 00000000));
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("1000000000000000000000000000000000000FFFFFFFF", buffer);
+ CHECK_EQ(0, strcmp("1000000000000000000000000000000000000FFFFFFFF", buffer));
bignum.AssignUInt16(0x1);
bignum.ShiftLeft(100);
bignum.AddUInt64(V8_2PART_UINT64_C(0x1, 00000000));
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("10000000000000000100000000", buffer);
+ CHECK_EQ(0, strcmp("10000000000000000100000000", buffer));
bignum.AssignUInt16(0x1);
bignum.ShiftLeft(100);
bignum.AddUInt64(V8_2PART_UINT64_C(0xFFFF, 00000000));
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("10000000000000FFFF00000000", buffer);
+ CHECK_EQ(0, strcmp("10000000000000FFFF00000000", buffer));
}
AssignHexString(&bignum, "0");
bignum.AddBignum(other);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("1", buffer);
+ CHECK_EQ(0, strcmp("1", buffer));
AssignHexString(&bignum, "1");
bignum.AddBignum(other);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("2", buffer);
+ CHECK_EQ(0, strcmp("2", buffer));
AssignHexString(&bignum, "FFFFFFF");
bignum.AddBignum(other);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("10000000", buffer);
+ CHECK_EQ(0, strcmp("10000000", buffer));
AssignHexString(&bignum, "FFFFFFFFFFFFFF");
bignum.AddBignum(other);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("100000000000000", buffer);
+ CHECK_EQ(0, strcmp("100000000000000", buffer));
AssignHexString(&bignum, "10000000000000000000000000000000000000000000");
bignum.AddBignum(other);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("10000000000000000000000000000000000000000001", buffer);
+ CHECK_EQ(0, strcmp("10000000000000000000000000000000000000000001", buffer));
AssignHexString(&other, "1000000000000");
AssignHexString(&bignum, "1");
bignum.AddBignum(other);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("1000000000001", buffer);
+ CHECK_EQ(0, strcmp("1000000000001", buffer));
AssignHexString(&bignum, "FFFFFFF");
bignum.AddBignum(other);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("100000FFFFFFF", buffer);
+ CHECK_EQ(0, strcmp("100000FFFFFFF", buffer));
AssignHexString(&bignum, "10000000000000000000000000000000000000000000");
bignum.AddBignum(other);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("10000000000000000000000000000001000000000000", buffer);
+ CHECK_EQ(0, strcmp("10000000000000000000000000000001000000000000", buffer));
AssignHexString(&bignum, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF");
bignum.AddBignum(other);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("1000000000000000000000000000000FFFFFFFFFFFF", buffer);
+ CHECK_EQ(0, strcmp("1000000000000000000000000000000FFFFFFFFFFFF", buffer));
bignum.AssignUInt16(0x1);
bignum.ShiftLeft(100);
bignum.AddBignum(other);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("10000000000001000000000000", buffer);
+ CHECK_EQ(0, strcmp("10000000000001000000000000", buffer));
other.ShiftLeft(64);
// other == "10000000000000000000000000000"
bignum.AssignUInt16(0x1);
bignum.AddBignum(other);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("10000000000000000000000000001", buffer);
+ CHECK_EQ(0, strcmp("10000000000000000000000000001", buffer));
AssignHexString(&bignum, "FFFFFFF");
bignum.AddBignum(other);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("1000000000000000000000FFFFFFF", buffer);
+ CHECK_EQ(0, strcmp("1000000000000000000000FFFFFFF", buffer));
AssignHexString(&bignum, "10000000000000000000000000000000000000000000");
bignum.AddBignum(other);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("10000000000000010000000000000000000000000000", buffer);
+ CHECK_EQ(0, strcmp("10000000000000010000000000000000000000000000", buffer));
AssignHexString(&bignum, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF");
bignum.AddBignum(other);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("100000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFF", buffer);
+ CHECK_EQ(0, strcmp("100000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFF", buffer));
bignum.AssignUInt16(0x1);
bignum.ShiftLeft(100);
bignum.AddBignum(other);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("10010000000000000000000000000", buffer);
+ CHECK_EQ(0, strcmp("10010000000000000000000000000", buffer));
}
AssignHexString(&other, "0");
bignum.SubtractBignum(other);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("1", buffer);
+ CHECK_EQ(0, strcmp("1", buffer));
AssignHexString(&bignum, "2");
AssignHexString(&other, "0");
bignum.SubtractBignum(other);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("2", buffer);
+ CHECK_EQ(0, strcmp("2", buffer));
AssignHexString(&bignum, "10000000");
AssignHexString(&other, "1");
bignum.SubtractBignum(other);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("FFFFFFF", buffer);
+ CHECK_EQ(0, strcmp("FFFFFFF", buffer));
AssignHexString(&bignum, "100000000000000");
AssignHexString(&other, "1");
bignum.SubtractBignum(other);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("FFFFFFFFFFFFFF", buffer);
+ CHECK_EQ(0, strcmp("FFFFFFFFFFFFFF", buffer));
AssignHexString(&bignum, "10000000000000000000000000000000000000000001");
AssignHexString(&other, "1");
bignum.SubtractBignum(other);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("10000000000000000000000000000000000000000000", buffer);
+ CHECK_EQ(0, strcmp("10000000000000000000000000000000000000000000", buffer));
AssignHexString(&bignum, "1000000000001");
AssignHexString(&other, "1000000000000");
bignum.SubtractBignum(other);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("1", buffer);
+ CHECK_EQ(0, strcmp("1", buffer));
AssignHexString(&bignum, "100000FFFFFFF");
AssignHexString(&other, "1000000000000");
bignum.SubtractBignum(other);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("FFFFFFF", buffer);
+ CHECK_EQ(0, strcmp("FFFFFFF", buffer));
AssignHexString(&bignum, "10000000000000000000000000000001000000000000");
AssignHexString(&other, "1000000000000");
bignum.SubtractBignum(other);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("10000000000000000000000000000000000000000000", buffer);
+ CHECK_EQ(0, strcmp("10000000000000000000000000000000000000000000", buffer));
AssignHexString(&bignum, "1000000000000000000000000000000FFFFFFFFFFFF");
AssignHexString(&other, "1000000000000");
bignum.SubtractBignum(other);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", buffer);
+ CHECK_EQ(0, strcmp("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", buffer));
bignum.AssignUInt16(0x1);
bignum.ShiftLeft(100);
AssignHexString(&other, "1000000000000");
bignum.SubtractBignum(other);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("FFFFFFFFFFFFF000000000000", buffer);
+ CHECK_EQ(0, strcmp("FFFFFFFFFFFFF000000000000", buffer));
AssignHexString(&other, "1000000000000");
other.ShiftLeft(48);
// bignum == "10000000000000000000000000"
bignum.SubtractBignum(other);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("F000000000000000000000000", buffer);
+ CHECK_EQ(0, strcmp("F000000000000000000000000", buffer));
other.AssignUInt16(0x1);
other.ShiftLeft(35);
// bignum = FFFFFFF000000000000000
bignum.SubtractBignum(other);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("FFFFFFEFFFFFF800000000", buffer);
+ CHECK_EQ(0, strcmp("FFFFFFEFFFFFF800000000", buffer));
AssignHexString(&bignum, "10000000000000000000000000000000000000000000");
bignum.SubtractBignum(other);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000000", buffer);
+ CHECK_EQ(0, strcmp("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000000", buffer));
AssignHexString(&bignum, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF");
bignum.SubtractBignum(other);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFFF", buffer);
+ CHECK_EQ(0, strcmp("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFFF", buffer));
}
AssignHexString(&bignum, "0");
bignum.MultiplyByUInt32(0x25);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("0", buffer);
+ CHECK_EQ(0, strcmp("0", buffer));
AssignHexString(&bignum, "2");
bignum.MultiplyByUInt32(0x5);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("A", buffer);
+ CHECK_EQ(0, strcmp("A", buffer));
AssignHexString(&bignum, "10000000");
bignum.MultiplyByUInt32(0x9);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("90000000", buffer);
+ CHECK_EQ(0, strcmp("90000000", buffer));
AssignHexString(&bignum, "100000000000000");
bignum.MultiplyByUInt32(0xFFFF);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("FFFF00000000000000", buffer);
+ CHECK_EQ(0, strcmp("FFFF00000000000000", buffer));
AssignHexString(&bignum, "100000000000000");
bignum.MultiplyByUInt32(0xFFFFFFFF);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("FFFFFFFF00000000000000", buffer);
+ CHECK_EQ(0, strcmp("FFFFFFFF00000000000000", buffer));
AssignHexString(&bignum, "1234567ABCD");
bignum.MultiplyByUInt32(0xFFF);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("12333335552433", buffer);
+ CHECK_EQ(0, strcmp("12333335552433", buffer));
AssignHexString(&bignum, "1234567ABCD");
bignum.MultiplyByUInt32(0xFFFFFFF);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("12345679998A985433", buffer);
+ CHECK_EQ(0, strcmp("12345679998A985433", buffer));
AssignHexString(&bignum, "FFFFFFFFFFFFFFFF");
bignum.MultiplyByUInt32(0x2);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("1FFFFFFFFFFFFFFFE", buffer);
+ CHECK_EQ(0, strcmp("1FFFFFFFFFFFFFFFE", buffer));
AssignHexString(&bignum, "FFFFFFFFFFFFFFFF");
bignum.MultiplyByUInt32(0x4);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("3FFFFFFFFFFFFFFFC", buffer);
+ CHECK_EQ(0, strcmp("3FFFFFFFFFFFFFFFC", buffer));
AssignHexString(&bignum, "FFFFFFFFFFFFFFFF");
bignum.MultiplyByUInt32(0xF);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("EFFFFFFFFFFFFFFF1", buffer);
+ CHECK_EQ(0, strcmp("EFFFFFFFFFFFFFFF1", buffer));
AssignHexString(&bignum, "FFFFFFFFFFFFFFFF");
bignum.MultiplyByUInt32(0xFFFFFF);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("FFFFFEFFFFFFFFFF000001", buffer);
+ CHECK_EQ(0, strcmp("FFFFFEFFFFFFFFFF000001", buffer));
bignum.AssignUInt16(0x1);
bignum.ShiftLeft(100);
// "10 0000 0000 0000 0000 0000 0000"
bignum.MultiplyByUInt32(2);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("20000000000000000000000000", buffer);
+ CHECK_EQ(0, strcmp("20000000000000000000000000", buffer));
bignum.AssignUInt16(0x1);
bignum.ShiftLeft(100);
// "10 0000 0000 0000 0000 0000 0000"
bignum.MultiplyByUInt32(0xF);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("F0000000000000000000000000", buffer);
+ CHECK_EQ(0, strcmp("F0000000000000000000000000", buffer));
bignum.AssignUInt16(0xFFFF);
bignum.ShiftLeft(100);
// "FFFF0 0000 0000 0000 0000 0000 0000"
bignum.MultiplyByUInt32(0xFFFF);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("FFFE00010000000000000000000000000", buffer);
+ CHECK_EQ(0, strcmp("FFFE00010000000000000000000000000", buffer));
bignum.AssignUInt16(0xFFFF);
bignum.ShiftLeft(100);
// "FFFF0 0000 0000 0000 0000 0000 0000"
bignum.MultiplyByUInt32(0xFFFFFFFF);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("FFFEFFFF00010000000000000000000000000", buffer);
+ CHECK_EQ(0, strcmp("FFFEFFFF00010000000000000000000000000", buffer));
bignum.AssignUInt16(0xFFFF);
bignum.ShiftLeft(100);
// "FFFF0 0000 0000 0000 0000 0000 0000"
bignum.MultiplyByUInt32(0xFFFFFFFF);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("FFFEFFFF00010000000000000000000000000", buffer);
+ CHECK_EQ(0, strcmp("FFFEFFFF00010000000000000000000000000", buffer));
AssignDecimalString(&bignum, "15611230384529777");
bignum.MultiplyByUInt32(10000000);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("210EDD6D4CDD2580EE80", buffer);
+ CHECK_EQ(0, strcmp("210EDD6D4CDD2580EE80", buffer));
}
AssignHexString(&bignum, "0");
bignum.MultiplyByUInt64(0x25);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("0", buffer);
+ CHECK_EQ(0, strcmp("0", buffer));
AssignHexString(&bignum, "2");
bignum.MultiplyByUInt64(0x5);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("A", buffer);
+ CHECK_EQ(0, strcmp("A", buffer));
AssignHexString(&bignum, "10000000");
bignum.MultiplyByUInt64(0x9);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("90000000", buffer);
+ CHECK_EQ(0, strcmp("90000000", buffer));
AssignHexString(&bignum, "100000000000000");
bignum.MultiplyByUInt64(0xFFFF);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("FFFF00000000000000", buffer);
+ CHECK_EQ(0, strcmp("FFFF00000000000000", buffer));
AssignHexString(&bignum, "100000000000000");
bignum.MultiplyByUInt64(V8_2PART_UINT64_C(0xFFFFFFFF, FFFFFFFF));
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("FFFFFFFFFFFFFFFF00000000000000", buffer);
+ CHECK_EQ(0, strcmp("FFFFFFFFFFFFFFFF00000000000000", buffer));
AssignHexString(&bignum, "1234567ABCD");
bignum.MultiplyByUInt64(0xFFF);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("12333335552433", buffer);
+ CHECK_EQ(0, strcmp("12333335552433", buffer));
AssignHexString(&bignum, "1234567ABCD");
bignum.MultiplyByUInt64(V8_2PART_UINT64_C(0xFF, FFFFFFFF));
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("1234567ABCBDCBA985433", buffer);
+ CHECK_EQ(0, strcmp("1234567ABCBDCBA985433", buffer));
AssignHexString(&bignum, "FFFFFFFFFFFFFFFF");
bignum.MultiplyByUInt64(0x2);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("1FFFFFFFFFFFFFFFE", buffer);
+ CHECK_EQ(0, strcmp("1FFFFFFFFFFFFFFFE", buffer));
AssignHexString(&bignum, "FFFFFFFFFFFFFFFF");
bignum.MultiplyByUInt64(0x4);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("3FFFFFFFFFFFFFFFC", buffer);
+ CHECK_EQ(0, strcmp("3FFFFFFFFFFFFFFFC", buffer));
AssignHexString(&bignum, "FFFFFFFFFFFFFFFF");
bignum.MultiplyByUInt64(0xF);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("EFFFFFFFFFFFFFFF1", buffer);
+ CHECK_EQ(0, strcmp("EFFFFFFFFFFFFFFF1", buffer));
AssignHexString(&bignum, "FFFFFFFFFFFFFFFF");
bignum.MultiplyByUInt64(V8_2PART_UINT64_C(0xFFFFFFFF, FFFFFFFF));
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("FFFFFFFFFFFFFFFE0000000000000001", buffer);
+ CHECK_EQ(0, strcmp("FFFFFFFFFFFFFFFE0000000000000001", buffer));
bignum.AssignUInt16(0x1);
bignum.ShiftLeft(100);
// "10 0000 0000 0000 0000 0000 0000"
bignum.MultiplyByUInt64(2);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("20000000000000000000000000", buffer);
+ CHECK_EQ(0, strcmp("20000000000000000000000000", buffer));
bignum.AssignUInt16(0x1);
bignum.ShiftLeft(100);
// "10 0000 0000 0000 0000 0000 0000"
bignum.MultiplyByUInt64(0xF);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("F0000000000000000000000000", buffer);
+ CHECK_EQ(0, strcmp("F0000000000000000000000000", buffer));
bignum.AssignUInt16(0xFFFF);
bignum.ShiftLeft(100);
// "FFFF0 0000 0000 0000 0000 0000 0000"
bignum.MultiplyByUInt64(0xFFFF);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("FFFE00010000000000000000000000000", buffer);
+ CHECK_EQ(0, strcmp("FFFE00010000000000000000000000000", buffer));
bignum.AssignUInt16(0xFFFF);
bignum.ShiftLeft(100);
// "FFFF0 0000 0000 0000 0000 0000 0000"
bignum.MultiplyByUInt64(0xFFFFFFFF);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("FFFEFFFF00010000000000000000000000000", buffer);
+ CHECK_EQ(0, strcmp("FFFEFFFF00010000000000000000000000000", buffer));
bignum.AssignUInt16(0xFFFF);
bignum.ShiftLeft(100);
// "FFFF0 0000 0000 0000 0000 0000 0000"
bignum.MultiplyByUInt64(V8_2PART_UINT64_C(0xFFFFFFFF, FFFFFFFF));
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("FFFEFFFFFFFFFFFF00010000000000000000000000000", buffer);
+ CHECK_EQ(0, strcmp("FFFEFFFFFFFFFFFF00010000000000000000000000000", buffer));
AssignDecimalString(&bignum, "15611230384529777");
bignum.MultiplyByUInt64(V8_2PART_UINT64_C(0x8ac72304, 89e80000));
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("1E10EE4B11D15A7F3DE7F3C7680000", buffer);
+ CHECK_EQ(0, strcmp("1E10EE4B11D15A7F3DE7F3C7680000", buffer));
}
AssignDecimalString(&bignum, "1234");
bignum.MultiplyByPowerOfTen(1);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("3034", buffer);
+ CHECK_EQ(0, strcmp("3034", buffer));
AssignDecimalString(&bignum, "1234");
bignum.MultiplyByPowerOfTen(2);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("1E208", buffer);
+ CHECK_EQ(0, strcmp("1E208", buffer));
AssignDecimalString(&bignum, "1234");
bignum.MultiplyByPowerOfTen(3);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("12D450", buffer);
+ CHECK_EQ(0, strcmp("12D450", buffer));
AssignDecimalString(&bignum, "1234");
bignum.MultiplyByPowerOfTen(4);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("BC4B20", buffer);
+ CHECK_EQ(0, strcmp("BC4B20", buffer));
AssignDecimalString(&bignum, "1234");
bignum.MultiplyByPowerOfTen(5);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("75AEF40", buffer);
+ CHECK_EQ(0, strcmp("75AEF40", buffer));
AssignDecimalString(&bignum, "1234");
bignum.MultiplyByPowerOfTen(6);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("498D5880", buffer);
+ CHECK_EQ(0, strcmp("498D5880", buffer));
AssignDecimalString(&bignum, "1234");
bignum.MultiplyByPowerOfTen(7);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("2DF857500", buffer);
+ CHECK_EQ(0, strcmp("2DF857500", buffer));
AssignDecimalString(&bignum, "1234");
bignum.MultiplyByPowerOfTen(8);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("1CBB369200", buffer);
+ CHECK_EQ(0, strcmp("1CBB369200", buffer));
AssignDecimalString(&bignum, "1234");
bignum.MultiplyByPowerOfTen(9);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("11F5021B400", buffer);
+ CHECK_EQ(0, strcmp("11F5021B400", buffer));
AssignDecimalString(&bignum, "1234");
bignum.MultiplyByPowerOfTen(10);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("B3921510800", buffer);
+ CHECK_EQ(0, strcmp("B3921510800", buffer));
AssignDecimalString(&bignum, "1234");
bignum.MultiplyByPowerOfTen(11);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("703B4D2A5000", buffer);
+ CHECK_EQ(0, strcmp("703B4D2A5000", buffer));
AssignDecimalString(&bignum, "1234");
bignum.MultiplyByPowerOfTen(12);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("4625103A72000", buffer);
+ CHECK_EQ(0, strcmp("4625103A72000", buffer));
AssignDecimalString(&bignum, "1234");
bignum.MultiplyByPowerOfTen(13);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("2BD72A24874000", buffer);
+ CHECK_EQ(0, strcmp("2BD72A24874000", buffer));
AssignDecimalString(&bignum, "1234");
bignum.MultiplyByPowerOfTen(14);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("1B667A56D488000", buffer);
+ CHECK_EQ(0, strcmp("1B667A56D488000", buffer));
AssignDecimalString(&bignum, "1234");
bignum.MultiplyByPowerOfTen(15);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("11200C7644D50000", buffer);
+ CHECK_EQ(0, strcmp("11200C7644D50000", buffer));
AssignDecimalString(&bignum, "1234");
bignum.MultiplyByPowerOfTen(16);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("AB407C9EB0520000", buffer);
+ CHECK_EQ(0, strcmp("AB407C9EB0520000", buffer));
AssignDecimalString(&bignum, "1234");
bignum.MultiplyByPowerOfTen(17);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("6B084DE32E3340000", buffer);
+ CHECK_EQ(0, strcmp("6B084DE32E3340000", buffer));
AssignDecimalString(&bignum, "1234");
bignum.MultiplyByPowerOfTen(18);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("42E530ADFCE0080000", buffer);
+ CHECK_EQ(0, strcmp("42E530ADFCE0080000", buffer));
AssignDecimalString(&bignum, "1234");
bignum.MultiplyByPowerOfTen(19);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("29CF3E6CBE0C0500000", buffer);
+ CHECK_EQ(0, strcmp("29CF3E6CBE0C0500000", buffer));
AssignDecimalString(&bignum, "1234");
bignum.MultiplyByPowerOfTen(20);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("1A218703F6C783200000", buffer);
+ CHECK_EQ(0, strcmp("1A218703F6C783200000", buffer));
AssignDecimalString(&bignum, "1234");
bignum.MultiplyByPowerOfTen(21);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("1054F4627A3CB1F400000", buffer);
+ CHECK_EQ(0, strcmp("1054F4627A3CB1F400000", buffer));
AssignDecimalString(&bignum, "1234");
bignum.MultiplyByPowerOfTen(22);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("A3518BD8C65EF38800000", buffer);
+ CHECK_EQ(0, strcmp("A3518BD8C65EF38800000", buffer));
AssignDecimalString(&bignum, "1234");
bignum.MultiplyByPowerOfTen(23);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("6612F7677BFB5835000000", buffer);
+ CHECK_EQ(0, strcmp("6612F7677BFB5835000000", buffer));
AssignDecimalString(&bignum, "1234");
bignum.MultiplyByPowerOfTen(24);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("3FCBDAA0AD7D17212000000", buffer);
+ CHECK_EQ(0, strcmp("3FCBDAA0AD7D17212000000", buffer));
AssignDecimalString(&bignum, "1234");
bignum.MultiplyByPowerOfTen(25);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("27DF68A46C6E2E74B4000000", buffer);
+ CHECK_EQ(0, strcmp("27DF68A46C6E2E74B4000000", buffer));
AssignDecimalString(&bignum, "1234");
bignum.MultiplyByPowerOfTen(26);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("18EBA166C3C4DD08F08000000", buffer);
+ CHECK_EQ(0, strcmp("18EBA166C3C4DD08F08000000", buffer));
AssignDecimalString(&bignum, "1234");
bignum.MultiplyByPowerOfTen(27);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("F9344E03A5B0A259650000000", buffer);
+ CHECK_EQ(0, strcmp("F9344E03A5B0A259650000000", buffer));
AssignDecimalString(&bignum, "1234");
bignum.MultiplyByPowerOfTen(28);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("9BC0B0C2478E6577DF20000000", buffer);
+ CHECK_EQ(0, strcmp("9BC0B0C2478E6577DF20000000", buffer));
AssignDecimalString(&bignum, "1234");
bignum.MultiplyByPowerOfTen(29);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("61586E796CB8FF6AEB740000000", buffer);
+ CHECK_EQ(0, strcmp("61586E796CB8FF6AEB740000000", buffer));
AssignDecimalString(&bignum, "1234");
bignum.MultiplyByPowerOfTen(30);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("3CD7450BE3F39FA2D32880000000", buffer);
+ CHECK_EQ(0, strcmp("3CD7450BE3F39FA2D32880000000", buffer));
AssignDecimalString(&bignum, "1234");
bignum.MultiplyByPowerOfTen(31);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("26068B276E7843C5C3F9500000000", buffer);
+ CHECK_EQ(0, strcmp("26068B276E7843C5C3F9500000000", buffer));
AssignDecimalString(&bignum, "1234");
bignum.MultiplyByPowerOfTen(50);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("149D1B4CFED03B23AB5F4E1196EF45C08000000000000", buffer);
+ CHECK_EQ(0, strcmp("149D1B4CFED03B23AB5F4E1196EF45C08000000000000", buffer));
AssignDecimalString(&bignum, "1234");
bignum.MultiplyByPowerOfTen(100);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("5827249F27165024FBC47DFCA9359BF316332D1B91ACEECF471FBAB06D9B2"
- "0000000000000000000000000", buffer);
+ CHECK_EQ(0,
+ strcmp(
+ "5827249F27165024FBC47DFCA9359BF316332D1B91ACEECF471FBAB06D9B2"
+ "0000000000000000000000000",
+ buffer));
AssignDecimalString(&bignum, "1234");
bignum.MultiplyByPowerOfTen(200);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("64C1F5C06C3816AFBF8DAFD5A3D756365BB0FD020E6F084E759C1F7C99E4F"
- "55B9ACC667CEC477EB958C2AEEB3C6C19BA35A1AD30B35C51EB72040920000"
- "0000000000000000000000000000000000000000000000", buffer);
+ CHECK_EQ(0,
+ strcmp(
+ "64C1F5C06C3816AFBF8DAFD5A3D756365BB0FD020E6F084E759C1F7C99E4F"
+ "55B9ACC667CEC477EB958C2AEEB3C6C19BA35A1AD30B35C51EB72040920000"
+ "0000000000000000000000000000000000000000000000",
+ buffer));
AssignDecimalString(&bignum, "1234");
bignum.MultiplyByPowerOfTen(500);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("96741A625EB5D7C91039FEB5C5ACD6D9831EDA5B083D800E6019442C8C8223"
- "3EAFB3501FE2058062221E15121334928880827DEE1EC337A8B26489F3A40A"
- "CB440A2423734472D10BFCE886F41B3AF9F9503013D86D088929CA86EEB4D8"
- "B9C831D0BD53327B994A0326227CFD0ECBF2EB48B02387AAE2D4CCCDF1F1A1"
- "B8CC4F1FA2C56AD40D0E4DAA9C28CDBF0A549098EA13200000000000000000"
- "00000000000000000000000000000000000000000000000000000000000000"
- "0000000000000000000000000000000000000000000000", buffer);
+ CHECK_EQ(0,
+ strcmp(
+ "96741A625EB5D7C91039FEB5C5ACD6D9831EDA5B083D800E6019442C8C8223"
+ "3EAFB3501FE2058062221E15121334928880827DEE1EC337A8B26489F3A40A"
+ "CB440A2423734472D10BFCE886F41B3AF9F9503013D86D088929CA86EEB4D8"
+ "B9C831D0BD53327B994A0326227CFD0ECBF2EB48B02387AAE2D4CCCDF1F1A1"
+ "B8CC4F1FA2C56AD40D0E4DAA9C28CDBF0A549098EA13200000000000000000"
+ "00000000000000000000000000000000000000000000000000000000000000"
+ "0000000000000000000000000000000000000000000000",
+ buffer));
AssignDecimalString(&bignum, "1234");
bignum.MultiplyByPowerOfTen(1000);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("1258040F99B1CD1CC9819C676D413EA50E4A6A8F114BB0C65418C62D399B81"
- "6361466CA8E095193E1EE97173553597C96673AF67FAFE27A66E7EF2E5EF2E"
- "E3F5F5070CC17FE83BA53D40A66A666A02F9E00B0E11328D2224B8694C7372"
- "F3D536A0AD1985911BD361496F268E8B23112500EAF9B88A9BC67B2AB04D38"
- "7FEFACD00F5AF4F764F9ABC3ABCDE54612DE38CD90CB6647CA389EA0E86B16"
- "BF7A1F34086E05ADBE00BD1673BE00FAC4B34AF1091E8AD50BA675E0381440"
- "EA8E9D93E75D816BAB37C9844B1441C38FC65CF30ABB71B36433AF26DD97BD"
- "ABBA96C03B4919B8F3515B92826B85462833380DC193D79F69D20DD6038C99"
- "6114EF6C446F0BA28CC772ACBA58B81C04F8FFDE7B18C4E5A3ABC51E637FDF"
- "6E37FDFF04C940919390F4FF92000000000000000000000000000000000000"
- "00000000000000000000000000000000000000000000000000000000000000"
- "00000000000000000000000000000000000000000000000000000000000000"
- "00000000000000000000000000000000000000000000000000000000000000"
- "0000000000000000000000000000", buffer);
+ CHECK_EQ(0,
+ strcmp(
+ "1258040F99B1CD1CC9819C676D413EA50E4A6A8F114BB0C65418C62D399B81"
+ "6361466CA8E095193E1EE97173553597C96673AF67FAFE27A66E7EF2E5EF2E"
+ "E3F5F5070CC17FE83BA53D40A66A666A02F9E00B0E11328D2224B8694C7372"
+ "F3D536A0AD1985911BD361496F268E8B23112500EAF9B88A9BC67B2AB04D38"
+ "7FEFACD00F5AF4F764F9ABC3ABCDE54612DE38CD90CB6647CA389EA0E86B16"
+ "BF7A1F34086E05ADBE00BD1673BE00FAC4B34AF1091E8AD50BA675E0381440"
+ "EA8E9D93E75D816BAB37C9844B1441C38FC65CF30ABB71B36433AF26DD97BD"
+ "ABBA96C03B4919B8F3515B92826B85462833380DC193D79F69D20DD6038C99"
+ "6114EF6C446F0BA28CC772ACBA58B81C04F8FFDE7B18C4E5A3ABC51E637FDF"
+ "6E37FDFF04C940919390F4FF92000000000000000000000000000000000000"
+ "00000000000000000000000000000000000000000000000000000000000000"
+ "00000000000000000000000000000000000000000000000000000000000000"
+ "00000000000000000000000000000000000000000000000000000000000000"
+ "0000000000000000000000000000",
+ buffer));
Bignum bignum2;
AssignHexString(&bignum2, "3DA774C07FB5DF54284D09C675A492165B830D5DAAEB2A7501"
"567C794D0BFE338DFBB42D92D4215AF3BB22BF0A8B283FDDC2"
"C667A10958EA6D2");
CHECK(bignum2.ToHexString(buffer, kBufferSize));
- CHECK_EQ("3DA774C07FB5DF54284D09C675A492165B830D5DAAEB2A7501"
- "DA17CF9DFA1CA2282269F92A25A97314296B717E3DCBB9FE17"
- "41A842FE2913F540F40796F2381155763502C58B15AF7A7F88"
- "6F744C9164FF409A28F7FA0C41F89ED79C1BE9F322C8578B97"
- "841F1CBAA17D901BE1230E3C00E1C643AF32638B5674E01FEA"
- "96FC90864E621B856A9E1CE56E6EB545B9C2F8F0CC10DDA88D"
- "CC6D282605F8DB67044F2DFD3695E7BA63877AE16701536AE6"
- "567C794D0BFE338DFBB42D92D4215AF3BB22BF0A8B283FDDC2"
- "C667A10958EA6D2", buffer);
+ CHECK_EQ(0, strcmp(
+ "3DA774C07FB5DF54284D09C675A492165B830D5DAAEB2A7501"
+ "DA17CF9DFA1CA2282269F92A25A97314296B717E3DCBB9FE17"
+ "41A842FE2913F540F40796F2381155763502C58B15AF7A7F88"
+ "6F744C9164FF409A28F7FA0C41F89ED79C1BE9F322C8578B97"
+ "841F1CBAA17D901BE1230E3C00E1C643AF32638B5674E01FEA"
+ "96FC90864E621B856A9E1CE56E6EB545B9C2F8F0CC10DDA88D"
+ "CC6D282605F8DB67044F2DFD3695E7BA63877AE16701536AE6"
+ "567C794D0BFE338DFBB42D92D4215AF3BB22BF0A8B283FDDC2"
+ "C667A10958EA6D2",
+ buffer));
bignum.AssignBignum(bignum2);
bignum.MultiplyByPowerOfTen(1);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("2688A8F84FD1AB949930261C0986DB4DF931E85A8AD2FA8921284EE1C2BC51"
- "E55915823BBA5789E7EC99E326EEE69F543ECE890929DED9AC79489884BE57"
- "630AD569E121BB76ED8DAC8FB545A8AFDADF1F8860599AFC47A93B6346C191"
- "7237F5BD36B73EB29371F4A4EE7A116CB5E8E5808D1BEA4D7F7E3716090C13"
- "F29E5DDA53F0FD513362A2D20F6505314B9419DB967F8A8A89589FC43917C3"
- "BB892062B17CBE421DB0D47E34ACCCE060D422CFF60DCBD0277EE038BD509C"
- "7BC494D8D854F5B76696F927EA99BC00C4A5D7928434", buffer);
+ CHECK_EQ(0,
+ strcmp(
+ "2688A8F84FD1AB949930261C0986DB4DF931E85A8AD2FA8921284EE1C2BC51"
+ "E55915823BBA5789E7EC99E326EEE69F543ECE890929DED9AC79489884BE57"
+ "630AD569E121BB76ED8DAC8FB545A8AFDADF1F8860599AFC47A93B6346C191"
+ "7237F5BD36B73EB29371F4A4EE7A116CB5E8E5808D1BEA4D7F7E3716090C13"
+ "F29E5DDA53F0FD513362A2D20F6505314B9419DB967F8A8A89589FC43917C3"
+ "BB892062B17CBE421DB0D47E34ACCCE060D422CFF60DCBD0277EE038BD509C"
+ "7BC494D8D854F5B76696F927EA99BC00C4A5D7928434",
+ buffer));
bignum.AssignBignum(bignum2);
bignum.MultiplyByPowerOfTen(2);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("1815699B31E30B3CDFBE17D185F44910BBBF313896C3DC95B4B9314D19B5B32"
- "F57AD71655476B630F3E02DF855502394A74115A5BA2B480BCBCD5F52F6F69D"
- "E6C5622CB5152A54788BD9D14B896DE8CB73B53C3800DDACC9C51E0C38FAE76"
- "2F9964232872F9C2738E7150C4AE3F1B18F70583172706FAEE26DC5A78C77A2"
- "FAA874769E52C01DA5C3499F233ECF3C90293E0FB69695D763DAA3AEDA5535B"
- "43DAEEDF6E9528E84CEE0EC000C3C8495C1F9C89F6218AF4C23765261CD5ADD"
- "0787351992A01E5BB8F2A015807AE7A6BB92A08", buffer);
+ CHECK_EQ(0,
+ strcmp(
+ "1815699B31E30B3CDFBE17D185F44910BBBF313896C3DC95B4B9314D19B5B32"
+ "F57AD71655476B630F3E02DF855502394A74115A5BA2B480BCBCD5F52F6F69D"
+ "E6C5622CB5152A54788BD9D14B896DE8CB73B53C3800DDACC9C51E0C38FAE76"
+ "2F9964232872F9C2738E7150C4AE3F1B18F70583172706FAEE26DC5A78C77A2"
+ "FAA874769E52C01DA5C3499F233ECF3C90293E0FB69695D763DAA3AEDA5535B"
+ "43DAEEDF6E9528E84CEE0EC000C3C8495C1F9C89F6218AF4C23765261CD5ADD"
+ "0787351992A01E5BB8F2A015807AE7A6BB92A08",
+ buffer));
bignum.AssignBignum(bignum2);
bignum.MultiplyByPowerOfTen(5);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("5E13A4863ADEE3E5C9FE8D0A73423D695D62D8450CED15A8C9F368952C6DC3"
- "F0EE7D82F3D1EFB7AF38A3B3920D410AFCAD563C8F5F39116E141A3C5C14B3"
- "58CD73077EA35AAD59F6E24AD98F10D5555ABBFBF33AC361EAF429FD5FBE94"
- "17DA9EF2F2956011F9F93646AA38048A681D984ED88127073443247CCC167C"
- "B354A32206EF5A733E73CF82D795A1AD598493211A6D613C39515E0E0F6304"
- "DCD9C810F3518C7F6A7CB6C81E99E02FCC65E8FDB7B7AE97306CC16A8631CE"
- "0A2AEF6568276BE4C176964A73C153FDE018E34CB4C2F40", buffer);
+ CHECK_EQ(0,
+ strcmp(
+ "5E13A4863ADEE3E5C9FE8D0A73423D695D62D8450CED15A8C9F368952C6DC3"
+ "F0EE7D82F3D1EFB7AF38A3B3920D410AFCAD563C8F5F39116E141A3C5C14B3"
+ "58CD73077EA35AAD59F6E24AD98F10D5555ABBFBF33AC361EAF429FD5FBE94"
+ "17DA9EF2F2956011F9F93646AA38048A681D984ED88127073443247CCC167C"
+ "B354A32206EF5A733E73CF82D795A1AD598493211A6D613C39515E0E0F6304"
+ "DCD9C810F3518C7F6A7CB6C81E99E02FCC65E8FDB7B7AE97306CC16A8631CE"
+ "0A2AEF6568276BE4C176964A73C153FDE018E34CB4C2F40",
+ buffer));
bignum.AssignBignum(bignum2);
bignum.MultiplyByPowerOfTen(10);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("8F8CB8EB51945A7E815809F6121EF2F4E61EF3405CD9432CAD2709749EEAFD"
- "1B81E843F14A3667A7BDCCC9E0BB795F63CDFDB62844AC7438976C885A0116"
- "29607DA54F9C023CC366570B7637ED0F855D931752038A614922D0923E382C"
- "B8E5F6C975672DB76E0DE471937BB9EDB11E28874F1C122D5E1EF38CECE9D0"
- "0723056BCBD4F964192B76830634B1D322B7EB0062F3267E84F5C824343A77"
- "4B7DCEE6DD464F01EBDC8C671BB18BB4EF4300A42474A6C77243F2A12B03BF"
- "0443C38A1C0D2701EDB393135AE0DEC94211F9D4EB51F990800", buffer);
+ CHECK_EQ(0,
+ strcmp(
+ "8F8CB8EB51945A7E815809F6121EF2F4E61EF3405CD9432CAD2709749EEAFD"
+ "1B81E843F14A3667A7BDCCC9E0BB795F63CDFDB62844AC7438976C885A0116"
+ "29607DA54F9C023CC366570B7637ED0F855D931752038A614922D0923E382C"
+ "B8E5F6C975672DB76E0DE471937BB9EDB11E28874F1C122D5E1EF38CECE9D0"
+ "0723056BCBD4F964192B76830634B1D322B7EB0062F3267E84F5C824343A77"
+ "4B7DCEE6DD464F01EBDC8C671BB18BB4EF4300A42474A6C77243F2A12B03BF"
+ "0443C38A1C0D2701EDB393135AE0DEC94211F9D4EB51F990800",
+ buffer));
bignum.AssignBignum(bignum2);
bignum.MultiplyByPowerOfTen(50);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("107A8BE345E24407372FC1DE442CBA696BC23C4FFD5B4BDFD9E5C39559815"
- "86628CF8472D2D589F2FC2BAD6E0816EC72CBF85CCA663D8A1EC6C51076D8"
- "2D247E6C26811B7EC4D4300FB1F91028DCB7B2C4E7A60C151161AA7E65E79"
- "B40917B12B2B5FBE7745984D4E8EFA31F9AE6062427B068B144A9CB155873"
- "E7C0C9F0115E5AC72DC5A73C4796DB970BF9205AB8C77A6996EB1B417F9D1"
- "6232431E6313C392203601B9C22CC10DDA88DCC6D282605F8DB67044F2DFD"
- "3695E7BA63877AE16701536AE6567C794D0BFE338DFBB42D924CF964BD2C0"
- "F586E03A2FCD35A408000000000000", buffer);
+ CHECK_EQ(0,
+ strcmp(
+ "107A8BE345E24407372FC1DE442CBA696BC23C4FFD5B4BDFD9E5C39559815"
+ "86628CF8472D2D589F2FC2BAD6E0816EC72CBF85CCA663D8A1EC6C51076D8"
+ "2D247E6C26811B7EC4D4300FB1F91028DCB7B2C4E7A60C151161AA7E65E79"
+ "B40917B12B2B5FBE7745984D4E8EFA31F9AE6062427B068B144A9CB155873"
+ "E7C0C9F0115E5AC72DC5A73C4796DB970BF9205AB8C77A6996EB1B417F9D1"
+ "6232431E6313C392203601B9C22CC10DDA88DCC6D282605F8DB67044F2DFD"
+ "3695E7BA63877AE16701536AE6567C794D0BFE338DFBB42D924CF964BD2C0"
+ "F586E03A2FCD35A408000000000000",
+ buffer));
bignum.AssignBignum(bignum2);
bignum.MultiplyByPowerOfTen(100);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("46784A90ACD0ED3E7759CC585FB32D36EB6034A6F78D92604E3BAA5ED3D8B"
- "6E60E854439BE448897FB4B7EA5A3D873AA0FCB3CFFD80D0530880E45F511"
- "722A50CE7E058B5A6F5464DB7500E34984EE3202A9441F44FA1554C0CEA96"
- "B438A36F25E7C9D56D71AE2CD313EC37534DA299AC0854FC48591A7CF3171"
- "31265AA4AE62DE32344CE7BEEEF894AE686A2DAAFE5D6D9A10971FFD9C064"
- "5079B209E1048F58B5192D41D84336AC4C8C489EEF00939CFC9D55C122036"
- "01B9C22CC10DDA88DCC6D282605F8DB67044F2DFD3695E7BA3F67B96D3A32"
- "E11FB5561B68744C4035B0800DC166D49D98E3FD1D5BB2000000000000000"
- "0000000000", buffer);
+ CHECK_EQ(0,
+ strcmp(
+ "46784A90ACD0ED3E7759CC585FB32D36EB6034A6F78D92604E3BAA5ED3D8B"
+ "6E60E854439BE448897FB4B7EA5A3D873AA0FCB3CFFD80D0530880E45F511"
+ "722A50CE7E058B5A6F5464DB7500E34984EE3202A9441F44FA1554C0CEA96"
+ "B438A36F25E7C9D56D71AE2CD313EC37534DA299AC0854FC48591A7CF3171"
+ "31265AA4AE62DE32344CE7BEEEF894AE686A2DAAFE5D6D9A10971FFD9C064"
+ "5079B209E1048F58B5192D41D84336AC4C8C489EEF00939CFC9D55C122036"
+ "01B9C22CC10DDA88DCC6D282605F8DB67044F2DFD3695E7BA3F67B96D3A32"
+ "E11FB5561B68744C4035B0800DC166D49D98E3FD1D5BB2000000000000000"
+ "0000000000",
+ buffer));
bignum.AssignBignum(bignum2);
bignum.MultiplyByPowerOfTen(200);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("508BD351221DF139D72D88CDC0416845A53EE2D0E6B98352509A9AC312F8C"
- "6CB1A144889416201E0B6CE66EA3EBE259B5FD79ECFC1FD77963CE516CC7E"
- "2FE73D4B5B710C19F6BCB092C7A2FD76286543B8DBD2C596DFF2C896720BA"
- "DFF7BC9C366ACEA3A880AEC287C5E6207DF2739B5326FC19D773BD830B109"
- "ED36C7086544BF8FDB9D4B73719C2B5BC2F571A5937EC46876CD428281F6B"
- "F287E1E07F25C1B1D46BC37324FF657A8B2E0071DB83B86123CA34004F406"
- "001082D7945E90C6E8C9A9FEC2B44BE0DDA46E9F52B152E4D1336D2FCFBC9"
- "96E30CA0082256737365158FE36482AA7EB9DAF2AB128F10E7551A3CD5BE6"
- "0A922F3A7D5EED38B634A7EC95BCF7021BA6820A292000000000000000000"
- "00000000000000000000000000000000", buffer);
+ CHECK_EQ(0,
+ strcmp(
+ "508BD351221DF139D72D88CDC0416845A53EE2D0E6B98352509A9AC312F8C"
+ "6CB1A144889416201E0B6CE66EA3EBE259B5FD79ECFC1FD77963CE516CC7E"
+ "2FE73D4B5B710C19F6BCB092C7A2FD76286543B8DBD2C596DFF2C896720BA"
+ "DFF7BC9C366ACEA3A880AEC287C5E6207DF2739B5326FC19D773BD830B109"
+ "ED36C7086544BF8FDB9D4B73719C2B5BC2F571A5937EC46876CD428281F6B"
+ "F287E1E07F25C1B1D46BC37324FF657A8B2E0071DB83B86123CA34004F406"
+ "001082D7945E90C6E8C9A9FEC2B44BE0DDA46E9F52B152E4D1336D2FCFBC9"
+ "96E30CA0082256737365158FE36482AA7EB9DAF2AB128F10E7551A3CD5BE6"
+ "0A922F3A7D5EED38B634A7EC95BCF7021BA6820A292000000000000000000"
+ "00000000000000000000000000000000",
+ buffer));
bignum.AssignBignum(bignum2);
bignum.MultiplyByPowerOfTen(500);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("7845F900E475B5086885BAAAE67C8E85185ACFE4633727F82A4B06B5582AC"
- "BE933C53357DA0C98C20C5AC900C4D76A97247DF52B79F48F9E35840FB715"
- "D392CE303E22622B0CF82D9471B398457DD3196F639CEE8BBD2C146873841"
- "F0699E6C41F04FC7A54B48CEB995BEB6F50FE81DE9D87A8D7F849CC523553"
- "7B7BBBC1C7CAAFF6E9650BE03B308C6D31012AEF9580F70D3EE2083ADE126"
- "8940FA7D6308E239775DFD2F8C97FF7EBD525DAFA6512216F7047A62A93DC"
- "38A0165BDC67E250DCC96A0181DE935A70B38704DC71819F02FC5261FF7E1"
- "E5F11907678B0A3E519FF4C10A867B0C26CE02BE6960BA8621A87303C101C"
- "3F88798BB9F7739655946F8B5744E6B1EAF10B0C5621330F0079209033C69"
- "20DE2E2C8D324F0624463735D482BF291926C22A910F5B80FA25170B6B57D"
- "8D5928C7BCA3FE87461275F69BD5A1B83181DAAF43E05FC3C72C4E93111B6"
- "6205EBF49B28FEDFB7E7526CBDA658A332000000000000000000000000000"
- "0000000000000000000000000000000000000000000000000000000000000"
- "0000000000000000000000000000000000000", buffer);
+ CHECK_EQ(0,
+ strcmp(
+ "7845F900E475B5086885BAAAE67C8E85185ACFE4633727F82A4B06B5582AC"
+ "BE933C53357DA0C98C20C5AC900C4D76A97247DF52B79F48F9E35840FB715"
+ "D392CE303E22622B0CF82D9471B398457DD3196F639CEE8BBD2C146873841"
+ "F0699E6C41F04FC7A54B48CEB995BEB6F50FE81DE9D87A8D7F849CC523553"
+ "7B7BBBC1C7CAAFF6E9650BE03B308C6D31012AEF9580F70D3EE2083ADE126"
+ "8940FA7D6308E239775DFD2F8C97FF7EBD525DAFA6512216F7047A62A93DC"
+ "38A0165BDC67E250DCC96A0181DE935A70B38704DC71819F02FC5261FF7E1"
+ "E5F11907678B0A3E519FF4C10A867B0C26CE02BE6960BA8621A87303C101C"
+ "3F88798BB9F7739655946F8B5744E6B1EAF10B0C5621330F0079209033C69"
+ "20DE2E2C8D324F0624463735D482BF291926C22A910F5B80FA25170B6B57D"
+ "8D5928C7BCA3FE87461275F69BD5A1B83181DAAF43E05FC3C72C4E93111B6"
+ "6205EBF49B28FEDFB7E7526CBDA658A332000000000000000000000000000"
+ "0000000000000000000000000000000000000000000000000000000000000"
+ "0000000000000000000000000000000000000",
+ buffer));
}
other.AssignUInt16(2);
CHECK_EQ(5, bignum.DivideModuloIntBignum(other));
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("0", buffer);
+ CHECK_EQ(0, strcmp("0", buffer));
bignum.AssignUInt16(10);
bignum.ShiftLeft(500);
other.AssignUInt16(2);
other.ShiftLeft(500);
CHECK_EQ(5, bignum.DivideModuloIntBignum(other));
- CHECK_EQ("0", buffer);
+ CHECK_EQ(0, strcmp("0", buffer));
bignum.AssignUInt16(11);
other.AssignUInt16(2);
CHECK_EQ(5, bignum.DivideModuloIntBignum(other));
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("1", buffer);
+ CHECK_EQ(0, strcmp("1", buffer));
bignum.AssignUInt16(10);
bignum.ShiftLeft(500);
other.ShiftLeft(500);
CHECK_EQ(5, bignum.DivideModuloIntBignum(other));
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("1", buffer);
+ CHECK_EQ(0, strcmp("1", buffer));
bignum.AssignUInt16(10);
bignum.ShiftLeft(500);
bignum.AddBignum(third);
CHECK_EQ(0x1234, bignum.DivideModuloIntBignum(other));
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("FFF", buffer);
+ CHECK_EQ(0, strcmp("FFF", buffer));
bignum.AssignUInt16(10);
AssignHexString(&other, "1234567890");
CHECK_EQ(0, bignum.DivideModuloIntBignum(other));
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("A", buffer);
+ CHECK_EQ(0, strcmp("A", buffer));
AssignHexString(&bignum, "12345678");
AssignHexString(&other, "3789012");
CHECK_EQ(5, bignum.DivideModuloIntBignum(other));
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("D9861E", buffer);
+ CHECK_EQ(0, strcmp("D9861E", buffer));
AssignHexString(&bignum, "70000001");
AssignHexString(&other, "1FFFFFFF");
CHECK_EQ(3, bignum.DivideModuloIntBignum(other));
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("10000004", buffer);
+ CHECK_EQ(0, strcmp("10000004", buffer));
AssignHexString(&bignum, "28000000");
AssignHexString(&other, "12A05F20");
CHECK_EQ(2, bignum.DivideModuloIntBignum(other));
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("2BF41C0", buffer);
+ CHECK_EQ(0, strcmp("2BF41C0", buffer));
bignum.AssignUInt16(10);
bignum.ShiftLeft(500);
other.SubtractBignum(third);
CHECK_EQ(0x1234, bignum.DivideModuloIntBignum(other));
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("1232DCC", buffer);
+ CHECK_EQ(0, strcmp("1232DCC", buffer));
CHECK_EQ(0, bignum.DivideModuloIntBignum(other));
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("1232DCC", buffer);
+ CHECK_EQ(0, strcmp("1232DCC", buffer));
}
bignum.AssignUInt16(1);
bignum.Square();
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("1", buffer);
+ CHECK_EQ(0, strcmp("1", buffer));
bignum.AssignUInt16(2);
bignum.Square();
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("4", buffer);
+ CHECK_EQ(0, strcmp("4", buffer));
bignum.AssignUInt16(10);
bignum.Square();
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("64", buffer);
+ CHECK_EQ(0, strcmp("64", buffer));
AssignHexString(&bignum, "FFFFFFF");
bignum.Square();
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("FFFFFFE0000001", buffer);
+ CHECK_EQ(0, strcmp("FFFFFFE0000001", buffer));
AssignHexString(&bignum, "FFFFFFFFFFFFFF");
bignum.Square();
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("FFFFFFFFFFFFFE00000000000001", buffer);
+ CHECK_EQ(0, strcmp("FFFFFFFFFFFFFE00000000000001", buffer));
}
bignum.AssignPowerUInt16(1, 0);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("1", buffer);
+ CHECK_EQ(0, strcmp("1", buffer));
bignum.AssignPowerUInt16(1, 1);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("1", buffer);
+ CHECK_EQ(0, strcmp("1", buffer));
bignum.AssignPowerUInt16(1, 2);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("1", buffer);
+ CHECK_EQ(0, strcmp("1", buffer));
bignum.AssignPowerUInt16(2, 0);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("1", buffer);
+ CHECK_EQ(0, strcmp("1", buffer));
bignum.AssignPowerUInt16(2, 1);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("2", buffer);
+ CHECK_EQ(0, strcmp("2", buffer));
bignum.AssignPowerUInt16(2, 2);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("4", buffer);
+ CHECK_EQ(0, strcmp("4", buffer));
bignum.AssignPowerUInt16(16, 1);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("10", buffer);
+ CHECK_EQ(0, strcmp("10", buffer));
bignum.AssignPowerUInt16(16, 2);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("100", buffer);
+ CHECK_EQ(0, strcmp("100", buffer));
bignum.AssignPowerUInt16(16, 5);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("100000", buffer);
+ CHECK_EQ(0, strcmp("100000", buffer));
bignum.AssignPowerUInt16(16, 8);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("100000000", buffer);
+ CHECK_EQ(0, strcmp("100000000", buffer));
bignum.AssignPowerUInt16(16, 16);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("10000000000000000", buffer);
+ CHECK_EQ(0, strcmp("10000000000000000", buffer));
bignum.AssignPowerUInt16(16, 30);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("1000000000000000000000000000000", buffer);
+ CHECK_EQ(0, strcmp("1000000000000000000000000000000", buffer));
bignum.AssignPowerUInt16(10, 0);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("1", buffer);
+ CHECK_EQ(0, strcmp("1", buffer));
bignum.AssignPowerUInt16(10, 1);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("A", buffer);
+ CHECK_EQ(0, strcmp("A", buffer));
bignum.AssignPowerUInt16(10, 2);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("64", buffer);
+ CHECK_EQ(0, strcmp("64", buffer));
bignum.AssignPowerUInt16(10, 5);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("186A0", buffer);
+ CHECK_EQ(0, strcmp("186A0", buffer));
bignum.AssignPowerUInt16(10, 8);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("5F5E100", buffer);
+ CHECK_EQ(0, strcmp("5F5E100", buffer));
bignum.AssignPowerUInt16(10, 16);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("2386F26FC10000", buffer);
+ CHECK_EQ(0, strcmp("2386F26FC10000", buffer));
bignum.AssignPowerUInt16(10, 30);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("C9F2C9CD04674EDEA40000000", buffer);
+ CHECK_EQ(0, strcmp("C9F2C9CD04674EDEA40000000", buffer));
bignum.AssignPowerUInt16(10, 31);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("7E37BE2022C0914B2680000000", buffer);
+ CHECK_EQ(0, strcmp("7E37BE2022C0914B2680000000", buffer));
bignum.AssignPowerUInt16(2, 0);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("1", buffer);
+ CHECK_EQ(0, strcmp("1", buffer));
bignum.AssignPowerUInt16(2, 100);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("10000000000000000000000000", buffer);
+ CHECK_EQ(0, strcmp("10000000000000000000000000", buffer));
bignum.AssignPowerUInt16(17, 0);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("1", buffer);
+ CHECK_EQ(0, strcmp("1", buffer));
bignum.AssignPowerUInt16(17, 99);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("1942BB9853FAD924A3D4DD92B89B940E0207BEF05DB9C26BC1B757"
- "80BE0C5A2C2990E02A681224F34ED68558CE4C6E33760931",
- buffer);
+ CHECK_EQ(0, strcmp(
+ "1942BB9853FAD924A3D4DD92B89B940E0207BEF05DB9C26BC1B757"
+ "80BE0C5A2C2990E02A681224F34ED68558CE4C6E33760931",
+ buffer));
bignum.AssignPowerUInt16(0xFFFF, 99);
CHECK(bignum.ToHexString(buffer, kBufferSize));
- CHECK_EQ("FF9D12F09B886C54E77E7439C7D2DED2D34F669654C0C2B6B8C288250"
- "5A2211D0E3DC9A61831349EAE674B11D56E3049D7BD79DAAD6C9FA2BA"
- "528E3A794299F2EE9146A324DAFE3E88967A0358233B543E233E575B9"
- "DD4E3AA7942146426C328FF55BFD5C45E0901B1629260AF9AE2F310C5"
- "50959FAF305C30116D537D80CF6EBDBC15C5694062AF1AC3D956D0A41"
- "B7E1B79FF11E21D83387A1CE1F5882B31E4B5D8DE415BDBE6854466DF"
- "343362267A7E8833119D31D02E18DB5B0E8F6A64B0ED0D0062FFFF",
- buffer);
+ CHECK_EQ(0, strcmp(
+ "FF9D12F09B886C54E77E7439C7D2DED2D34F669654C0C2B6B8C288250"
+ "5A2211D0E3DC9A61831349EAE674B11D56E3049D7BD79DAAD6C9FA2BA"
+ "528E3A794299F2EE9146A324DAFE3E88967A0358233B543E233E575B9"
+ "DD4E3AA7942146426C328FF55BFD5C45E0901B1629260AF9AE2F310C5"
+ "50959FAF305C30116D537D80CF6EBDBC15C5694062AF1AC3D956D0A41"
+ "B7E1B79FF11E21D83387A1CE1F5882B31E4B5D8DE415BDBE6854466DF"
+ "343362267A7E8833119D31D02E18DB5B0E8F6A64B0ED0D0062FFFF",
+ buffer));
}
+++ /dev/null
-// Copyright 2014 the V8 project authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "src/checks.h"
-
-#include "test/cctest/cctest.h"
-
-
-TEST(CheckEqualsZeroAndMinusZero) {
- CHECK_EQ(0.0, 0.0);
- CHECK_NE(0.0, -0.0);
- CHECK_NE(-0.0, 0.0);
- CHECK_EQ(-0.0, -0.0);
-}
-
-
-TEST(CheckEqualsReflexivity) {
- double inf = V8_INFINITY;
- double nan = std::numeric_limits<double>::quiet_NaN();
- double constants[] = {-nan, -inf, -3.1415, -1.0, -0.1, -0.0,
- 0.0, 0.1, 1.0, 3.1415, inf, nan};
- for (size_t i = 0; i < arraysize(constants); ++i) {
- CHECK_EQ(constants[i], constants[i]);
- }
-}
// Check that we are using non-reserved values.
// Fill up the first chunk.
- CHECK_EQ(NULL, scq.Peek());
+ CHECK(!scq.Peek());
for (Record i = 1; i < 1 + kMaxRecordsInQueue; ++i) {
Record* rec = reinterpret_cast<Record*>(scq.StartEnqueue());
- CHECK_NE(NULL, rec);
+ CHECK(rec);
*rec = i;
scq.FinishEnqueue();
}
// The queue is full, enqueue is not allowed.
- CHECK_EQ(NULL, scq.StartEnqueue());
+ CHECK(!scq.StartEnqueue());
// Try to enqueue when the the queue is full. Consumption must be available.
- CHECK_NE(NULL, scq.Peek());
+ CHECK(scq.Peek());
for (int i = 0; i < 10; ++i) {
Record* rec = reinterpret_cast<Record*>(scq.StartEnqueue());
- CHECK_EQ(NULL, rec);
- CHECK_NE(NULL, scq.Peek());
+ CHECK(!rec);
+ CHECK(scq.Peek());
}
// Consume all records.
for (Record i = 1; i < 1 + kMaxRecordsInQueue; ++i) {
Record* rec = reinterpret_cast<Record*>(scq.Peek());
- CHECK_NE(NULL, rec);
+ CHECK(rec);
CHECK_EQ(static_cast<int64_t>(i), static_cast<int64_t>(*rec));
CHECK_EQ(rec, reinterpret_cast<Record*>(scq.Peek()));
scq.Remove();
CHECK_NE(rec, reinterpret_cast<Record*>(scq.Peek()));
}
// The queue is empty.
- CHECK_EQ(NULL, scq.Peek());
+ CHECK(!scq.Peek());
- CHECK_EQ(NULL, scq.Peek());
+ CHECK(!scq.Peek());
for (Record i = 0; i < kMaxRecordsInQueue / 2; ++i) {
Record* rec = reinterpret_cast<Record*>(scq.StartEnqueue());
- CHECK_NE(NULL, rec);
+ CHECK(rec);
*rec = i;
scq.FinishEnqueue();
}
// Consume all available kMaxRecordsInQueue / 2 records.
- CHECK_NE(NULL, scq.Peek());
+ CHECK(scq.Peek());
for (Record i = 0; i < kMaxRecordsInQueue / 2; ++i) {
Record* rec = reinterpret_cast<Record*>(scq.Peek());
- CHECK_NE(NULL, rec);
+ CHECK(rec);
CHECK_EQ(static_cast<int64_t>(i), static_cast<int64_t>(*rec));
CHECK_EQ(rec, reinterpret_cast<Record*>(scq.Peek()));
scq.Remove();
}
// The queue is empty.
- CHECK_EQ(NULL, scq.Peek());
+ CHECK(!scq.Peek());
}
virtual void Run() {
for (Record i = value_; i < value_ + records_per_chunk_; ++i) {
Record* rec = reinterpret_cast<Record*>(scq_->StartEnqueue());
- CHECK_NE(NULL, rec);
+ CHECK(rec);
*rec = i;
scq_->FinishEnqueue();
}
ProducerThread producer2(&scq, kRecordsPerChunk, 10, &semaphore);
ProducerThread producer3(&scq, kRecordsPerChunk, 20, &semaphore);
- CHECK_EQ(NULL, scq.Peek());
+ CHECK(!scq.Peek());
producer1.Start();
semaphore.Wait();
for (Record i = 1; i < 1 + kRecordsPerChunk; ++i) {
Record* rec = reinterpret_cast<Record*>(scq.Peek());
- CHECK_NE(NULL, rec);
+ CHECK(rec);
CHECK_EQ(static_cast<int64_t>(i), static_cast<int64_t>(*rec));
CHECK_EQ(rec, reinterpret_cast<Record*>(scq.Peek()));
scq.Remove();
CHECK_NE(rec, reinterpret_cast<Record*>(scq.Peek()));
}
- CHECK_EQ(NULL, scq.Peek());
+ CHECK(!scq.Peek());
producer2.Start();
semaphore.Wait();
for (Record i = 10; i < 10 + kRecordsPerChunk; ++i) {
Record* rec = reinterpret_cast<Record*>(scq.Peek());
- CHECK_NE(NULL, rec);
+ CHECK(rec);
CHECK_EQ(static_cast<int64_t>(i), static_cast<int64_t>(*rec));
CHECK_EQ(rec, reinterpret_cast<Record*>(scq.Peek()));
scq.Remove();
CHECK_NE(rec, reinterpret_cast<Record*>(scq.Peek()));
}
- CHECK_EQ(NULL, scq.Peek());
+ CHECK(!scq.Peek());
producer3.Start();
semaphore.Wait();
for (Record i = 20; i < 20 + kRecordsPerChunk; ++i) {
Record* rec = reinterpret_cast<Record*>(scq.Peek());
- CHECK_NE(NULL, rec);
+ CHECK(rec);
CHECK_EQ(static_cast<int64_t>(i), static_cast<int64_t>(*rec));
CHECK_EQ(rec, reinterpret_cast<Record*>(scq.Peek()));
scq.Remove();
CHECK_NE(rec, reinterpret_cast<Record*>(scq.Peek()));
}
- CHECK_EQ(NULL, scq.Peek());
+ CHECK(!scq.Peek());
}
// One bit bit field can hold values 0 and 1.
CHECK(!OneBit1::is_valid(static_cast<uint32_t>(-1)));
CHECK(!OneBit2::is_valid(static_cast<uint32_t>(-1)));
- for (int i = 0; i < 2; i++) {
+ for (unsigned i = 0; i < 2; i++) {
CHECK(OneBit1::is_valid(i));
x = OneBit1::encode(i);
CHECK_EQ(i, OneBit1::decode(x));
// Eight bit bit field can hold values from 0 tp 255.
CHECK(!EightBit1::is_valid(static_cast<uint32_t>(-1)));
CHECK(!EightBit2::is_valid(static_cast<uint32_t>(-1)));
- for (int i = 0; i < 256; i++) {
+ for (unsigned i = 0; i < 256; i++) {
CHECK(EightBit1::is_valid(i));
x = EightBit1::encode(i);
CHECK_EQ(i, EightBit1::decode(x));
// Check the state of profile generator.
CodeEntry* aaa = generator.code_map()->FindEntry(aaa_code->address());
- CHECK_NE(NULL, aaa);
+ CHECK(aaa);
CHECK_EQ(aaa_str, aaa->name());
CodeEntry* comment = generator.code_map()->FindEntry(comment_code->address());
- CHECK_NE(NULL, comment);
+ CHECK(comment);
CHECK_EQ("comment", comment->name());
CodeEntry* args5 = generator.code_map()->FindEntry(args5_code->address());
- CHECK_NE(NULL, args5);
+ CHECK(args5);
CHECK_EQ("5", args5->name());
- CHECK_EQ(NULL, generator.code_map()->FindEntry(comment2_code->address()));
+ CHECK(!generator.code_map()->FindEntry(comment2_code->address()));
CodeEntry* comment2 = generator.code_map()->FindEntry(moved_code->address());
- CHECK_NE(NULL, comment2);
+ CHECK(comment2);
CHECK_EQ("comment2", comment2->name());
}
processor->StopSynchronously();
CpuProfile* profile = profiles->StopProfiling("");
- CHECK_NE(NULL, profile);
+ CHECK(profile);
// Check call trees.
const i::List<ProfileNode*>* top_down_root_children =
processor->StopSynchronously();
CpuProfile* profile = profiles->StopProfiling("");
- CHECK_NE(NULL, profile);
+ CHECK(profile);
- int actual_depth = 0;
+ unsigned actual_depth = 0;
const ProfileNode* node = profile->top_down()->root();
while (node->children()->length() > 0) {
node = node->children()->last();
v8::Local<v8::String> name1 = v8::String::NewFromUtf8(env->GetIsolate(), "1");
cpu_profiler->StartProfiling(name1);
v8::CpuProfile* p1 = cpu_profiler->StopProfiling(name1);
- CHECK_NE(NULL, p1);
+ CHECK(p1);
CHECK_EQ(1, iprofiler->GetProfilesCount());
CHECK(FindCpuProfile(cpu_profiler, p1));
p1->Delete();
v8::Local<v8::String> name2 = v8::String::NewFromUtf8(env->GetIsolate(), "2");
cpu_profiler->StartProfiling(name2);
v8::CpuProfile* p2 = cpu_profiler->StopProfiling(name2);
- CHECK_NE(NULL, p2);
+ CHECK(p2);
CHECK_EQ(1, iprofiler->GetProfilesCount());
CHECK(FindCpuProfile(cpu_profiler, p2));
v8::Local<v8::String> name3 = v8::String::NewFromUtf8(env->GetIsolate(), "3");
cpu_profiler->StartProfiling(name3);
v8::CpuProfile* p3 = cpu_profiler->StopProfiling(name3);
- CHECK_NE(NULL, p3);
+ CHECK(p3);
CHECK_EQ(2, iprofiler->GetProfilesCount());
CHECK_NE(p2, p3);
CHECK(FindCpuProfile(cpu_profiler, p3));
v8::CpuProfile* profile = cpu_profiler->StopProfiling(profile_name);
- CHECK_NE(NULL, profile);
+ CHECK(profile);
// Dump collected profile to have a better diagnostic in case of failure.
reinterpret_cast<i::CpuProfile*>(profile)->Print();
// Check that there are no duplicates.
for (int j = 0; j < count; j++) {
if (j == i) continue;
- CHECK_NE(name, node->GetChild(j)->GetFunctionName());
+ CHECK(!name->Equals(node->GetChild(j)->GetFunctionName()));
}
}
}
uint64_t current_time = profile->GetStartTime();
CHECK_LE(current_time, end_time);
for (int i = 0; i < profile->GetSamplesCount(); i++) {
- CHECK_NE(NULL, profile->GetSample(i));
+ CHECK(profile->GetSample(i));
uint64_t timestamp = profile->GetSampleTimestamp(i);
CHECK_LE(current_time, timestamp);
CHECK_LE(timestamp, end_time);
i::Handle<i::JSFunction> func = v8::Utils::OpenHandle(
*v8::Local<v8::Function>::Cast((*env)->Global()->Get(v8_str(func_name))));
- CHECK_NE(NULL, func->shared());
- CHECK_NE(NULL, func->shared()->code());
+ CHECK(func->shared());
+ CHECK(func->shared()->code());
i::Code* code = NULL;
if (func->code()->is_optimized_code()) {
code = func->code();
CHECK(func->shared()->code() == func->code() || !i::FLAG_crankshaft);
code = func->shared()->code();
}
- CHECK_NE(NULL, code);
+ CHECK(code);
i::Address code_address = code->instruction_start();
- CHECK_NE(NULL, code_address);
+ CHECK(code_address);
CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate->heap());
profiles->StartProfiling("", false);
processor->StopSynchronously();
CpuProfile* profile = profiles->StopProfiling("");
- CHECK_NE(NULL, profile);
+ CHECK(profile);
// Check the state of profile generator.
CodeEntry* func_entry = generator.code_map()->FindEntry(code_address);
- CHECK_NE(NULL, func_entry);
+ CHECK(func_entry);
CHECK_EQ(func_name, func_entry->name());
const i::JITLineInfoTable* line_info = func_entry->line_info();
- CHECK_NE(NULL, line_info);
+ CHECK(line_info);
CHECK(!line_info->empty());
// Check the hit source lines using V8 Public APIs.
const i::ProfileTree* tree = profile->top_down();
ProfileNode* root = tree->root();
- CHECK_NE(NULL, root);
+ CHECK(root);
ProfileNode* func_node = root->FindChild(func_entry);
- CHECK_NE(NULL, func_node);
+ CHECK(func_node);
// Add 10 faked ticks to source line #5.
int hit_line = 5;
for (int i = 0; i < hit_count; i++) func_node->IncrementLineTicks(hit_line);
unsigned int line_count = func_node->GetHitLineCount();
- CHECK_EQ(2, line_count); // Expect two hit source lines - #1 and #5.
+ CHECK_EQ(2u, line_count); // Expect two hit source lines - #1 and #5.
ScopedVector<v8::CpuProfileNode::LineTick> entries(line_count);
CHECK(func_node->GetLineTicks(&entries[0], line_count));
int value = 0;
v8::String::NewFromUtf8(env->GetIsolate(), "my_profile");
function->Call(env->Global(), 0, NULL);
v8::CpuProfile* profile = cpu_profiler->StopProfiling(profile_name);
- CHECK_NE(NULL, profile);
+ CHECK(profile);
// Dump collected profile to have a better diagnostic in case of failure.
reinterpret_cast<i::CpuProfile*>(profile)->Print();
v8::CpuProfile* profile = cpu_profiler->StopProfiling(profile_name);
- CHECK_NE(NULL, profile);
+ CHECK(profile);
// Dump collected profile to have a better diagnostic in case of failure.
reinterpret_cast<i::CpuProfile*>(profile)->Print();
const v8::CpuProfileNode* programNode =
GetChild(env->GetIsolate(), root, ProfileGenerator::kProgramEntryName);
CHECK_EQ(0, programNode->GetChildrenCount());
- CHECK_GE(programNode->GetHitCount(), 3);
+ CHECK_GE(programNode->GetHitCount(), 3u);
const v8::CpuProfileNode* idleNode =
GetChild(env->GetIsolate(), root, ProfileGenerator::kIdleEntryName);
CHECK_EQ(0, idleNode->GetChildrenCount());
- CHECK_GE(idleNode->GetHitCount(), 3);
+ CHECK_GE(idleNode->GetHitCount(), 3u);
profile->Delete();
}
const v8::CpuProfileNode* node,
const char* name, const char* script_name,
int script_id, int line, int column) {
- CHECK_EQ(v8::String::NewFromUtf8(isolate, name),
- node->GetFunctionName());
- CHECK_EQ(v8::String::NewFromUtf8(isolate, script_name),
- node->GetScriptResourceName());
+ CHECK(
+ v8::String::NewFromUtf8(isolate, name)->Equals(node->GetFunctionName()));
+ CHECK(v8::String::NewFromUtf8(isolate, script_name)
+ ->Equals(node->GetScriptResourceName()));
CHECK_EQ(script_id, node->GetScriptId());
CHECK_EQ(line, node->GetLineNumber());
CHECK_EQ(column, node->GetColumnNumber());
// Check that the debugger context is cleared and that there is no debug
// information stored for the debugger.
CHECK(CcTest::i_isolate()->debug()->debug_context().is_null());
- CHECK_EQ(NULL, CcTest::i_isolate()->debug()->debug_info_list_);
+ CHECK(!CcTest::i_isolate()->debug()->debug_info_list_);
// Collect garbage to ensure weak handles are cleared.
CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags);
// Call f and check that the script break point.
f->Call(env->Global(), 0, NULL);
CHECK_EQ(2, break_point_hit_count);
- CHECK_EQ("f", last_function_hit);
+ CHECK_EQ(0, strcmp("f", last_function_hit));
// Call g and check that the script break point.
g->Call(env->Global(), 0, NULL);
CHECK_EQ(3, break_point_hit_count);
- CHECK_EQ("g", last_function_hit);
+ CHECK_EQ(0, strcmp("g", last_function_hit));
// Clear the script break point on g and set one on h.
ClearBreakPointFromJS(env->GetIsolate(), sbp3);
// Call g and check that the script break point in h is hit.
g->Call(env->Global(), 0, NULL);
CHECK_EQ(4, break_point_hit_count);
- CHECK_EQ("h", last_function_hit);
+ CHECK_EQ(0, strcmp("h", last_function_hit));
// Clear break points in f and h. Set a new one in the script between
// functions f and g and test that there is no break points in f and g any
}
// One break for each function called.
- CHECK_EQ(4 * arraysize(argv), break_point_hit_count);
+ CHECK(4 * arraysize(argv) == break_point_hit_count);
// Get rid of the debug event listener.
v8::Debug::SetDebugEventListener(NULL);
// Calling a function through the debugger returns 0 frames if there are
// no JavaScript frames.
- CHECK_EQ(v8::Integer::New(isolate, 0),
- v8::Debug::Call(frame_count));
+ CHECK(v8::Integer::New(isolate, 0)->Equals(v8::Debug::Call(frame_count)));
// Test that the number of frames can be retrieved.
v8::Script::Compile(
f->Call(env->Global(), 0, NULL);
CHECK_EQ(1, break_point_hit_count);
- CHECK_EQ("name", last_script_name_hit);
+ CHECK_EQ(0, strcmp("name", last_script_name_hit));
// Compile the same script again without setting data. As the compilation
// cache is disabled when debugging expect the data to be missing.
env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "f")));
f->Call(env->Global(), 0, NULL);
CHECK_EQ(2, break_point_hit_count);
- CHECK_EQ("name", last_script_name_hit);
+ CHECK_EQ(0, strcmp("name", last_script_name_hit));
v8::Local<v8::String> data_obj_source = v8::String::NewFromUtf8(
env->GetIsolate(),
env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "f")));
f->Call(env->Global(), 0, NULL);
CHECK_EQ(3, break_point_hit_count);
- CHECK_EQ("new name", last_script_name_hit);
+ CHECK_EQ(0, strcmp("new name", last_script_name_hit));
v8::Handle<v8::Script> script3 = v8::Script::Compile(script, &origin2);
script3->Run();
// Check that there was only one break event. Matching RegExp should not
// cause Break events.
CHECK_EQ(1, break_point_hit_count);
- CHECK_EQ("f", last_function_hit);
+ CHECK_EQ(0, strcmp("f", last_function_hit));
}
#endif // V8_INTERPRETED_REGEXP
static v8::Handle<v8::Value> expected_callback_data;
static void DebugEventContextChecker(const v8::Debug::EventDetails& details) {
CHECK(details.GetEventContext() == expected_context);
- CHECK_EQ(expected_callback_data, details.GetCallbackData());
+ CHECK(expected_callback_data->Equals(details.GetCallbackData()));
}
v8::Local<v8::Value> result = ParserCacheCompileRun(source);
CHECK(result->IsString());
v8::String::Utf8Value utf8(result);
- CHECK_EQ("bar", *utf8);
+ CHECK_EQ(0, strcmp("bar", *utf8));
v8::Debug::SetDebugEventListener(NULL);
CheckDebuggerUnloaded();
if (expectations == EXPECT_RESULT) {
CHECK(!catcher.HasCaught());
if (!value.IsEmpty()) {
- CHECK_EQ(value, result);
+ CHECK(value->Equals(result));
}
} else {
CHECK(expectations == EXPECT_EXCEPTION);
CHECK(catcher.HasCaught());
if (!value.IsEmpty()) {
- CHECK_EQ(value, catcher.Exception());
+ CHECK(value->Equals(catcher.Exception()));
}
}
// Clean slate for the next test.
if (expectations == EXPECT_RESULT) {
CHECK(!catcher.HasCaught());
if (!value.IsEmpty()) {
- CHECK_EQ(value, result);
+ CHECK(value->Equals(result));
}
} else {
CHECK(expectations == EXPECT_EXCEPTION);
CHECK(catcher.HasCaught());
if (!value.IsEmpty()) {
- CHECK_EQ(value, catcher.Exception());
+ CHECK(value->Equals(catcher.Exception()));
}
}
}
v8::Handle<v8::Value> result = env->Global()->Get(v8_str("result"));
CHECK(result->IsString());
v8::String::Utf8Value utf8(result);
- CHECK_EQ("a+an X", *utf8);
+ CHECK_EQ(0, strcmp("a+an X", *utf8));
CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(i_isolate));
}
isolate->Exit();
int sign;
DoubleToAscii(0.0, DTOA_SHORTEST, 0, buffer, &sign, &length, &point);
- CHECK_EQ("0", buffer.start());
+ CHECK_EQ(0, strcmp("0", buffer.start()));
CHECK_EQ(1, point);
DoubleToAscii(0.0, DTOA_FIXED, 2, buffer, &sign, &length, &point);
CHECK_EQ(1, length);
- CHECK_EQ("0", buffer.start());
+ CHECK_EQ(0, strcmp("0", buffer.start()));
CHECK_EQ(1, point);
DoubleToAscii(0.0, DTOA_PRECISION, 3, buffer, &sign, &length, &point);
CHECK_EQ(1, length);
- CHECK_EQ("0", buffer.start());
+ CHECK_EQ(0, strcmp("0", buffer.start()));
CHECK_EQ(1, point);
DoubleToAscii(1.0, DTOA_SHORTEST, 0, buffer, &sign, &length, &point);
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(1, point);
DoubleToAscii(1.0, DTOA_FIXED, 3, buffer, &sign, &length, &point);
CHECK_GE(3, length - point);
TrimRepresentation(buffer);
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(1, point);
DoubleToAscii(1.0, DTOA_PRECISION, 3, buffer, &sign, &length, &point);
CHECK_GE(3, length);
TrimRepresentation(buffer);
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(1, point);
DoubleToAscii(1.5, DTOA_SHORTEST, 0, buffer, &sign, &length, &point);
- CHECK_EQ("15", buffer.start());
+ CHECK_EQ(0, strcmp("15", buffer.start()));
CHECK_EQ(1, point);
DoubleToAscii(1.5, DTOA_FIXED, 10, buffer, &sign, &length, &point);
CHECK_GE(10, length - point);
TrimRepresentation(buffer);
- CHECK_EQ("15", buffer.start());
+ CHECK_EQ(0, strcmp("15", buffer.start()));
CHECK_EQ(1, point);
DoubleToAscii(1.5, DTOA_PRECISION, 10, buffer, &sign, &length, &point);
CHECK_GE(10, length);
TrimRepresentation(buffer);
- CHECK_EQ("15", buffer.start());
+ CHECK_EQ(0, strcmp("15", buffer.start()));
CHECK_EQ(1, point);
double min_double = 5e-324;
DoubleToAscii(min_double, DTOA_SHORTEST, 0, buffer, &sign, &length, &point);
- CHECK_EQ("5", buffer.start());
+ CHECK_EQ(0, strcmp("5", buffer.start()));
CHECK_EQ(-323, point);
DoubleToAscii(min_double, DTOA_FIXED, 5, buffer, &sign, &length, &point);
CHECK_GE(5, length - point);
TrimRepresentation(buffer);
- CHECK_EQ("", buffer.start());
+ CHECK_EQ(0, strcmp("", buffer.start()));
CHECK_GE(-5, point);
DoubleToAscii(min_double, DTOA_PRECISION, 5, buffer, &sign, &length, &point);
CHECK_GE(5, length);
TrimRepresentation(buffer);
- CHECK_EQ("49407", buffer.start());
+ CHECK_EQ(0, strcmp("49407", buffer.start()));
CHECK_EQ(-323, point);
double max_double = 1.7976931348623157e308;
DoubleToAscii(max_double, DTOA_SHORTEST, 0, buffer, &sign, &length, &point);
- CHECK_EQ("17976931348623157", buffer.start());
+ CHECK_EQ(0, strcmp("17976931348623157", buffer.start()));
CHECK_EQ(309, point);
DoubleToAscii(max_double, DTOA_PRECISION, 7, buffer, &sign, &length, &point);
CHECK_GE(7, length);
TrimRepresentation(buffer);
- CHECK_EQ("1797693", buffer.start());
+ CHECK_EQ(0, strcmp("1797693", buffer.start()));
CHECK_EQ(309, point);
DoubleToAscii(4294967272.0, DTOA_SHORTEST, 0, buffer, &sign, &length, &point);
- CHECK_EQ("4294967272", buffer.start());
+ CHECK_EQ(0, strcmp("4294967272", buffer.start()));
CHECK_EQ(10, point);
DoubleToAscii(4294967272.0, DTOA_FIXED, 5, buffer, &sign, &length, &point);
CHECK_GE(5, length - point);
TrimRepresentation(buffer);
- CHECK_EQ("4294967272", buffer.start());
+ CHECK_EQ(0, strcmp("4294967272", buffer.start()));
CHECK_EQ(10, point);
buffer, &sign, &length, &point);
CHECK_GE(14, length);
TrimRepresentation(buffer);
- CHECK_EQ("4294967272", buffer.start());
+ CHECK_EQ(0, strcmp("4294967272", buffer.start()));
CHECK_EQ(10, point);
DoubleToAscii(4.1855804968213567e298, DTOA_SHORTEST, 0,
buffer, &sign, &length, &point);
- CHECK_EQ("4185580496821357", buffer.start());
+ CHECK_EQ(0, strcmp("4185580496821357", buffer.start()));
CHECK_EQ(299, point);
DoubleToAscii(4.1855804968213567e298, DTOA_PRECISION, 20,
buffer, &sign, &length, &point);
CHECK_GE(20, length);
TrimRepresentation(buffer);
- CHECK_EQ("41855804968213567225", buffer.start());
+ CHECK_EQ(0, strcmp("41855804968213567225", buffer.start()));
CHECK_EQ(299, point);
DoubleToAscii(5.5626846462680035e-309, DTOA_SHORTEST, 0,
buffer, &sign, &length, &point);
- CHECK_EQ("5562684646268003", buffer.start());
+ CHECK_EQ(0, strcmp("5562684646268003", buffer.start()));
CHECK_EQ(-308, point);
DoubleToAscii(5.5626846462680035e-309, DTOA_PRECISION, 1,
buffer, &sign, &length, &point);
CHECK_GE(1, length);
TrimRepresentation(buffer);
- CHECK_EQ("6", buffer.start());
+ CHECK_EQ(0, strcmp("6", buffer.start()));
CHECK_EQ(-308, point);
DoubleToAscii(-2147483648.0, DTOA_SHORTEST, 0,
buffer, &sign, &length, &point);
CHECK_EQ(1, sign);
- CHECK_EQ("2147483648", buffer.start());
+ CHECK_EQ(0, strcmp("2147483648", buffer.start()));
CHECK_EQ(10, point);
CHECK_GE(2, length - point);
TrimRepresentation(buffer);
CHECK_EQ(1, sign);
- CHECK_EQ("2147483648", buffer.start());
+ CHECK_EQ(0, strcmp("2147483648", buffer.start()));
CHECK_EQ(10, point);
DoubleToAscii(-2147483648.0, DTOA_PRECISION, 5,
CHECK_GE(5, length);
TrimRepresentation(buffer);
CHECK_EQ(1, sign);
- CHECK_EQ("21475", buffer.start());
+ CHECK_EQ(0, strcmp("21475", buffer.start()));
CHECK_EQ(10, point);
DoubleToAscii(-3.5844466002796428e+298, DTOA_SHORTEST, 0,
buffer, &sign, &length, &point);
CHECK_EQ(1, sign);
- CHECK_EQ("35844466002796428", buffer.start());
+ CHECK_EQ(0, strcmp("35844466002796428", buffer.start()));
CHECK_EQ(299, point);
DoubleToAscii(-3.5844466002796428e+298, DTOA_PRECISION, 10,
CHECK_EQ(1, sign);
CHECK_GE(10, length);
TrimRepresentation(buffer);
- CHECK_EQ("35844466", buffer.start());
+ CHECK_EQ(0, strcmp("35844466", buffer.start()));
CHECK_EQ(299, point);
uint64_t smallest_normal64 = V8_2PART_UINT64_C(0x00100000, 00000000);
double v = Double(smallest_normal64).value();
DoubleToAscii(v, DTOA_SHORTEST, 0, buffer, &sign, &length, &point);
- CHECK_EQ("22250738585072014", buffer.start());
+ CHECK_EQ(0, strcmp("22250738585072014", buffer.start()));
CHECK_EQ(-307, point);
DoubleToAscii(v, DTOA_PRECISION, 20, buffer, &sign, &length, &point);
CHECK_GE(20, length);
TrimRepresentation(buffer);
- CHECK_EQ("22250738585072013831", buffer.start());
+ CHECK_EQ(0, strcmp("22250738585072013831", buffer.start()));
CHECK_EQ(-307, point);
uint64_t largest_denormal64 = V8_2PART_UINT64_C(0x000FFFFF, FFFFFFFF);
v = Double(largest_denormal64).value();
DoubleToAscii(v, DTOA_SHORTEST, 0, buffer, &sign, &length, &point);
- CHECK_EQ("2225073858507201", buffer.start());
+ CHECK_EQ(0, strcmp("2225073858507201", buffer.start()));
CHECK_EQ(-307, point);
DoubleToAscii(v, DTOA_PRECISION, 20, buffer, &sign, &length, &point);
CHECK_GE(20, length);
TrimRepresentation(buffer);
- CHECK_EQ("2225073858507200889", buffer.start());
+ CHECK_EQ(0, strcmp("2225073858507200889", buffer.start()));
CHECK_EQ(-307, point);
DoubleToAscii(4128420500802942e-24, DTOA_SHORTEST, 0,
buffer, &sign, &length, &point);
CHECK_EQ(0, sign);
- CHECK_EQ("4128420500802942", buffer.start());
+ CHECK_EQ(0, strcmp("4128420500802942", buffer.start()));
CHECK_EQ(-8, point);
v = -3.9292015898194142585311918e-10;
DoubleToAscii(v, DTOA_SHORTEST, 0, buffer, &sign, &length, &point);
- CHECK_EQ("39292015898194143", buffer.start());
+ CHECK_EQ(0, strcmp("39292015898194143", buffer.start()));
v = 4194304.0;
DoubleToAscii(v, DTOA_FIXED, 5, buffer, &sign, &length, &point);
CHECK_GE(5, length - point);
TrimRepresentation(buffer);
- CHECK_EQ("4194304", buffer.start());
+ CHECK_EQ(0, strcmp("4194304", buffer.start()));
v = 3.3161339052167390562200598e-237;
DoubleToAscii(v, DTOA_PRECISION, 19, buffer, &sign, &length, &point);
CHECK_GE(19, length);
TrimRepresentation(buffer);
- CHECK_EQ("3316133905216739056", buffer.start());
+ CHECK_EQ(0, strcmp("3316133905216739056", buffer.start()));
CHECK_EQ(-236, point);
}
DoubleToAscii(v, DTOA_SHORTEST, 0, buffer, &sign, &length, &point);
CHECK_EQ(0, sign); // All precomputed numbers are positive.
CHECK_EQ(current_test.decimal_point, point);
- CHECK_EQ(current_test.representation, buffer.start());
+ CHECK_EQ(0, strcmp(current_test.representation, buffer.start()));
}
}
CHECK_EQ(current_test.decimal_point, point);
CHECK_GE(number_digits, length - point);
TrimRepresentation(buffer);
- CHECK_EQ(current_test.representation, buffer.start());
+ CHECK_EQ(0, strcmp(current_test.representation, buffer.start()));
}
}
CHECK_EQ(current_test.decimal_point, point);
CHECK_GE(number_digits, length);
TrimRepresentation(buffer);
- CHECK_EQ(current_test.representation, buffer.start());
+ CHECK_EQ(0, strcmp(current_test.representation, buffer.start()));
}
}
status = FastDtoa(min_double, FAST_DTOA_SHORTEST, 0,
buffer, &length, &point);
CHECK(status);
- CHECK_EQ("5", buffer.start());
+ CHECK_EQ(0, strcmp("5", buffer.start()));
CHECK_EQ(-323, point);
double max_double = 1.7976931348623157e308;
status = FastDtoa(max_double, FAST_DTOA_SHORTEST, 0,
buffer, &length, &point);
CHECK(status);
- CHECK_EQ("17976931348623157", buffer.start());
+ CHECK_EQ(0, strcmp("17976931348623157", buffer.start()));
CHECK_EQ(309, point);
status = FastDtoa(4294967272.0, FAST_DTOA_SHORTEST, 0,
buffer, &length, &point);
CHECK(status);
- CHECK_EQ("4294967272", buffer.start());
+ CHECK_EQ(0, strcmp("4294967272", buffer.start()));
CHECK_EQ(10, point);
status = FastDtoa(4.1855804968213567e298, FAST_DTOA_SHORTEST, 0,
buffer, &length, &point);
CHECK(status);
- CHECK_EQ("4185580496821357", buffer.start());
+ CHECK_EQ(0, strcmp("4185580496821357", buffer.start()));
CHECK_EQ(299, point);
status = FastDtoa(5.5626846462680035e-309, FAST_DTOA_SHORTEST, 0,
buffer, &length, &point);
CHECK(status);
- CHECK_EQ("5562684646268003", buffer.start());
+ CHECK_EQ(0, strcmp("5562684646268003", buffer.start()));
CHECK_EQ(-308, point);
status = FastDtoa(2147483648.0, FAST_DTOA_SHORTEST, 0,
buffer, &length, &point);
CHECK(status);
- CHECK_EQ("2147483648", buffer.start());
+ CHECK_EQ(0, strcmp("2147483648", buffer.start()));
CHECK_EQ(10, point);
status = FastDtoa(3.5844466002796428e+298, FAST_DTOA_SHORTEST, 0,
buffer, &length, &point);
if (status) { // Not all FastDtoa variants manage to compute this number.
- CHECK_EQ("35844466002796428", buffer.start());
+ CHECK_EQ(0, strcmp("35844466002796428", buffer.start()));
CHECK_EQ(299, point);
}
double v = Double(smallest_normal64).value();
status = FastDtoa(v, FAST_DTOA_SHORTEST, 0, buffer, &length, &point);
if (status) {
- CHECK_EQ("22250738585072014", buffer.start());
+ CHECK_EQ(0, strcmp("22250738585072014", buffer.start()));
CHECK_EQ(-307, point);
}
v = Double(largest_denormal64).value();
status = FastDtoa(v, FAST_DTOA_SHORTEST, 0, buffer, &length, &point);
if (status) {
- CHECK_EQ("2225073858507201", buffer.start());
+ CHECK_EQ(0, strcmp("2225073858507201", buffer.start()));
CHECK_EQ(-307, point);
}
}
CHECK(status);
CHECK_GE(3, length);
TrimRepresentation(buffer);
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(1, point);
status = FastDtoa(1.5, FAST_DTOA_PRECISION, 10, buffer, &length, &point);
if (status) {
CHECK_GE(10, length);
TrimRepresentation(buffer);
- CHECK_EQ("15", buffer.start());
+ CHECK_EQ(0, strcmp("15", buffer.start()));
CHECK_EQ(1, point);
}
status = FastDtoa(min_double, FAST_DTOA_PRECISION, 5,
buffer, &length, &point);
CHECK(status);
- CHECK_EQ("49407", buffer.start());
+ CHECK_EQ(0, strcmp("49407", buffer.start()));
CHECK_EQ(-323, point);
double max_double = 1.7976931348623157e308;
status = FastDtoa(max_double, FAST_DTOA_PRECISION, 7,
buffer, &length, &point);
CHECK(status);
- CHECK_EQ("1797693", buffer.start());
+ CHECK_EQ(0, strcmp("1797693", buffer.start()));
CHECK_EQ(309, point);
status = FastDtoa(4294967272.0, FAST_DTOA_PRECISION, 14,
if (status) {
CHECK_GE(14, length);
TrimRepresentation(buffer);
- CHECK_EQ("4294967272", buffer.start());
+ CHECK_EQ(0, strcmp("4294967272", buffer.start()));
CHECK_EQ(10, point);
}
status = FastDtoa(4.1855804968213567e298, FAST_DTOA_PRECISION, 17,
buffer, &length, &point);
CHECK(status);
- CHECK_EQ("41855804968213567", buffer.start());
+ CHECK_EQ(0, strcmp("41855804968213567", buffer.start()));
CHECK_EQ(299, point);
status = FastDtoa(5.5626846462680035e-309, FAST_DTOA_PRECISION, 1,
buffer, &length, &point);
CHECK(status);
- CHECK_EQ("6", buffer.start());
+ CHECK_EQ(0, strcmp("6", buffer.start()));
CHECK_EQ(-308, point);
status = FastDtoa(2147483648.0, FAST_DTOA_PRECISION, 5,
buffer, &length, &point);
CHECK(status);
- CHECK_EQ("21475", buffer.start());
+ CHECK_EQ(0, strcmp("21475", buffer.start()));
CHECK_EQ(10, point);
status = FastDtoa(3.5844466002796428e+298, FAST_DTOA_PRECISION, 10,
CHECK(status);
CHECK_GE(10, length);
TrimRepresentation(buffer);
- CHECK_EQ("35844466", buffer.start());
+ CHECK_EQ(0, strcmp("35844466", buffer.start()));
CHECK_EQ(299, point);
uint64_t smallest_normal64 = V8_2PART_UINT64_C(0x00100000, 00000000);
double v = Double(smallest_normal64).value();
status = FastDtoa(v, FAST_DTOA_PRECISION, 17, buffer, &length, &point);
CHECK(status);
- CHECK_EQ("22250738585072014", buffer.start());
+ CHECK_EQ(0, strcmp("22250738585072014", buffer.start()));
CHECK_EQ(-307, point);
uint64_t largest_denormal64 = V8_2PART_UINT64_C(0x000FFFFF, FFFFFFFF);
CHECK(status);
CHECK_GE(20, length);
TrimRepresentation(buffer);
- CHECK_EQ("22250738585072009", buffer.start());
+ CHECK_EQ(0, strcmp("22250738585072009", buffer.start()));
CHECK_EQ(-307, point);
v = 3.3161339052167390562200598e-237;
status = FastDtoa(v, FAST_DTOA_PRECISION, 18, buffer, &length, &point);
CHECK(status);
- CHECK_EQ("331613390521673906", buffer.start());
+ CHECK_EQ(0, strcmp("331613390521673906", buffer.start()));
CHECK_EQ(-236, point);
v = 7.9885183916008099497815232e+191;
status = FastDtoa(v, FAST_DTOA_PRECISION, 4, buffer, &length, &point);
CHECK(status);
- CHECK_EQ("7989", buffer.start());
+ CHECK_EQ(0, strcmp("7989", buffer.start()));
CHECK_EQ(192, point);
}
if (length == kFastDtoaMaximalLength) needed_max_length = true;
succeeded++;
CHECK_EQ(current_test.decimal_point, point);
- CHECK_EQ(current_test.representation, buffer.start());
+ CHECK_EQ(0, strcmp(current_test.representation, buffer.start()));
}
CHECK_GT(succeeded*1.0/total, 0.99);
CHECK(needed_max_length);
if (number_digits <= 15) succeeded_15++;
TrimRepresentation(buffer);
CHECK_EQ(current_test.decimal_point, point);
- CHECK_EQ(current_test.representation, buffer.start());
+ CHECK_EQ(0, strcmp(current_test.representation, buffer.start()));
}
// The precomputed numbers contain many entries with many requested
// digits. These have a high failure rate and we therefore expect a lower
CallICNexus nexus(feedback_vector, slot);
CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback());
// CallIC doesn't return map feedback.
- CHECK_EQ(NULL, nexus.FindFirstMap());
+ CHECK(!nexus.FindFirstMap());
CompileRun("f(function() { return 16; })");
CHECK_EQ(GENERIC, nexus.StateFromFeedback());
// Finally driven megamorphic.
CompileRun("f({ blarg: 3, gran: 3, torino: 10, foo: 2 })");
CHECK_EQ(MEGAMORPHIC, nexus.StateFromFeedback());
- CHECK_EQ(NULL, nexus.FindFirstMap());
+ CHECK(!nexus.FindFirstMap());
// After a collection, state should not be reset to PREMONOMORPHIC.
heap->CollectAllGarbage(i::Heap::kNoGCFlags);
int point;
CHECK(FastFixedDtoa(1.0, 1, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(1, point);
CHECK(FastFixedDtoa(1.0, 15, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(1, point);
CHECK(FastFixedDtoa(1.0, 0, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(1, point);
CHECK(FastFixedDtoa(0xFFFFFFFF, 5, buffer, &length, &point));
- CHECK_EQ("4294967295", buffer.start());
+ CHECK_EQ(0, strcmp("4294967295", buffer.start()));
CHECK_EQ(10, point);
CHECK(FastFixedDtoa(4294967296.0, 5, buffer, &length, &point));
- CHECK_EQ("4294967296", buffer.start());
+ CHECK_EQ(0, strcmp("4294967296", buffer.start()));
CHECK_EQ(10, point);
CHECK(FastFixedDtoa(1e21, 5, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
// CHECK_EQ(22, point);
CHECK_EQ(22, point);
CHECK(FastFixedDtoa(999999999999999868928.00, 2, buffer, &length, &point));
- CHECK_EQ("999999999999999868928", buffer.start());
+ CHECK_EQ(0, strcmp("999999999999999868928", buffer.start()));
CHECK_EQ(21, point);
CHECK(FastFixedDtoa(6.9999999999999989514240000e+21, 5, buffer,
&length, &point));
- CHECK_EQ("6999999999999998951424", buffer.start());
+ CHECK_EQ(0, strcmp("6999999999999998951424", buffer.start()));
CHECK_EQ(22, point);
CHECK(FastFixedDtoa(1.5, 5, buffer, &length, &point));
- CHECK_EQ("15", buffer.start());
+ CHECK_EQ(0, strcmp("15", buffer.start()));
CHECK_EQ(1, point);
CHECK(FastFixedDtoa(1.55, 5, buffer, &length, &point));
- CHECK_EQ("155", buffer.start());
+ CHECK_EQ(0, strcmp("155", buffer.start()));
CHECK_EQ(1, point);
CHECK(FastFixedDtoa(1.55, 1, buffer, &length, &point));
- CHECK_EQ("16", buffer.start());
+ CHECK_EQ(0, strcmp("16", buffer.start()));
CHECK_EQ(1, point);
CHECK(FastFixedDtoa(1.00000001, 15, buffer, &length, &point));
- CHECK_EQ("100000001", buffer.start());
+ CHECK_EQ(0, strcmp("100000001", buffer.start()));
CHECK_EQ(1, point);
CHECK(FastFixedDtoa(0.1, 10, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(0, point);
CHECK(FastFixedDtoa(0.01, 10, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(-1, point);
CHECK(FastFixedDtoa(0.001, 10, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(-2, point);
CHECK(FastFixedDtoa(0.0001, 10, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(-3, point);
CHECK(FastFixedDtoa(0.00001, 10, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(-4, point);
CHECK(FastFixedDtoa(0.000001, 10, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(-5, point);
CHECK(FastFixedDtoa(0.0000001, 10, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(-6, point);
CHECK(FastFixedDtoa(0.00000001, 10, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(-7, point);
CHECK(FastFixedDtoa(0.000000001, 10, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(-8, point);
CHECK(FastFixedDtoa(0.0000000001, 15, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(-9, point);
CHECK(FastFixedDtoa(0.00000000001, 15, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(-10, point);
CHECK(FastFixedDtoa(0.000000000001, 15, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(-11, point);
CHECK(FastFixedDtoa(0.0000000000001, 15, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(-12, point);
CHECK(FastFixedDtoa(0.00000000000001, 15, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(-13, point);
CHECK(FastFixedDtoa(0.000000000000001, 20, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(-14, point);
CHECK(FastFixedDtoa(0.0000000000000001, 20, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(-15, point);
CHECK(FastFixedDtoa(0.00000000000000001, 20, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(-16, point);
CHECK(FastFixedDtoa(0.000000000000000001, 20, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(-17, point);
CHECK(FastFixedDtoa(0.0000000000000000001, 20, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(-18, point);
CHECK(FastFixedDtoa(0.00000000000000000001, 20, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(-19, point);
CHECK(FastFixedDtoa(0.10000000004, 10, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(0, point);
CHECK(FastFixedDtoa(0.01000000004, 10, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(-1, point);
CHECK(FastFixedDtoa(0.00100000004, 10, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(-2, point);
CHECK(FastFixedDtoa(0.00010000004, 10, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(-3, point);
CHECK(FastFixedDtoa(0.00001000004, 10, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(-4, point);
CHECK(FastFixedDtoa(0.00000100004, 10, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(-5, point);
CHECK(FastFixedDtoa(0.00000010004, 10, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(-6, point);
CHECK(FastFixedDtoa(0.00000001004, 10, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(-7, point);
CHECK(FastFixedDtoa(0.00000000104, 10, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(-8, point);
CHECK(FastFixedDtoa(0.0000000001000004, 15, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(-9, point);
CHECK(FastFixedDtoa(0.0000000000100004, 15, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(-10, point);
CHECK(FastFixedDtoa(0.0000000000010004, 15, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(-11, point);
CHECK(FastFixedDtoa(0.0000000000001004, 15, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(-12, point);
CHECK(FastFixedDtoa(0.0000000000000104, 15, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(-13, point);
CHECK(FastFixedDtoa(0.000000000000001000004, 20, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(-14, point);
CHECK(FastFixedDtoa(0.000000000000000100004, 20, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(-15, point);
CHECK(FastFixedDtoa(0.000000000000000010004, 20, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(-16, point);
CHECK(FastFixedDtoa(0.000000000000000001004, 20, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(-17, point);
CHECK(FastFixedDtoa(0.000000000000000000104, 20, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(-18, point);
CHECK(FastFixedDtoa(0.000000000000000000014, 20, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(-19, point);
CHECK(FastFixedDtoa(0.10000000006, 10, buffer, &length, &point));
- CHECK_EQ("1000000001", buffer.start());
+ CHECK_EQ(0, strcmp("1000000001", buffer.start()));
CHECK_EQ(0, point);
CHECK(FastFixedDtoa(0.01000000006, 10, buffer, &length, &point));
- CHECK_EQ("100000001", buffer.start());
+ CHECK_EQ(0, strcmp("100000001", buffer.start()));
CHECK_EQ(-1, point);
CHECK(FastFixedDtoa(0.00100000006, 10, buffer, &length, &point));
- CHECK_EQ("10000001", buffer.start());
+ CHECK_EQ(0, strcmp("10000001", buffer.start()));
CHECK_EQ(-2, point);
CHECK(FastFixedDtoa(0.00010000006, 10, buffer, &length, &point));
- CHECK_EQ("1000001", buffer.start());
+ CHECK_EQ(0, strcmp("1000001", buffer.start()));
CHECK_EQ(-3, point);
CHECK(FastFixedDtoa(0.00001000006, 10, buffer, &length, &point));
- CHECK_EQ("100001", buffer.start());
+ CHECK_EQ(0, strcmp("100001", buffer.start()));
CHECK_EQ(-4, point);
CHECK(FastFixedDtoa(0.00000100006, 10, buffer, &length, &point));
- CHECK_EQ("10001", buffer.start());
+ CHECK_EQ(0, strcmp("10001", buffer.start()));
CHECK_EQ(-5, point);
CHECK(FastFixedDtoa(0.00000010006, 10, buffer, &length, &point));
- CHECK_EQ("1001", buffer.start());
+ CHECK_EQ(0, strcmp("1001", buffer.start()));
CHECK_EQ(-6, point);
CHECK(FastFixedDtoa(0.00000001006, 10, buffer, &length, &point));
- CHECK_EQ("101", buffer.start());
+ CHECK_EQ(0, strcmp("101", buffer.start()));
CHECK_EQ(-7, point);
CHECK(FastFixedDtoa(0.00000000106, 10, buffer, &length, &point));
- CHECK_EQ("11", buffer.start());
+ CHECK_EQ(0, strcmp("11", buffer.start()));
CHECK_EQ(-8, point);
CHECK(FastFixedDtoa(0.0000000001000006, 15, buffer, &length, &point));
- CHECK_EQ("100001", buffer.start());
+ CHECK_EQ(0, strcmp("100001", buffer.start()));
CHECK_EQ(-9, point);
CHECK(FastFixedDtoa(0.0000000000100006, 15, buffer, &length, &point));
- CHECK_EQ("10001", buffer.start());
+ CHECK_EQ(0, strcmp("10001", buffer.start()));
CHECK_EQ(-10, point);
CHECK(FastFixedDtoa(0.0000000000010006, 15, buffer, &length, &point));
- CHECK_EQ("1001", buffer.start());
+ CHECK_EQ(0, strcmp("1001", buffer.start()));
CHECK_EQ(-11, point);
CHECK(FastFixedDtoa(0.0000000000001006, 15, buffer, &length, &point));
- CHECK_EQ("101", buffer.start());
+ CHECK_EQ(0, strcmp("101", buffer.start()));
CHECK_EQ(-12, point);
CHECK(FastFixedDtoa(0.0000000000000106, 15, buffer, &length, &point));
- CHECK_EQ("11", buffer.start());
+ CHECK_EQ(0, strcmp("11", buffer.start()));
CHECK_EQ(-13, point);
CHECK(FastFixedDtoa(0.000000000000001000006, 20, buffer, &length, &point));
- CHECK_EQ("100001", buffer.start());
+ CHECK_EQ(0, strcmp("100001", buffer.start()));
CHECK_EQ(-14, point);
CHECK(FastFixedDtoa(0.000000000000000100006, 20, buffer, &length, &point));
- CHECK_EQ("10001", buffer.start());
+ CHECK_EQ(0, strcmp("10001", buffer.start()));
CHECK_EQ(-15, point);
CHECK(FastFixedDtoa(0.000000000000000010006, 20, buffer, &length, &point));
- CHECK_EQ("1001", buffer.start());
+ CHECK_EQ(0, strcmp("1001", buffer.start()));
CHECK_EQ(-16, point);
CHECK(FastFixedDtoa(0.000000000000000001006, 20, buffer, &length, &point));
- CHECK_EQ("101", buffer.start());
+ CHECK_EQ(0, strcmp("101", buffer.start()));
CHECK_EQ(-17, point);
CHECK(FastFixedDtoa(0.000000000000000000106, 20, buffer, &length, &point));
- CHECK_EQ("11", buffer.start());
+ CHECK_EQ(0, strcmp("11", buffer.start()));
CHECK_EQ(-18, point);
CHECK(FastFixedDtoa(0.000000000000000000016, 20, buffer, &length, &point));
- CHECK_EQ("2", buffer.start());
+ CHECK_EQ(0, strcmp("2", buffer.start()));
CHECK_EQ(-19, point);
CHECK(FastFixedDtoa(0.6, 0, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(1, point);
CHECK(FastFixedDtoa(0.96, 1, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(1, point);
CHECK(FastFixedDtoa(0.996, 2, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(1, point);
CHECK(FastFixedDtoa(0.9996, 3, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(1, point);
CHECK(FastFixedDtoa(0.99996, 4, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(1, point);
CHECK(FastFixedDtoa(0.999996, 5, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(1, point);
CHECK(FastFixedDtoa(0.9999996, 6, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(1, point);
CHECK(FastFixedDtoa(0.99999996, 7, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(1, point);
CHECK(FastFixedDtoa(0.999999996, 8, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(1, point);
CHECK(FastFixedDtoa(0.9999999996, 9, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(1, point);
CHECK(FastFixedDtoa(0.99999999996, 10, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(1, point);
CHECK(FastFixedDtoa(0.999999999996, 11, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(1, point);
CHECK(FastFixedDtoa(0.9999999999996, 12, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(1, point);
CHECK(FastFixedDtoa(0.99999999999996, 13, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(1, point);
CHECK(FastFixedDtoa(0.999999999999996, 14, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(1, point);
CHECK(FastFixedDtoa(0.9999999999999996, 15, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(1, point);
CHECK(FastFixedDtoa(0.00999999999999996, 16, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(-1, point);
CHECK(FastFixedDtoa(0.000999999999999996, 17, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(-2, point);
CHECK(FastFixedDtoa(0.0000999999999999996, 18, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(-3, point);
CHECK(FastFixedDtoa(0.00000999999999999996, 19, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(-4, point);
CHECK(FastFixedDtoa(0.000000999999999999996, 20, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(-5, point);
CHECK(FastFixedDtoa(323423.234234, 10, buffer, &length, &point));
- CHECK_EQ("323423234234", buffer.start());
+ CHECK_EQ(0, strcmp("323423234234", buffer.start()));
CHECK_EQ(6, point);
CHECK(FastFixedDtoa(12345678.901234, 4, buffer, &length, &point));
- CHECK_EQ("123456789012", buffer.start());
+ CHECK_EQ(0, strcmp("123456789012", buffer.start()));
CHECK_EQ(8, point);
CHECK(FastFixedDtoa(98765.432109, 5, buffer, &length, &point));
- CHECK_EQ("9876543211", buffer.start());
+ CHECK_EQ(0, strcmp("9876543211", buffer.start()));
CHECK_EQ(5, point);
CHECK(FastFixedDtoa(42, 20, buffer, &length, &point));
- CHECK_EQ("42", buffer.start());
+ CHECK_EQ(0, strcmp("42", buffer.start()));
CHECK_EQ(2, point);
CHECK(FastFixedDtoa(0.5, 0, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(1, point);
CHECK(FastFixedDtoa(1e-23, 10, buffer, &length, &point));
- CHECK_EQ("", buffer.start());
+ CHECK_EQ(0, strcmp("", buffer.start()));
CHECK_EQ(-10, point);
CHECK(FastFixedDtoa(1e-123, 2, buffer, &length, &point));
- CHECK_EQ("", buffer.start());
+ CHECK_EQ(0, strcmp("", buffer.start()));
CHECK_EQ(-2, point);
CHECK(FastFixedDtoa(1e-123, 0, buffer, &length, &point));
- CHECK_EQ("", buffer.start());
+ CHECK_EQ(0, strcmp("", buffer.start()));
CHECK_EQ(0, point);
CHECK(FastFixedDtoa(1e-23, 20, buffer, &length, &point));
- CHECK_EQ("", buffer.start());
+ CHECK_EQ(0, strcmp("", buffer.start()));
CHECK_EQ(-20, point);
CHECK(FastFixedDtoa(1e-21, 20, buffer, &length, &point));
- CHECK_EQ("", buffer.start());
+ CHECK_EQ(0, strcmp("", buffer.start()));
CHECK_EQ(-20, point);
CHECK(FastFixedDtoa(1e-22, 20, buffer, &length, &point));
- CHECK_EQ("", buffer.start());
+ CHECK_EQ(0, strcmp("", buffer.start()));
CHECK_EQ(-20, point);
CHECK(FastFixedDtoa(6e-21, 20, buffer, &length, &point));
- CHECK_EQ("1", buffer.start());
+ CHECK_EQ(0, strcmp("1", buffer.start()));
CHECK_EQ(-19, point);
CHECK(FastFixedDtoa(9.1193616301674545152000000e+19, 0,
buffer, &length, &point));
- CHECK_EQ("91193616301674545152", buffer.start());
+ CHECK_EQ(0, strcmp("91193616301674545152", buffer.start()));
CHECK_EQ(20, point);
CHECK(FastFixedDtoa(4.8184662102767651659096515e-04, 19,
buffer, &length, &point));
- CHECK_EQ("4818466210276765", buffer.start());
+ CHECK_EQ(0, strcmp("4818466210276765", buffer.start()));
CHECK_EQ(-3, point);
CHECK(FastFixedDtoa(1.9023164229540652612705182e-23, 8,
buffer, &length, &point));
- CHECK_EQ("", buffer.start());
+ CHECK_EQ(0, strcmp("", buffer.start()));
CHECK_EQ(-8, point);
CHECK(FastFixedDtoa(1000000000000000128.0, 0,
buffer, &length, &point));
- CHECK_EQ("1000000000000000128", buffer.start());
+ CHECK_EQ(0, strcmp("1000000000000000128", buffer.start()));
CHECK_EQ(19, point);
}
CHECK(status);
CHECK_EQ(current_test.decimal_point, point);
CHECK_GE(number_digits, length - point);
- CHECK_EQ(current_test.representation, buffer.start());
+ CHECK_EQ(0, strcmp(current_test.representation, buffer.start()));
}
}
CHECK_EQ(2, FlagList::SetFlagsFromCommandLine(&argc,
const_cast<char **>(argv),
true));
- CHECK_NE(NULL, argv[1]);
+ CHECK(argv[1]);
CHECK_EQ(argc, 2);
}
// Verify inferred function name.
SmartArrayPointer<char> inferred_name =
shared_func_info->inferred_name()->ToCString();
- CHECK_EQ(ref_inferred_name, inferred_name.get());
+ CHECK_EQ(0, strcmp(ref_inferred_name, inferred_name.get()));
}
script->Run();
CHECK(try_catch.HasCaught());
v8::String::Utf8Value exception(try_catch.Exception());
- CHECK_EQ("ReferenceError: x is not defined", *exception);
+ CHECK_EQ(0, strcmp("ReferenceError: x is not defined", *exception));
}
void TestSet(IntKeyHash hash, int size) {
IntSet set(hash);
- CHECK_EQ(0, set.occupancy());
+ CHECK_EQ(0u, set.occupancy());
set.Insert(1);
set.Insert(2);
set.Insert(3);
- CHECK_EQ(3, set.occupancy());
+ CHECK_EQ(3u, set.occupancy());
set.Insert(2);
set.Insert(3);
- CHECK_EQ(3, set.occupancy());
+ CHECK_EQ(3u, set.occupancy());
CHECK(set.Present(1));
CHECK(set.Present(2));
CHECK(set.Present(3));
CHECK(!set.Present(4));
- CHECK_EQ(3, set.occupancy());
+ CHECK_EQ(3u, set.occupancy());
set.Remove(1);
CHECK(!set.Present(1));
CHECK(set.Present(2));
CHECK(set.Present(3));
- CHECK_EQ(2, set.occupancy());
+ CHECK_EQ(2u, set.occupancy());
set.Remove(3);
CHECK(!set.Present(1));
CHECK(set.Present(2));
CHECK(!set.Present(3));
- CHECK_EQ(1, set.occupancy());
+ CHECK_EQ(1u, set.occupancy());
set.Clear();
- CHECK_EQ(0, set.occupancy());
+ CHECK_EQ(0u, set.occupancy());
// Insert a long series of values.
const int start = 453;
y = y * factor + offset;
}
}
- CHECK_EQ(0, set.occupancy());
+ CHECK_EQ(0u, set.occupancy());
}
// Verify, that JS global object of env2 has '..2' properties.
const v8::HeapGraphNode* a2_node =
GetProperty(global_env2, v8::HeapGraphEdge::kProperty, "a2");
- CHECK_NE(NULL, a2_node);
- CHECK_NE(
- NULL, GetProperty(global_env2, v8::HeapGraphEdge::kProperty, "b2_1"));
- CHECK_NE(
- NULL, GetProperty(global_env2, v8::HeapGraphEdge::kProperty, "b2_2"));
- CHECK_NE(NULL, GetProperty(global_env2, v8::HeapGraphEdge::kProperty, "c2"));
+ CHECK(a2_node);
+ CHECK(GetProperty(global_env2, v8::HeapGraphEdge::kProperty, "b2_1"));
+ CHECK(GetProperty(global_env2, v8::HeapGraphEdge::kProperty, "b2_2"));
+ CHECK(GetProperty(global_env2, v8::HeapGraphEdge::kProperty, "c2"));
NamedEntriesDetector det;
det.CheckAllReachables(const_cast<i::HeapEntry*>(
const v8::HeapGraphNode* global = GetGlobalObject(snapshot);
const v8::HeapGraphNode* x =
GetProperty(global, v8::HeapGraphEdge::kProperty, "x");
- CHECK_NE(NULL, x);
+ CHECK(x);
const v8::HeapGraphNode* x1 =
GetProperty(x, v8::HeapGraphEdge::kProperty, "a");
- CHECK_NE(NULL, x1);
+ CHECK(x1);
const v8::HeapGraphNode* x2 =
GetProperty(x, v8::HeapGraphEdge::kProperty, "b");
- CHECK_NE(NULL, x2);
+ CHECK(x2);
// Test sizes.
CHECK_NE(0, static_cast<int>(x->GetShallowSize()));
const v8::HeapGraphNode* f =
GetProperty(global, v8::HeapGraphEdge::kProperty, "boundFunction");
CHECK(f);
- CHECK_EQ(v8::String::NewFromUtf8(env->GetIsolate(), "native_bind"),
- f->GetName());
+ CHECK(v8::String::NewFromUtf8(env->GetIsolate(), "native_bind")
+ ->Equals(f->GetName()));
const v8::HeapGraphNode* bindings =
GetProperty(f, v8::HeapGraphEdge::kInternal, "bindings");
- CHECK_NE(NULL, bindings);
+ CHECK(bindings);
CHECK_EQ(v8::HeapGraphNode::kArray, bindings->GetType());
CHECK_EQ(3, bindings->GetChildrenCount());
}
const v8::HeapGraphNode* a =
GetProperty(global, v8::HeapGraphEdge::kProperty, "a");
- CHECK_NE(NULL, a);
+ CHECK(a);
for (int i = 0, count = a->GetChildrenCount(); i < count; ++i) {
const v8::HeapGraphEdge* prop = a->GetChild(i);
CHECK_EQ(a, prop->GetFromNode());
const v8::HeapGraphNode* global = GetGlobalObject(snapshot);
const v8::HeapGraphNode* compiled =
GetProperty(global, v8::HeapGraphEdge::kProperty, "compiled");
- CHECK_NE(NULL, compiled);
+ CHECK(compiled);
CHECK_EQ(v8::HeapGraphNode::kClosure, compiled->GetType());
const v8::HeapGraphNode* lazy =
GetProperty(global, v8::HeapGraphEdge::kProperty, "lazy");
- CHECK_NE(NULL, lazy);
+ CHECK(lazy);
CHECK_EQ(v8::HeapGraphNode::kClosure, lazy->GetType());
const v8::HeapGraphNode* anonymous =
GetProperty(global, v8::HeapGraphEdge::kProperty, "anonymous");
- CHECK_NE(NULL, anonymous);
+ CHECK(anonymous);
CHECK_EQ(v8::HeapGraphNode::kClosure, anonymous->GetType());
v8::String::Utf8Value anonymous_name(anonymous->GetName());
- CHECK_EQ("", *anonymous_name);
+ CHECK_EQ(0, strcmp("", *anonymous_name));
// Find references to code.
const v8::HeapGraphNode* compiled_code =
GetProperty(compiled, v8::HeapGraphEdge::kInternal, "shared");
- CHECK_NE(NULL, compiled_code);
+ CHECK(compiled_code);
const v8::HeapGraphNode* lazy_code =
GetProperty(lazy, v8::HeapGraphEdge::kInternal, "shared");
- CHECK_NE(NULL, lazy_code);
+ CHECK(lazy_code);
// Check that there's no strong next_code_link. There might be a weak one
// but might be not, so we can't check that fact.
const v8::HeapGraphNode* code =
GetProperty(compiled_code, v8::HeapGraphEdge::kInternal, "code");
- CHECK_NE(NULL, code);
+ CHECK(code);
const v8::HeapGraphNode* next_code_link =
GetProperty(code, v8::HeapGraphEdge::kInternal, "code");
- CHECK_EQ(NULL, next_code_link);
+ CHECK(!next_code_link);
// Verify that non-compiled code doesn't contain references to "x"
// literal, while compiled code does. The scope info is stored in FixedArray
heap_profiler->TakeHeapSnapshot(v8_str("numbers"));
CHECK(ValidateSnapshot(snapshot));
const v8::HeapGraphNode* global = GetGlobalObject(snapshot);
- CHECK_EQ(NULL, GetProperty(global, v8::HeapGraphEdge::kProperty, "a"));
+ CHECK(!GetProperty(global, v8::HeapGraphEdge::kProperty, "a"));
const v8::HeapGraphNode* b =
GetProperty(global, v8::HeapGraphEdge::kProperty, "b");
- CHECK_NE(NULL, b);
+ CHECK(b);
CHECK_EQ(v8::HeapGraphNode::kHeapNumber, b->GetType());
}
const v8::HeapGraphNode* global = GetGlobalObject(snapshot);
const v8::HeapGraphNode* parent_string =
GetProperty(global, v8::HeapGraphEdge::kProperty, "parent_string");
- CHECK_NE(NULL, parent_string);
+ CHECK(parent_string);
const v8::HeapGraphNode* child_string =
GetProperty(global, v8::HeapGraphEdge::kProperty, "child_string");
- CHECK_NE(NULL, child_string);
+ CHECK(child_string);
CHECK_EQ(v8::HeapGraphNode::kSlicedString, child_string->GetType());
const v8::HeapGraphNode* parent =
GetProperty(child_string, v8::HeapGraphEdge::kInternal, "parent");
const v8::HeapGraphNode* string_node =
GetProperty(global_node, v8::HeapGraphEdge::kInternal, "0");
- CHECK_NE(NULL, string_node);
+ CHECK(string_node);
CHECK_EQ(v8::HeapGraphNode::kConsString, string_node->GetType());
const v8::HeapGraphNode* first_node =
const v8::HeapGraphNode* global = GetGlobalObject(snapshot);
const v8::HeapGraphNode* a =
GetProperty(global, v8::HeapGraphEdge::kProperty, "a");
- CHECK_NE(NULL, a);
+ CHECK(a);
CHECK_EQ(a->GetType(), v8::HeapGraphNode::kSymbol);
- CHECK_EQ(v8_str("symbol"), a->GetName());
+ CHECK(v8_str("symbol")->Equals(a->GetName()));
const v8::HeapGraphNode* name =
GetProperty(a, v8::HeapGraphEdge::kInternal, "name");
- CHECK_NE(NULL, name);
- CHECK_EQ(v8_str("mySymbol"), name->GetName());
+ CHECK(name);
+ CHECK(v8_str("mySymbol")->Equals(name->GetName()));
}
const v8::HeapGraphNode* global = GetGlobalObject(snapshot);
const v8::HeapGraphNode* k =
GetProperty(global, v8::HeapGraphEdge::kProperty, "k");
- CHECK_NE(NULL, k);
+ CHECK(k);
const v8::HeapGraphNode* v =
GetProperty(global, v8::HeapGraphEdge::kProperty, "v");
- CHECK_NE(NULL, v);
+ CHECK(v);
const v8::HeapGraphNode* s =
GetProperty(global, v8::HeapGraphEdge::kProperty, "s");
- CHECK_NE(NULL, s);
+ CHECK(s);
const v8::HeapGraphNode* ws =
GetProperty(global, v8::HeapGraphEdge::kProperty, "ws");
- CHECK_NE(NULL, ws);
+ CHECK(ws);
CHECK_EQ(v8::HeapGraphNode::kObject, ws->GetType());
- CHECK_EQ(v8_str("WeakSet"), ws->GetName());
+ CHECK(v8_str("WeakSet")->Equals(ws->GetName()));
const v8::HeapGraphNode* ws_table =
GetProperty(ws, v8::HeapGraphEdge::kInternal, "table");
CHECK_EQ(1, weak_entries);
const v8::HeapGraphNode* ws_s =
GetProperty(ws, v8::HeapGraphEdge::kProperty, "str");
- CHECK_NE(NULL, ws_s);
- CHECK_EQ(static_cast<int>(s->GetId()), static_cast<int>(ws_s->GetId()));
+ CHECK(ws_s);
+ CHECK_EQ(s->GetId(), ws_s->GetId());
const v8::HeapGraphNode* wm =
GetProperty(global, v8::HeapGraphEdge::kProperty, "wm");
- CHECK_NE(NULL, wm);
+ CHECK(wm);
CHECK_EQ(v8::HeapGraphNode::kObject, wm->GetType());
- CHECK_EQ(v8_str("WeakMap"), wm->GetName());
+ CHECK(v8_str("WeakMap")->Equals(wm->GetName()));
const v8::HeapGraphNode* wm_table =
GetProperty(wm, v8::HeapGraphEdge::kInternal, "table");
CHECK_EQ(2, weak_entries);
const v8::HeapGraphNode* wm_s =
GetProperty(wm, v8::HeapGraphEdge::kProperty, "str");
- CHECK_NE(NULL, wm_s);
- CHECK_EQ(static_cast<int>(s->GetId()), static_cast<int>(wm_s->GetId()));
+ CHECK(wm_s);
+ CHECK_EQ(s->GetId(), wm_s->GetId());
}
const v8::HeapGraphNode* global = GetGlobalObject(snapshot);
const v8::HeapGraphNode* k =
GetProperty(global, v8::HeapGraphEdge::kProperty, "k");
- CHECK_NE(NULL, k);
+ CHECK(k);
const v8::HeapGraphNode* v =
GetProperty(global, v8::HeapGraphEdge::kProperty, "v");
- CHECK_NE(NULL, v);
+ CHECK(v);
const v8::HeapGraphNode* s =
GetProperty(global, v8::HeapGraphEdge::kProperty, "s");
- CHECK_NE(NULL, s);
+ CHECK(s);
const v8::HeapGraphNode* set =
GetProperty(global, v8::HeapGraphEdge::kProperty, "set");
- CHECK_NE(NULL, set);
+ CHECK(set);
CHECK_EQ(v8::HeapGraphNode::kObject, set->GetType());
- CHECK_EQ(v8_str("Set"), set->GetName());
+ CHECK(v8_str("Set")->Equals(set->GetName()));
const v8::HeapGraphNode* set_table =
GetProperty(set, v8::HeapGraphEdge::kInternal, "table");
CHECK_EQ(2, entries);
const v8::HeapGraphNode* set_s =
GetProperty(set, v8::HeapGraphEdge::kProperty, "str");
- CHECK_NE(NULL, set_s);
- CHECK_EQ(static_cast<int>(s->GetId()), static_cast<int>(set_s->GetId()));
+ CHECK(set_s);
+ CHECK_EQ(s->GetId(), set_s->GetId());
const v8::HeapGraphNode* map =
GetProperty(global, v8::HeapGraphEdge::kProperty, "map");
- CHECK_NE(NULL, map);
+ CHECK(map);
CHECK_EQ(v8::HeapGraphNode::kObject, map->GetType());
- CHECK_EQ(v8_str("Map"), map->GetName());
+ CHECK(v8_str("Map")->Equals(map->GetName()));
const v8::HeapGraphNode* map_table =
GetProperty(map, v8::HeapGraphEdge::kInternal, "table");
CHECK_EQ(2, entries);
const v8::HeapGraphNode* map_s =
GetProperty(map, v8::HeapGraphEdge::kProperty, "str");
- CHECK_NE(NULL, map_s);
- CHECK_EQ(static_cast<int>(s->GetId()), static_cast<int>(map_s->GetId()));
+ CHECK(map_s);
+ CHECK_EQ(s->GetId(), map_s->GetId());
}
CHECK(ValidateSnapshot(snapshot));
const v8::HeapGraphNode* global_node = GetGlobalObject(snapshot);
// The first reference will not present, because it's a Smi.
- CHECK_EQ(NULL, GetProperty(global_node, v8::HeapGraphEdge::kInternal, "0"));
+ CHECK(!GetProperty(global_node, v8::HeapGraphEdge::kInternal, "0"));
// The second reference is to an object.
- CHECK_NE(NULL, GetProperty(global_node, v8::HeapGraphEdge::kInternal, "1"));
+ CHECK(GetProperty(global_node, v8::HeapGraphEdge::kInternal, "1"));
}
-// Trying to introduce a check helper for uint32_t causes many
-// overloading ambiguities, so it seems easier just to cast
-// them to a signed type.
-#define CHECK_EQ_SNAPSHOT_OBJECT_ID(a, b) \
- CHECK_EQ(static_cast<int32_t>(a), static_cast<int32_t>(b))
-#define CHECK_NE_SNAPSHOT_OBJECT_ID(a, b) \
- CHECK((a) != (b)) // NOLINT
-
TEST(HeapSnapshotAddressReuse) {
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
const v8::HeapGraphNode* array_node =
GetProperty(global2, v8::HeapGraphEdge::kProperty, "a");
- CHECK_NE(NULL, array_node);
+ CHECK(array_node);
int wrong_count = 0;
for (int i = 0, count = array_node->GetChildrenCount(); i < count; ++i) {
const v8::HeapGraphEdge* prop = array_node->GetChild(i);
const v8::HeapGraphNode* global1 = GetGlobalObject(snapshot1);
const v8::HeapGraphNode* global2 = GetGlobalObject(snapshot2);
- CHECK_NE_SNAPSHOT_OBJECT_ID(0, global1->GetId());
- CHECK_EQ_SNAPSHOT_OBJECT_ID(global1->GetId(), global2->GetId());
+ CHECK_NE(0u, global1->GetId());
+ CHECK_EQ(global1->GetId(), global2->GetId());
const v8::HeapGraphNode* a1 =
GetProperty(global1, v8::HeapGraphEdge::kProperty, "a");
- CHECK_NE(NULL, a1);
+ CHECK(a1);
const v8::HeapGraphNode* k1 =
GetProperty(a1, v8::HeapGraphEdge::kInternal, "elements");
- CHECK_NE(NULL, k1);
+ CHECK(k1);
const v8::HeapGraphNode* a2 =
GetProperty(global2, v8::HeapGraphEdge::kProperty, "a");
- CHECK_NE(NULL, a2);
+ CHECK(a2);
const v8::HeapGraphNode* k2 =
GetProperty(a2, v8::HeapGraphEdge::kInternal, "elements");
- CHECK_NE(NULL, k2);
+ CHECK(k2);
- CHECK_EQ_SNAPSHOT_OBJECT_ID(a1->GetId(), a2->GetId());
- CHECK_EQ_SNAPSHOT_OBJECT_ID(k1->GetId(), k2->GetId());
+ CHECK_EQ(a1->GetId(), a2->GetId());
+ CHECK_EQ(k1->GetId(), k2->GetId());
}
heap_profiler->TakeHeapSnapshot(s2_str);
CHECK(ValidateSnapshot(snapshot2));
- CHECK_GT(snapshot1->GetMaxSnapshotJSObjectId(), 7000);
+ CHECK_GT(snapshot1->GetMaxSnapshotJSObjectId(), 7000u);
CHECK(snapshot1->GetMaxSnapshotJSObjectId() <=
snapshot2->GetMaxSnapshotJSObjectId());
const v8::HeapGraphNode* global1 = GetGlobalObject(snapshot1);
const v8::HeapGraphNode* global2 = GetGlobalObject(snapshot2);
- CHECK_NE_SNAPSHOT_OBJECT_ID(0, global1->GetId());
- CHECK_EQ_SNAPSHOT_OBJECT_ID(global1->GetId(), global2->GetId());
+ CHECK_NE(0u, global1->GetId());
+ CHECK_EQ(global1->GetId(), global2->GetId());
const v8::HeapGraphNode* A1 =
GetProperty(global1, v8::HeapGraphEdge::kProperty, "A");
- CHECK_NE(NULL, A1);
+ CHECK(A1);
const v8::HeapGraphNode* A2 =
GetProperty(global2, v8::HeapGraphEdge::kProperty, "A");
- CHECK_NE(NULL, A2);
- CHECK_NE_SNAPSHOT_OBJECT_ID(0, A1->GetId());
- CHECK_EQ_SNAPSHOT_OBJECT_ID(A1->GetId(), A2->GetId());
+ CHECK(A2);
+ CHECK_NE(0u, A1->GetId());
+ CHECK_EQ(A1->GetId(), A2->GetId());
const v8::HeapGraphNode* B1 =
GetProperty(global1, v8::HeapGraphEdge::kProperty, "B");
- CHECK_NE(NULL, B1);
+ CHECK(B1);
const v8::HeapGraphNode* B2 =
GetProperty(global2, v8::HeapGraphEdge::kProperty, "B");
- CHECK_NE(NULL, B2);
- CHECK_NE_SNAPSHOT_OBJECT_ID(0, B1->GetId());
- CHECK_EQ_SNAPSHOT_OBJECT_ID(B1->GetId(), B2->GetId());
+ CHECK(B2);
+ CHECK_NE(0u, B1->GetId());
+ CHECK_EQ(B1->GetId(), B2->GetId());
const v8::HeapGraphNode* a1 =
GetProperty(global1, v8::HeapGraphEdge::kProperty, "a");
- CHECK_NE(NULL, a1);
+ CHECK(a1);
const v8::HeapGraphNode* a2 =
GetProperty(global2, v8::HeapGraphEdge::kProperty, "a");
- CHECK_NE(NULL, a2);
- CHECK_NE_SNAPSHOT_OBJECT_ID(0, a1->GetId());
- CHECK_EQ_SNAPSHOT_OBJECT_ID(a1->GetId(), a2->GetId());
+ CHECK(a2);
+ CHECK_NE(0u, a1->GetId());
+ CHECK_EQ(a1->GetId(), a2->GetId());
const v8::HeapGraphNode* b1 =
GetProperty(global1, v8::HeapGraphEdge::kProperty, "b");
- CHECK_NE(NULL, b1);
+ CHECK(b1);
const v8::HeapGraphNode* b2 =
GetProperty(global2, v8::HeapGraphEdge::kProperty, "b");
- CHECK_NE(NULL, b2);
- CHECK_NE_SNAPSHOT_OBJECT_ID(0, b1->GetId());
- CHECK_EQ_SNAPSHOT_OBJECT_ID(b1->GetId(), b2->GetId());
+ CHECK(b2);
+ CHECK_NE(0u, b1->GetId());
+ CHECK_EQ(b1->GetId(), b2->GetId());
}
v8::Local<v8::String> ref_string =
CompileRun(STRING_LITERAL_FOR_TEST)->ToString(isolate);
#undef STRING_LITERAL_FOR_TEST
- CHECK_EQ(*v8::String::Utf8Value(ref_string),
- *v8::String::Utf8Value(string));
+ CHECK_EQ(0, strcmp(*v8::String::Utf8Value(ref_string),
+ *v8::String::Utf8Value(string)));
}
&initial_id);
CHECK_EQ(1, stats_update.intervals_count());
CHECK_EQ(1, stats_update.updates_written());
- CHECK_LT(0, stats_update.entries_size());
+ CHECK_LT(0u, stats_update.entries_size());
CHECK_EQ(0, stats_update.first_interval_index());
}
// No data expected in update because nothing has happened.
v8::SnapshotObjectId same_id;
CHECK_EQ(0, GetHeapStatsUpdate(heap_profiler, &same_id).updates_written());
- CHECK_EQ_SNAPSHOT_OBJECT_ID(initial_id, same_id);
+ CHECK_EQ(initial_id, same_id);
{
v8::SnapshotObjectId additional_string_id;
CHECK_LT(same_id, additional_string_id);
CHECK_EQ(1, stats_update.intervals_count());
CHECK_EQ(1, stats_update.updates_written());
- CHECK_LT(0, stats_update.entries_size());
- CHECK_EQ(1, stats_update.entries_count());
+ CHECK_LT(0u, stats_update.entries_size());
+ CHECK_EQ(1u, stats_update.entries_count());
CHECK_EQ(2, stats_update.first_interval_index());
}
// No data expected in update because nothing happened.
v8::SnapshotObjectId last_id;
CHECK_EQ(0, GetHeapStatsUpdate(heap_profiler, &last_id).updates_written());
- CHECK_EQ_SNAPSHOT_OBJECT_ID(additional_string_id, last_id);
+ CHECK_EQ(additional_string_id, last_id);
{
v8::HandleScope inner_scope_2(env->GetIsolate());
TestStatsStream stats_update = GetHeapStatsUpdate(heap_profiler);
CHECK_EQ(1, stats_update.intervals_count());
CHECK_EQ(1, stats_update.updates_written());
- CHECK_LT(0, entries_size = stats_update.entries_size());
- CHECK_EQ(3, stats_update.entries_count());
+ CHECK_LT(0u, entries_size = stats_update.entries_size());
+ CHECK_EQ(3u, stats_update.entries_count());
CHECK_EQ(4, stats_update.first_interval_index());
}
}
CHECK_EQ(1, stats_update.intervals_count());
CHECK_EQ(1, stats_update.updates_written());
CHECK_GT(entries_size, stats_update.entries_size());
- CHECK_EQ(1, stats_update.entries_count());
+ CHECK_EQ(1u, stats_update.entries_count());
// Two strings from forth interval were released.
CHECK_EQ(4, stats_update.first_interval_index());
}
TestStatsStream stats_update = GetHeapStatsUpdate(heap_profiler);
CHECK_EQ(1, stats_update.intervals_count());
CHECK_EQ(1, stats_update.updates_written());
- CHECK_EQ(0, stats_update.entries_size());
- CHECK_EQ(0, stats_update.entries_count());
+ CHECK_EQ(0u, stats_update.entries_size());
+ CHECK_EQ(0u, stats_update.entries_count());
// The last string from forth interval was released.
CHECK_EQ(4, stats_update.first_interval_index());
}
TestStatsStream stats_update = GetHeapStatsUpdate(heap_profiler);
CHECK_EQ(1, stats_update.intervals_count());
CHECK_EQ(1, stats_update.updates_written());
- CHECK_EQ(0, stats_update.entries_size());
- CHECK_EQ(0, stats_update.entries_count());
+ CHECK_EQ(0u, stats_update.entries_size());
+ CHECK_EQ(0u, stats_update.entries_count());
// The only string from the second interval was released.
CHECK_EQ(2, stats_update.first_interval_index());
}
v8::Local<v8::Array> array = v8::Array::New(env->GetIsolate());
- CHECK_EQ(0, array->Length());
+ CHECK_EQ(0u, array->Length());
// Force array's buffer allocation.
array->Set(2, v8_num(7));
TestStatsStream stats_update = GetHeapStatsUpdate(heap_profiler);
CHECK_EQ(1, stats_update.intervals_count());
CHECK_EQ(1, stats_update.updates_written());
- CHECK_LT(0, entries_size = stats_update.entries_size());
+ CHECK_LT(0u, entries_size = stats_update.entries_size());
// They are the array and its buffer.
- CHECK_EQ(2, stats_update.entries_count());
+ CHECK_EQ(2u, stats_update.entries_count());
CHECK_EQ(8, stats_update.first_interval_index());
}
// The second interval was changed because new buffer was allocated.
CHECK_EQ(2, stats_update.updates_written());
CHECK_LT(entries_size, stats_update.entries_size());
- CHECK_EQ(2, stats_update.entries_count());
+ CHECK_EQ(2u, stats_update.entries_count());
CHECK_EQ(8, stats_update.first_interval_index());
}
for (int i = 0; i < kLength; i++) {
v8::SnapshotObjectId id = heap_profiler->GetObjectId(objects[i]);
- CHECK_NE(v8::HeapProfiler::kUnknownObjectId, static_cast<int>(id));
+ CHECK_NE(v8::HeapProfiler::kUnknownObjectId, id);
ids[i] = id;
}
for (int i = 0; i < kLength; i++) {
v8::SnapshotObjectId id = heap_profiler->GetObjectId(objects[i]);
- CHECK_EQ(static_cast<int>(ids[i]), static_cast<int>(id));
+ CHECK_EQ(ids[i], id);
v8::Handle<v8::Value> obj = heap_profiler->FindObjectById(ids[i]);
- CHECK_EQ(objects[i], obj);
+ CHECK(objects[i]->Equals(obj));
}
heap_profiler->ClearObjectIds();
for (int i = 0; i < kLength; i++) {
v8::SnapshotObjectId id = heap_profiler->GetObjectId(objects[i]);
- CHECK_EQ(v8::HeapProfiler::kUnknownObjectId, static_cast<int>(id));
+ CHECK_EQ(v8::HeapProfiler::kUnknownObjectId, id);
v8::Handle<v8::Value> obj = heap_profiler->FindObjectById(ids[i]);
CHECK(obj.IsEmpty());
}
const v8::HeapGraphEdge* prop = node->GetChild(i);
const v8::HeapGraphNode* child =
snapshot->GetNodeById(prop->GetToNode()->GetId());
- CHECK_EQ_SNAPSHOT_OBJECT_ID(prop->GetToNode()->GetId(), child->GetId());
+ CHECK_EQ(prop->GetToNode()->GetId(), child->GetId());
CHECK_EQ(prop->GetToNode(), child);
CheckChildrenIds(snapshot, child, level + 1, max_level);
}
const v8::HeapGraphNode* root = snapshot->GetRoot();
CheckChildrenIds(snapshot, root, 0, 3);
// Check a big id, which should not exist yet.
- CHECK_EQ(NULL, snapshot->GetNodeById(0x1000000UL));
+ CHECK(!snapshot->GetNodeById(0x1000000UL));
}
CHECK(globalObjectHandle->IsObject());
v8::SnapshotObjectId id = heap_profiler->GetObjectId(globalObjectHandle);
- CHECK_NE(static_cast<int>(v8::HeapProfiler::kUnknownObjectId),
- id);
- CHECK_EQ(static_cast<int>(id), global_object->GetId());
+ CHECK_NE(v8::HeapProfiler::kUnknownObjectId, id);
+ CHECK_EQ(id, global_object->GetId());
}
CHECK(ValidateSnapshot(snapshot));
const v8::HeapGraphNode* node =
snapshot->GetNodeById(v8::HeapProfiler::kUnknownObjectId);
- CHECK_EQ(NULL, node);
+ CHECK(!node);
}
const v8::HeapSnapshot* no_snapshot =
heap_profiler->TakeHeapSnapshot(v8_str("abort"),
&aborting_control);
- CHECK_EQ(NULL, no_snapshot);
+ CHECK(!no_snapshot);
CHECK_EQ(snapshots_count, heap_profiler->GetSnapshotCount());
CHECK_GT(aborting_control.total(), aborting_control.done());
&control);
CHECK(ValidateSnapshot(snapshot));
- CHECK_NE(NULL, snapshot);
+ CHECK(snapshot);
CHECK_EQ(snapshots_count + 1, heap_profiler->GetSnapshotCount());
CHECK_EQ(control.total(), control.done());
CHECK_GT(control.total(), 0);
const v8::HeapGraphNode* native_group_aaa = GetNode(
snapshot->GetRoot(), v8::HeapGraphNode::kSynthetic, "aaa-group");
- CHECK_NE(NULL, native_group_aaa);
+ CHECK(native_group_aaa);
CHECK_EQ(1, native_group_aaa->GetChildrenCount());
const v8::HeapGraphNode* aaa = GetNode(
native_group_aaa, v8::HeapGraphNode::kNative, "aaa / 100 entries");
- CHECK_NE(NULL, aaa);
+ CHECK(aaa);
CHECK_EQ(2, aaa->GetChildrenCount());
const v8::HeapGraphNode* native_group_ccc = GetNode(
snapshot->GetRoot(), v8::HeapGraphNode::kSynthetic, "ccc-group");
const v8::HeapGraphNode* ccc = GetNode(
native_group_ccc, v8::HeapGraphNode::kNative, "ccc");
- CHECK_NE(NULL, ccc);
+ CHECK(ccc);
const v8::HeapGraphNode* n_AAA = GetNode(
aaa, v8::HeapGraphNode::kString, "AAA");
- CHECK_NE(NULL, n_AAA);
+ CHECK(n_AAA);
const v8::HeapGraphNode* n_BBB = GetNode(
aaa, v8::HeapGraphNode::kString, "BBB");
- CHECK_NE(NULL, n_BBB);
+ CHECK(n_BBB);
CHECK_EQ(1, ccc->GetChildrenCount());
const v8::HeapGraphNode* n_CCC = GetNode(
ccc, v8::HeapGraphNode::kString, "CCC");
- CHECK_NE(NULL, n_CCC);
+ CHECK(n_CCC);
CHECK_EQ(aaa, GetProperty(n_AAA, v8::HeapGraphEdge::kInternal, "native"));
CHECK_EQ(aaa, GetProperty(n_BBB, v8::HeapGraphEdge::kInternal, "native"));
public:
static const int kObjectsCount = 4;
explicit GraphWithImplicitRefs(LocalContext* env) {
- CHECK_EQ(NULL, instance_);
+ CHECK(!instance_);
instance_ = this;
isolate_ = (*env)->GetIsolate();
for (int i = 0; i < kObjectsCount; i++) {
CHECK_EQ(0, heap_profiler->GetSnapshotCount());
heap_profiler->DeleteAllHeapSnapshots();
CHECK_EQ(0, heap_profiler->GetSnapshotCount());
- CHECK_NE(NULL, heap_profiler->TakeHeapSnapshot(v8_str("1")));
+ CHECK(heap_profiler->TakeHeapSnapshot(v8_str("1")));
CHECK_EQ(1, heap_profiler->GetSnapshotCount());
heap_profiler->DeleteAllHeapSnapshots();
CHECK_EQ(0, heap_profiler->GetSnapshotCount());
- CHECK_NE(NULL, heap_profiler->TakeHeapSnapshot(v8_str("1")));
- CHECK_NE(NULL, heap_profiler->TakeHeapSnapshot(v8_str("2")));
+ CHECK(heap_profiler->TakeHeapSnapshot(v8_str("1")));
+ CHECK(heap_profiler->TakeHeapSnapshot(v8_str("2")));
CHECK_EQ(2, heap_profiler->GetSnapshotCount());
heap_profiler->DeleteAllHeapSnapshots();
CHECK_EQ(0, heap_profiler->GetSnapshotCount());
const v8::HeapSnapshot* s1 =
heap_profiler->TakeHeapSnapshot(v8_str("1"));
- CHECK_NE(NULL, s1);
+ CHECK(s1);
CHECK_EQ(1, heap_profiler->GetSnapshotCount());
unsigned uid1 = s1->GetUid();
CHECK_EQ(s1, FindHeapSnapshot(heap_profiler, uid1));
const_cast<v8::HeapSnapshot*>(s1)->Delete();
CHECK_EQ(0, heap_profiler->GetSnapshotCount());
- CHECK_EQ(NULL, FindHeapSnapshot(heap_profiler, uid1));
+ CHECK(!FindHeapSnapshot(heap_profiler, uid1));
const v8::HeapSnapshot* s2 =
heap_profiler->TakeHeapSnapshot(v8_str("2"));
- CHECK_NE(NULL, s2);
+ CHECK(s2);
CHECK_EQ(1, heap_profiler->GetSnapshotCount());
unsigned uid2 = s2->GetUid();
CHECK_NE(static_cast<int>(uid1), static_cast<int>(uid2));
CHECK_EQ(s2, FindHeapSnapshot(heap_profiler, uid2));
const v8::HeapSnapshot* s3 =
heap_profiler->TakeHeapSnapshot(v8_str("3"));
- CHECK_NE(NULL, s3);
+ CHECK(s3);
CHECK_EQ(2, heap_profiler->GetSnapshotCount());
unsigned uid3 = s3->GetUid();
CHECK_NE(static_cast<int>(uid1), static_cast<int>(uid3));
CHECK_EQ(s3, FindHeapSnapshot(heap_profiler, uid3));
const_cast<v8::HeapSnapshot*>(s2)->Delete();
CHECK_EQ(1, heap_profiler->GetSnapshotCount());
- CHECK_EQ(NULL, FindHeapSnapshot(heap_profiler, uid2));
+ CHECK(!FindHeapSnapshot(heap_profiler, uid2));
CHECK_EQ(s3, FindHeapSnapshot(heap_profiler, uid3));
const_cast<v8::HeapSnapshot*>(s3)->Delete();
CHECK_EQ(0, heap_profiler->GetSnapshotCount());
- CHECK_EQ(NULL, FindHeapSnapshot(heap_profiler, uid3));
+ CHECK(!FindHeapSnapshot(heap_profiler, uid3));
}
&name_resolver);
CHECK(ValidateSnapshot(snapshot));
const v8::HeapGraphNode* global = GetGlobalObject(snapshot);
- CHECK_NE(NULL, global);
- CHECK_EQ("Object / Global object name" ,
- const_cast<i::HeapEntry*>(
- reinterpret_cast<const i::HeapEntry*>(global))->name());
+ CHECK(global);
+ CHECK_EQ(0,
+ strcmp("Object / Global object name",
+ const_cast<i::HeapEntry*>(
+ reinterpret_cast<const i::HeapEntry*>(global))->name()));
}
const v8::HeapGraphNode* global = GetGlobalObject(snapshot);
const v8::HeapGraphNode* builtins =
GetProperty(global, v8::HeapGraphEdge::kInternal, "builtins");
- CHECK_NE(NULL, builtins);
+ CHECK(builtins);
const v8::HeapGraphNode* native_context =
GetProperty(global, v8::HeapGraphEdge::kInternal, "native_context");
- CHECK_NE(NULL, native_context);
+ CHECK(native_context);
const v8::HeapGraphNode* global_proxy =
GetProperty(global, v8::HeapGraphEdge::kInternal, "global_proxy");
- CHECK_NE(NULL, global_proxy);
+ CHECK(global_proxy);
}
heap_profiler->TakeHeapSnapshot(v8_str("iteration"));
CHECK(ValidateSnapshot(snapshot));
const v8::HeapGraphNode* global = GetGlobalObject(snapshot);
- CHECK_NE(NULL, global);
+ CHECK(global);
// Verify that we can find this object by iteration.
const int nodes_count = snapshot->GetNodesCount();
int count = 0;
CHECK(ValidateSnapshot(snapshot));
const v8::HeapGraphNode* global = GetGlobalObject(snapshot);
- CHECK_NE(NULL, global);
+ CHECK(global);
const v8::HeapGraphNode* obj1 =
GetProperty(global, v8::HeapGraphEdge::kProperty, "obj1");
- CHECK_NE(NULL, obj1);
+ CHECK(obj1);
const v8::HeapGraphNode* func;
func = GetProperty(obj1, v8::HeapGraphEdge::kProperty, "get propWithGetter");
- CHECK_NE(NULL, func);
+ CHECK(func);
func = GetProperty(obj1, v8::HeapGraphEdge::kProperty, "set propWithGetter");
- CHECK_EQ(NULL, func);
+ CHECK(!func);
func = GetProperty(obj1, v8::HeapGraphEdge::kProperty, "set propWithSetter");
- CHECK_NE(NULL, func);
+ CHECK(func);
func = GetProperty(obj1, v8::HeapGraphEdge::kProperty, "get propWithSetter");
- CHECK_EQ(NULL, func);
+ CHECK(!func);
}
heap_profiler->TakeHeapSnapshot(v8_str("fastCaseAccessors"));
CHECK(ValidateSnapshot(snapshot));
const v8::HeapGraphNode* global = GetGlobalObject(snapshot);
- CHECK_NE(NULL, global);
+ CHECK(global);
const v8::HeapGraphNode* obj1 =
GetProperty(global, v8::HeapGraphEdge::kProperty, "obj1");
- CHECK_NE(NULL, obj1);
+ CHECK(obj1);
const v8::HeapGraphNode* func;
func = GetProperty(obj1, v8::HeapGraphEdge::kProperty, "get prop");
- CHECK_NE(NULL, func);
+ CHECK(func);
func = GetProperty(obj1, v8::HeapGraphEdge::kProperty, "set prop");
- CHECK_NE(NULL, func);
+ CHECK(func);
}
CHECK(ValidateSnapshot(snapshot));
const v8::HeapGraphNode* global = GetGlobalObject(snapshot);
- CHECK_NE(NULL, global);
+ CHECK(global);
const v8::HeapGraphNode* obj1 =
GetProperty(global, v8::HeapGraphEdge::kProperty, "obj1");
- CHECK_NE(NULL, obj1);
+ CHECK(obj1);
const v8::HeapGraphNode* func;
func = GetProperty(obj1, v8::HeapGraphEdge::kProperty, "get propWithGetter");
- CHECK_NE(NULL, func);
+ CHECK(func);
func = GetProperty(obj1, v8::HeapGraphEdge::kProperty, "set propWithGetter");
- CHECK_EQ(NULL, func);
+ CHECK(!func);
func = GetProperty(obj1, v8::HeapGraphEdge::kProperty, "set propWithSetter");
- CHECK_NE(NULL, func);
+ CHECK(func);
func = GetProperty(obj1, v8::HeapGraphEdge::kProperty, "get propWithSetter");
- CHECK_EQ(NULL, func);
+ CHECK(!func);
}
const v8::HeapGraphNode* global = GetGlobalObject(snapshot);
const v8::HeapGraphNode* c =
GetProperty(global, v8::HeapGraphEdge::kProperty, "c");
- CHECK_NE(NULL, c);
+ CHECK(c);
const v8::HeapGraphNode* hidden_props =
GetProperty(c, v8::HeapGraphEdge::kInternal, "hidden_properties");
- CHECK_EQ(NULL, hidden_props);
+ CHECK(!hidden_props);
v8::Handle<v8::Value> cHandle =
env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "c"));
CHECK(ValidateSnapshot(snapshot));
global = GetGlobalObject(snapshot);
c = GetProperty(global, v8::HeapGraphEdge::kProperty, "c");
- CHECK_NE(NULL, c);
+ CHECK(c);
hidden_props = GetProperty(c, v8::HeapGraphEdge::kInternal,
"hidden_properties");
- CHECK_NE(NULL, hidden_props);
+ CHECK(hidden_props);
}
const v8::HeapGraphNode* global = GetGlobalObject(snapshot);
const v8::HeapGraphNode* foo =
GetProperty(global, v8::HeapGraphEdge::kProperty, "foo");
- CHECK_NE(NULL, foo);
+ CHECK(foo);
const v8::HeapGraphNode* map =
GetProperty(foo, v8::HeapGraphEdge::kInternal, "map");
- CHECK_NE(NULL, map);
+ CHECK(map);
const v8::HeapGraphNode* descriptors =
GetProperty(map, v8::HeapGraphEdge::kInternal, "descriptors");
- CHECK_NE(NULL, descriptors);
+ CHECK(descriptors);
const v8::HeapGraphNode* length_name =
GetProperty(descriptors, v8::HeapGraphEdge::kInternal, "2");
- CHECK_NE(NULL, length_name);
- CHECK_EQ("length", *v8::String::Utf8Value(length_name->GetName()));
+ CHECK(length_name);
+ CHECK_EQ(0, strcmp("length", *v8::String::Utf8Value(length_name->GetName())));
const v8::HeapGraphNode* length_accessor =
GetProperty(descriptors, v8::HeapGraphEdge::kInternal, "4");
- CHECK_NE(NULL, length_accessor);
- CHECK_EQ("system / ExecutableAccessorInfo",
- *v8::String::Utf8Value(length_accessor->GetName()));
+ CHECK(length_accessor);
+ CHECK_EQ(0, strcmp("system / ExecutableAccessorInfo",
+ *v8::String::Utf8Value(length_accessor->GetName())));
const v8::HeapGraphNode* name =
GetProperty(length_accessor, v8::HeapGraphEdge::kInternal, "name");
- CHECK_NE(NULL, name);
+ CHECK(name);
const v8::HeapGraphNode* getter =
GetProperty(length_accessor, v8::HeapGraphEdge::kInternal, "getter");
- CHECK_NE(NULL, getter);
+ CHECK(getter);
const v8::HeapGraphNode* setter =
GetProperty(length_accessor, v8::HeapGraphEdge::kInternal, "setter");
- CHECK_NE(NULL, setter);
+ CHECK(setter);
}
CHECK(ValidateSnapshot(snapshot));
const v8::HeapGraphNode* gc_roots = GetNode(
snapshot->GetRoot(), v8::HeapGraphNode::kSynthetic, "(GC roots)");
- CHECK_NE(NULL, gc_roots);
+ CHECK(gc_roots);
const v8::HeapGraphNode* global_handles = GetNode(
gc_roots, v8::HeapGraphNode::kSynthetic, "(Global handles)");
- CHECK_NE(NULL, global_handles);
+ CHECK(global_handles);
return HasWeakEdge(global_handles);
}
heap_profiler->TakeHeapSnapshot(v8_str("fun"));
CHECK(ValidateSnapshot(snapshot));
const v8::HeapGraphNode* global = GetGlobalObject(snapshot);
- CHECK_NE(NULL, global);
+ CHECK(global);
const v8::HeapGraphNode* fun =
GetProperty(global, v8::HeapGraphEdge::kProperty, "fun");
CHECK(!HasWeakEdge(fun));
const v8::HeapGraphNode* global = edge->GetToNode();
const v8::HeapGraphNode* foo =
GetProperty(global, v8::HeapGraphEdge::kProperty, "foo");
- CHECK_NE(NULL, foo);
+ CHECK(foo);
}
}
CHECK_EQ(1, globals_count);
CHECK(ValidateSnapshot(snapshot));
const v8::HeapGraphNode* gc_roots = GetNode(
snapshot->GetRoot(), v8::HeapGraphNode::kSynthetic, "(GC roots)");
- CHECK_NE(NULL, gc_roots);
+ CHECK(gc_roots);
const v8::HeapGraphNode* strong_roots = GetNode(
gc_roots, v8::HeapGraphNode::kSynthetic, "(Strong roots)");
- CHECK_NE(NULL, strong_roots);
+ CHECK(strong_roots);
for (int i = 0; i < strong_roots->GetChildrenCount(); ++i) {
const v8::HeapGraphEdge* edge = strong_roots->GetChild(i);
CHECK_EQ(v8::HeapGraphEdge::kInternal, edge->GetType());
const v8::HeapGraphNode* global = GetGlobalObject(snapshot);
const v8::HeapGraphNode* global_object =
GetProperty(global, v8::HeapGraphEdge::kProperty, "global_object");
- CHECK_NE(NULL, global_object);
+ CHECK(global_object);
const v8::HeapGraphNode* properties =
GetProperty(global_object, v8::HeapGraphEdge::kInternal, "properties");
- CHECK_EQ(NULL, properties);
+ CHECK(!properties);
const v8::HeapGraphNode* elements =
GetProperty(global_object, v8::HeapGraphEdge::kInternal, "elements");
- CHECK_EQ(NULL, elements);
+ CHECK(!elements);
}
const v8::HeapGraphNode* global = GetGlobalObject(snapshot);
const v8::HeapGraphNode* global_object =
GetProperty(global, v8::HeapGraphEdge::kProperty, "obj");
- CHECK_NE(NULL, global_object);
+ CHECK(global_object);
const v8::HeapGraphNode* map =
GetProperty(global_object, v8::HeapGraphEdge::kInternal, "map");
- CHECK_NE(NULL, map);
+ CHECK(map);
const v8::HeapGraphNode* own_descriptors = GetProperty(
map, v8::HeapGraphEdge::kInternal, "descriptors");
- CHECK_NE(NULL, own_descriptors);
+ CHECK(own_descriptors);
const v8::HeapGraphNode* own_transitions = GetProperty(
map, v8::HeapGraphEdge::kInternal, "transitions");
- CHECK_EQ(NULL, own_transitions);
+ CHECK(!own_transitions);
}
CHECK(ValidateSnapshot(snapshot));
const v8::HeapGraphNode* global = GetGlobalObject(snapshot);
- CHECK_NE(NULL, global);
+ CHECK(global);
const v8::HeapGraphNode* ok_object =
GetProperty(global, v8::HeapGraphEdge::kProperty, "ok");
- CHECK_NE(NULL, ok_object);
+ CHECK(ok_object);
const v8::HeapGraphNode* context_object =
GetProperty(ok_object, v8::HeapGraphEdge::kInternal, "context");
- CHECK_NE(NULL, context_object);
+ CHECK(context_object);
// Check the objects are not duplicated in the context.
CHECK_EQ(v8::internal::Context::MIN_CONTEXT_SLOTS + num_objects - 1,
context_object->GetChildrenCount());
i::SNPrintF(var_name, "f_%d", i);
const v8::HeapGraphNode* f_object = GetProperty(
context_object, v8::HeapGraphEdge::kContextVariable, var_name.start());
- CHECK_NE(NULL, f_object);
+ CHECK(f_object);
}
}
CHECK(ValidateSnapshot(snapshot));
const v8::HeapGraphNode* global = GetGlobalObject(snapshot);
- CHECK_NE(NULL, global);
+ CHECK(global);
const v8::HeapGraphNode* fun_code =
GetProperty(global, v8::HeapGraphEdge::kProperty, "fun");
- CHECK_NE(NULL, fun_code);
+ CHECK(fun_code);
const v8::HeapGraphNode* literals =
GetProperty(fun_code, v8::HeapGraphEdge::kInternal, "literals");
- CHECK_NE(NULL, literals);
+ CHECK(literals);
CHECK_EQ(v8::HeapGraphNode::kArray, literals->GetType());
CHECK_EQ(2, literals->GetChildrenCount());
const v8::HeapGraphEdge* prop = literals->GetChild(1);
const v8::HeapGraphNode* allocation_site = prop->GetToNode();
v8::String::Utf8Value name(allocation_site->GetName());
- CHECK_EQ("system / AllocationSite", *name);
+ CHECK_EQ(0, strcmp("system / AllocationSite", *name));
const v8::HeapGraphNode* transition_info =
GetProperty(allocation_site, v8::HeapGraphEdge::kInternal,
"transition_info");
- CHECK_NE(NULL, transition_info);
+ CHECK(transition_info);
const v8::HeapGraphNode* elements =
GetProperty(transition_info, v8::HeapGraphEdge::kInternal,
"elements");
- CHECK_NE(NULL, elements);
+ CHECK(elements);
CHECK_EQ(v8::HeapGraphNode::kArray, elements->GetType());
CHECK_EQ(v8::internal::FixedArray::SizeFor(3),
static_cast<int>(elements->GetShallowSize()));
CHECK(array_val->IsArray());
v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(array_val);
// Verify the array is "a" in the code above.
- CHECK_EQ(3, array->Length());
- CHECK_EQ(v8::Integer::New(isolate, 3),
- array->Get(v8::Integer::New(isolate, 0)));
- CHECK_EQ(v8::Integer::New(isolate, 2),
- array->Get(v8::Integer::New(isolate, 1)));
- CHECK_EQ(v8::Integer::New(isolate, 1),
- array->Get(v8::Integer::New(isolate, 2)));
+ CHECK_EQ(3u, array->Length());
+ CHECK(v8::Integer::New(isolate, 3)
+ ->Equals(array->Get(v8::Integer::New(isolate, 0))));
+ CHECK(v8::Integer::New(isolate, 2)
+ ->Equals(array->Get(v8::Integer::New(isolate, 1))));
+ CHECK(v8::Integer::New(isolate, 1)
+ ->Equals(array->Get(v8::Integer::New(isolate, 2))));
}
const v8::HeapGraphNode* global = GetGlobalObject(snapshot);
const v8::HeapGraphNode* foo_func =
GetProperty(global, v8::HeapGraphEdge::kProperty, "foo");
- CHECK_NE(NULL, foo_func);
+ CHECK(foo_func);
const v8::HeapGraphNode* code =
GetProperty(foo_func, v8::HeapGraphEdge::kInternal, "code");
- CHECK_NE(NULL, code);
+ CHECK(code);
}
};
const v8::HeapGraphNode* node = GetNodeByPath(snapshot,
stub_path, arraysize(stub_path));
- CHECK_NE(NULL, node);
+ CHECK(node);
const char* builtin_path1[] = {"::(GC roots)", "::(Builtins)",
"::(KeyedLoadIC_Megamorphic builtin)"};
node = GetNodeByPath(snapshot, builtin_path1, arraysize(builtin_path1));
- CHECK_NE(NULL, node);
+ CHECK(node);
const char* builtin_path2[] = {"::(GC roots)", "::(Builtins)",
"::(CompileLazy builtin)"};
node = GetNodeByPath(snapshot, builtin_path2, arraysize(builtin_path2));
- CHECK_NE(NULL, node);
+ CHECK(node);
v8::String::Utf8Value node_name(node->GetName());
- CHECK_EQ("(CompileLazy builtin)", *node_name);
+ CHECK_EQ(0, strcmp("(CompileLazy builtin)", *node_name));
}
const char* names[] = {""};
AllocationTracker* tracker =
reinterpret_cast<i::HeapProfiler*>(heap_profiler)->allocation_tracker();
- CHECK_NE(NULL, tracker);
+ CHECK(tracker);
// Resolve all function locations.
tracker->PrepareForSerialization();
// Print for better diagnostics in case of failure.
AllocationTraceNode* node =
FindNode(tracker, Vector<const char*>(names, arraysize(names)));
- CHECK_NE(NULL, node);
- CHECK_GE(node->allocation_count(), 2);
- CHECK_GE(node->allocation_size(), 4 * 5);
+ CHECK(node);
+ CHECK_GE(node->allocation_count(), 2u);
+ CHECK_GE(node->allocation_size(), 4u * 5u);
heap_profiler->StopTrackingHeapObjects();
}
AllocationTracker* tracker =
reinterpret_cast<i::HeapProfiler*>(heap_profiler)->allocation_tracker();
- CHECK_NE(NULL, tracker);
+ CHECK(tracker);
// Resolve all function locations.
tracker->PrepareForSerialization();
// Print for better diagnostics in case of failure.
const char* names[] = {"", "start", "f_0_0", "f_0_1", "f_0_2"};
AllocationTraceNode* node =
FindNode(tracker, Vector<const char*>(names, arraysize(names)));
- CHECK_NE(NULL, node);
- CHECK_GE(node->allocation_count(), 100);
+ CHECK(node);
+ CHECK_GE(node->allocation_count(), 100u);
CHECK_GE(node->allocation_size(), 4 * node->allocation_count());
heap_profiler->StopTrackingHeapObjects();
}
AllocationTracker* tracker =
reinterpret_cast<i::HeapProfiler*>(heap_profiler)->allocation_tracker();
- CHECK_NE(NULL, tracker);
+ CHECK(tracker);
// Resolve all function locations.
tracker->PrepareForSerialization();
// Print for better diagnostics in case of failure.
AllocationTraceNode* node =
FindNode(tracker, Vector<const char*>(names, arraysize(names)));
- CHECK_NE(NULL, node);
- CHECK_GE(node->allocation_count(), 100);
+ CHECK(node);
+ CHECK_GE(node->allocation_count(), 100u);
CHECK_GE(node->allocation_size(), 4 * node->allocation_count());
heap_profiler->StopTrackingHeapObjects();
}
AllocationTracker* tracker =
reinterpret_cast<i::HeapProfiler*>(heap_profiler)->allocation_tracker();
- CHECK_NE(NULL, tracker);
+ CHECK(tracker);
// Resolve all function locations.
tracker->PrepareForSerialization();
// Print for better diagnostics in case of failure.
AllocationTraceNode* node =
FindNode(tracker, Vector<const char*>(names, arraysize(names)));
- CHECK_NE(NULL, node);
- CHECK_LT(node->allocation_count(), 100);
+ CHECK(node);
+ CHECK_LT(node->allocation_count(), 100u);
CcTest::heap()->DisableInlineAllocation();
heap_profiler->StopTrackingHeapObjects();
AllocationTracker* tracker =
reinterpret_cast<i::HeapProfiler*>(heap_profiler)->allocation_tracker();
- CHECK_NE(NULL, tracker);
+ CHECK(tracker);
// Resolve all function locations.
tracker->PrepareForSerialization();
// Print for better diagnostics in case of failure.
AllocationTraceNode* node =
FindNode(tracker, Vector<const char*>(names, arraysize(names)));
- CHECK_NE(NULL, node);
- CHECK_GE(node->allocation_count(), 2);
+ CHECK(node);
+ CHECK_GE(node->allocation_count(), 2u);
CHECK_GE(node->allocation_size(), 4 * node->allocation_count());
heap_profiler->StopTrackingHeapObjects();
}
const v8::HeapGraphNode* global = GetGlobalObject(snapshot);
const v8::HeapGraphNode* arr1_obj =
GetProperty(global, v8::HeapGraphEdge::kProperty, "arr1");
- CHECK_NE(NULL, arr1_obj);
+ CHECK(arr1_obj);
const v8::HeapGraphNode* arr1_buffer =
GetProperty(arr1_obj, v8::HeapGraphEdge::kInternal, "buffer");
- CHECK_NE(NULL, arr1_buffer);
+ CHECK(arr1_buffer);
const v8::HeapGraphNode* first_view =
GetProperty(arr1_buffer, v8::HeapGraphEdge::kWeak, "weak_first_view");
- CHECK_NE(NULL, first_view);
+ CHECK(first_view);
const v8::HeapGraphNode* backing_store =
GetProperty(arr1_buffer, v8::HeapGraphEdge::kInternal, "backing_store");
- CHECK_NE(NULL, backing_store);
+ CHECK(backing_store);
CHECK_EQ(400, static_cast<int>(backing_store->GetShallowSize()));
}
const v8::HeapGraphNode* global = GetGlobalObject(snapshot);
const v8::HeapGraphNode* ab1_node =
GetProperty(global, v8::HeapGraphEdge::kProperty, "ab1");
- CHECK_NE(NULL, ab1_node);
+ CHECK(ab1_node);
const v8::HeapGraphNode* ab1_data =
GetProperty(ab1_node, v8::HeapGraphEdge::kInternal, "backing_store");
- CHECK_NE(NULL, ab1_data);
+ CHECK(ab1_data);
const v8::HeapGraphNode* ab2_node =
GetProperty(global, v8::HeapGraphEdge::kProperty, "ab2");
- CHECK_NE(NULL, ab2_node);
+ CHECK(ab2_node);
const v8::HeapGraphNode* ab2_data =
GetProperty(ab2_node, v8::HeapGraphEdge::kInternal, "backing_store");
- CHECK_NE(NULL, ab2_data);
+ CHECK(ab2_data);
CHECK_EQ(ab1_data, ab2_data);
CHECK_EQ(2, GetRetainersCount(snapshot, ab1_data));
free(data);
const v8::HeapGraphNode* global_node = GetGlobalObject(snapshot);
const v8::HeapGraphNode* box_node =
GetProperty(global_node, v8::HeapGraphEdge::kElement, "0");
- CHECK_NE(NULL, box_node);
+ CHECK(box_node);
v8::String::Utf8Value box_node_name(box_node->GetName());
- CHECK_EQ("system / Box", *box_node_name);
+ CHECK_EQ(0, strcmp("system / Box", *box_node_name));
const v8::HeapGraphNode* box_value =
GetProperty(box_node, v8::HeapGraphEdge::kInternal, "value");
- CHECK_NE(NULL, box_value);
+ CHECK(box_value);
}
const v8::HeapGraphNode* global = GetGlobalObject(snapshot);
const v8::HeapGraphNode* obj =
GetProperty(global, v8::HeapGraphEdge::kProperty, "obj");
- CHECK_NE(NULL, obj);
+ CHECK(obj);
const v8::HeapGraphNode* map =
GetProperty(obj, v8::HeapGraphEdge::kInternal, "map");
- CHECK_NE(NULL, map);
+ CHECK(map);
const v8::HeapGraphNode* dependent_code =
GetProperty(map, v8::HeapGraphEdge::kInternal, "dependent_code");
if (!dependent_code) return;
TEST(AddressToTraceMap) {
i::AddressToTraceMap map;
- CHECK_EQ(0, map.GetTraceNodeId(ToAddress(150)));
+ CHECK_EQ(0u, map.GetTraceNodeId(ToAddress(150)));
// [0x100, 0x200) -> 1
map.AddRange(ToAddress(0x100), 0x100, 1U);
- CHECK_EQ(0, map.GetTraceNodeId(ToAddress(0x50)));
- CHECK_EQ(1, map.GetTraceNodeId(ToAddress(0x100)));
- CHECK_EQ(1, map.GetTraceNodeId(ToAddress(0x150)));
- CHECK_EQ(0, map.GetTraceNodeId(ToAddress(0x100 + 0x100)));
- CHECK_EQ(1, static_cast<int>(map.size()));
+ CHECK_EQ(0u, map.GetTraceNodeId(ToAddress(0x50)));
+ CHECK_EQ(1u, map.GetTraceNodeId(ToAddress(0x100)));
+ CHECK_EQ(1u, map.GetTraceNodeId(ToAddress(0x150)));
+ CHECK_EQ(0u, map.GetTraceNodeId(ToAddress(0x100 + 0x100)));
+ CHECK_EQ(1u, map.size());
// [0x100, 0x200) -> 1, [0x200, 0x300) -> 2
map.AddRange(ToAddress(0x200), 0x100, 2U);
- CHECK_EQ(2, map.GetTraceNodeId(ToAddress(0x2a0)));
- CHECK_EQ(2, static_cast<int>(map.size()));
+ CHECK_EQ(2u, map.GetTraceNodeId(ToAddress(0x2a0)));
+ CHECK_EQ(2u, map.size());
// [0x100, 0x180) -> 1, [0x180, 0x280) -> 3, [0x280, 0x300) -> 2
map.AddRange(ToAddress(0x180), 0x100, 3U);
- CHECK_EQ(1, map.GetTraceNodeId(ToAddress(0x17F)));
- CHECK_EQ(2, map.GetTraceNodeId(ToAddress(0x280)));
- CHECK_EQ(3, map.GetTraceNodeId(ToAddress(0x180)));
- CHECK_EQ(3, static_cast<int>(map.size()));
+ CHECK_EQ(1u, map.GetTraceNodeId(ToAddress(0x17F)));
+ CHECK_EQ(2u, map.GetTraceNodeId(ToAddress(0x280)));
+ CHECK_EQ(3u, map.GetTraceNodeId(ToAddress(0x180)));
+ CHECK_EQ(3u, map.size());
// [0x100, 0x180) -> 1, [0x180, 0x280) -> 3, [0x280, 0x300) -> 2,
// [0x400, 0x500) -> 4
map.AddRange(ToAddress(0x400), 0x100, 4U);
- CHECK_EQ(1, map.GetTraceNodeId(ToAddress(0x17F)));
- CHECK_EQ(2, map.GetTraceNodeId(ToAddress(0x280)));
- CHECK_EQ(3, map.GetTraceNodeId(ToAddress(0x180)));
- CHECK_EQ(4, map.GetTraceNodeId(ToAddress(0x450)));
- CHECK_EQ(0, map.GetTraceNodeId(ToAddress(0x500)));
- CHECK_EQ(0, map.GetTraceNodeId(ToAddress(0x350)));
- CHECK_EQ(4, static_cast<int>(map.size()));
+ CHECK_EQ(1u, map.GetTraceNodeId(ToAddress(0x17F)));
+ CHECK_EQ(2u, map.GetTraceNodeId(ToAddress(0x280)));
+ CHECK_EQ(3u, map.GetTraceNodeId(ToAddress(0x180)));
+ CHECK_EQ(4u, map.GetTraceNodeId(ToAddress(0x450)));
+ CHECK_EQ(0u, map.GetTraceNodeId(ToAddress(0x500)));
+ CHECK_EQ(0u, map.GetTraceNodeId(ToAddress(0x350)));
+ CHECK_EQ(4u, map.size());
// [0x100, 0x180) -> 1, [0x180, 0x200) -> 3, [0x200, 0x600) -> 5
map.AddRange(ToAddress(0x200), 0x400, 5U);
- CHECK_EQ(5, map.GetTraceNodeId(ToAddress(0x200)));
- CHECK_EQ(5, map.GetTraceNodeId(ToAddress(0x400)));
- CHECK_EQ(3, static_cast<int>(map.size()));
+ CHECK_EQ(5u, map.GetTraceNodeId(ToAddress(0x200)));
+ CHECK_EQ(5u, map.GetTraceNodeId(ToAddress(0x400)));
+ CHECK_EQ(3u, map.size());
// [0x100, 0x180) -> 1, [0x180, 0x200) -> 7, [0x200, 0x600) ->5
map.AddRange(ToAddress(0x180), 0x80, 6U);
map.AddRange(ToAddress(0x180), 0x80, 7U);
- CHECK_EQ(7, map.GetTraceNodeId(ToAddress(0x180)));
- CHECK_EQ(5, map.GetTraceNodeId(ToAddress(0x200)));
- CHECK_EQ(3, static_cast<int>(map.size()));
+ CHECK_EQ(7u, map.GetTraceNodeId(ToAddress(0x180)));
+ CHECK_EQ(5u, map.GetTraceNodeId(ToAddress(0x200)));
+ CHECK_EQ(3u, map.size());
map.Clear();
- CHECK_EQ(0, static_cast<int>(map.size()));
- CHECK_EQ(0, map.GetTraceNodeId(ToAddress(0x400)));
+ CHECK_EQ(0u, map.size());
+ CHECK_EQ(0u, map.GetTraceNodeId(ToAddress(0x400)));
}
{
v8::Locker locker(isolate_);
v8::Isolate::Scope isolate_scope(isolate_);
- CHECK_EQ(isolate_, v8::internal::Isolate::Current());
+ CHECK_EQ(reinterpret_cast<v8::internal::Isolate*>(isolate_),
+ v8::internal::Isolate::Current());
v8::HandleScope scope(isolate_);
v8::Local<v8::Context> context =
v8::Local<v8::Context>::New(isolate_, context_);
v8::HandleScope handle_scope(isolate);
v8::Local<v8::Context> context = v8::Context::New(isolate);
v8::Context::Scope context_scope(context);
- CHECK_EQ(isolate, v8::internal::Isolate::Current());
+ CHECK_EQ(reinterpret_cast<v8::internal::Isolate*>(isolate),
+ v8::internal::Isolate::Current());
CompileRun("function getValue() { return 30; }");
thread1.Reset(new KangarooThread(isolate, context));
}
v8::Isolate::Scope isolate_scope(isolate_);
v8::HandleScope handle_scope(isolate_);
LocalContext local_context(isolate_);
- CHECK_EQ(isolate_, v8::internal::Isolate::Current());
+ CHECK_EQ(reinterpret_cast<v8::internal::Isolate*>(isolate_),
+ v8::internal::Isolate::Current());
CalcFibAndCheck();
}
private:
v8::HandleScope scope(CcTest::isolate());
v8::Local<v8::Context> context = CcTest::NewContext(TRACE_EXTENSION);
v8::Context::Scope context_scope(context);
- CHECK_EQ(0, i::TraceExtension::GetJsEntrySp());
+ CHECK(!i::TraceExtension::GetJsEntrySp());
CompileRun("a = 1; b = a + 1;");
- CHECK_EQ(0, i::TraceExtension::GetJsEntrySp());
+ CHECK(!i::TraceExtension::GetJsEntrySp());
CompileRun("js_entry_sp();");
- CHECK_EQ(0, i::TraceExtension::GetJsEntrySp());
+ CHECK(!i::TraceExtension::GetJsEntrySp());
CompileRun("js_entry_sp_level2();");
- CHECK_EQ(0, i::TraceExtension::GetJsEntrySp());
+ CHECK(!i::TraceExtension::GetJsEntrySp());
}
FILE* StopLoggingGetTempFile() {
temp_file_ = logger_->TearDown();
- CHECK_NE(NULL, temp_file_);
+ CHECK(temp_file_);
fflush(temp_file_);
rewind(temp_file_);
return temp_file_;
"code-creation,Callback,-2,0x%" V8PRIxPTR ",1,\"method1\"",
reinterpret_cast<intptr_t>(ObjMethod1));
- CHECK_NE(NULL, StrNStr(log.start(), ref_data.start(), log.length()));
+ CHECK(StrNStr(log.start(), ref_data.start(), log.length()));
log.Dispose();
}
isolate->Dispose();
i::SNPrintF(prop1_getter_record,
"code-creation,Callback,-2,0x%" V8PRIxPTR ",1,\"get prop1\"",
reinterpret_cast<intptr_t>(Prop1Getter));
- CHECK_NE(NULL,
- StrNStr(log.start(), prop1_getter_record.start(), log.length()));
+ CHECK(StrNStr(log.start(), prop1_getter_record.start(), log.length()));
EmbeddedVector<char, 100> prop1_setter_record;
i::SNPrintF(prop1_setter_record,
"code-creation,Callback,-2,0x%" V8PRIxPTR ",1,\"set prop1\"",
reinterpret_cast<intptr_t>(Prop1Setter));
- CHECK_NE(NULL,
- StrNStr(log.start(), prop1_setter_record.start(), log.length()));
+ CHECK(StrNStr(log.start(), prop1_setter_record.start(), log.length()));
EmbeddedVector<char, 100> prop2_getter_record;
i::SNPrintF(prop2_getter_record,
"code-creation,Callback,-2,0x%" V8PRIxPTR ",1,\"get prop2\"",
reinterpret_cast<intptr_t>(Prop2Getter));
- CHECK_NE(NULL,
- StrNStr(log.start(), prop2_getter_record.start(), log.length()));
+ CHECK(StrNStr(log.start(), prop2_getter_record.start(), log.length()));
log.Dispose();
}
isolate->Dispose();
if (!result->IsTrue()) {
v8::Local<v8::String> s = result->ToString(isolate);
i::ScopedVector<char> data(s->Utf8Length() + 1);
- CHECK_NE(NULL, data.start());
+ CHECK(data.start());
s->WriteUtf8(data.start());
printf("%s\n", data.start());
// Make sure that our output is written prior crash due to CHECK failure.
i::SNPrintF(ref_data, "v8-version,%d,%d,%d,%d,%d", i::Version::GetMajor(),
i::Version::GetMinor(), i::Version::GetBuild(),
i::Version::GetPatch(), i::Version::IsCandidate());
- CHECK_NE(NULL, StrNStr(log.start(), ref_data.start(), log.length()));
+ CHECK(StrNStr(log.start(), ref_data.start(), log.length()));
log.Dispose();
}
isolate->Dispose();
// Call the function from C++.
F5 f = FUNCTION_CAST<F5>(code->entry());
- CHECK_EQ(0, CALL_GENERATED_CODE(f, 0, 0, 0, 0, 0));
+ CHECK(!CALL_GENERATED_CODE(f, 0, 0, 0, 0, 0));
}
#undef __
v8::Local<v8::Value> result = ParserCacheCompileRun(source);
CHECK(result->IsString());
v8::String::Utf8Value utf8(result);
- CHECK_EQ("foo", *utf8);
+ CHECK_EQ(0, strcmp("foo", *utf8));
}
{
v8::Local<v8::Value> result = ParserCacheCompileRun(source);
CHECK(result->IsString());
v8::String::Utf8Value utf8(result);
- CHECK_EQ("foo", *utf8);
+ CHECK_EQ(0, strcmp("foo", *utf8));
}
{
v8::Local<v8::Value> result = ParserCacheCompileRun(source);
CHECK(result->IsString());
v8::String::Utf8Value utf8(result);
- CHECK_EQ("foo", *utf8);
+ CHECK_EQ(0, strcmp("foo", *utf8));
}
}
v8::Script::Compile(v8::String::NewFromUtf8(CcTest::isolate(), script));
CHECK(try_catch.HasCaught());
v8::String::Utf8Value exception(try_catch.Exception());
- CHECK_EQ("SyntaxError: Octal literals are not allowed in strict mode.",
- *exception);
+ CHECK_EQ(0,
+ strcmp("SyntaxError: Octal literals are not allowed in strict mode.",
+ *exception));
}
v8::Local<v8::Function>::Cast(global_object->Get(v8_str("foo")));
v8::Local<v8::Value> result = foo->Call(global_object, 0, NULL);
- CHECK_EQ(0, result->Uint32Value() % v8::base::OS::ActivationFrameAlignment());
+ CHECK_EQ(0u,
+ result->Uint32Value() % v8::base::OS::ActivationFrameAlignment());
}
#endif // V8_CC_GNU
ProfileNode* node = tree.root();
CodeEntry entry1(i::Logger::FUNCTION_TAG, "aaa");
ProfileNode* childNode1 = node->FindOrAddChild(&entry1);
- CHECK_NE(NULL, childNode1);
+ CHECK(childNode1);
CHECK_EQ(childNode1, node->FindOrAddChild(&entry1));
CodeEntry entry2(i::Logger::FUNCTION_TAG, "bbb");
ProfileNode* childNode2 = node->FindOrAddChild(&entry2);
- CHECK_NE(NULL, childNode2);
+ CHECK(childNode2);
CHECK_NE(childNode1, childNode2);
CHECK_EQ(childNode1, node->FindOrAddChild(&entry1));
CHECK_EQ(childNode2, node->FindOrAddChild(&entry2));
CodeEntry entry3(i::Logger::FUNCTION_TAG, "ccc");
ProfileNode* childNode3 = node->FindOrAddChild(&entry3);
- CHECK_NE(NULL, childNode3);
+ CHECK(childNode3);
CHECK_NE(childNode1, childNode3);
CHECK_NE(childNode2, childNode3);
CHECK_EQ(childNode1, node->FindOrAddChild(&entry1));
ProfileNode* node = tree.root();
CodeEntry entry1(i::Logger::FUNCTION_TAG, aaa);
ProfileNode* childNode1 = node->FindOrAddChild(&entry1);
- CHECK_NE(NULL, childNode1);
+ CHECK(childNode1);
CHECK_EQ(childNode1, node->FindOrAddChild(&entry1));
// The same function again.
CodeEntry entry2(i::Logger::FUNCTION_TAG, aaa);
CodeEntry entry3(i::Logger::FUNCTION_TAG, "ccc");
ProfileTree tree;
ProfileTreeTestHelper helper(&tree);
- CHECK_EQ(NULL, helper.Walk(&entry1));
- CHECK_EQ(NULL, helper.Walk(&entry2));
- CHECK_EQ(NULL, helper.Walk(&entry3));
+ CHECK(!helper.Walk(&entry1));
+ CHECK(!helper.Walk(&entry2));
+ CHECK(!helper.Walk(&entry3));
CodeEntry* path[] = {NULL, &entry1, NULL, &entry2, NULL, NULL, &entry3, NULL};
Vector<CodeEntry*> path_vec(path, sizeof(path) / sizeof(path[0]));
tree.AddPathFromStart(path_vec);
- CHECK_EQ(NULL, helper.Walk(&entry2));
- CHECK_EQ(NULL, helper.Walk(&entry3));
+ CHECK(!helper.Walk(&entry2));
+ CHECK(!helper.Walk(&entry3));
ProfileNode* node1 = helper.Walk(&entry1);
- CHECK_NE(NULL, node1);
- CHECK_EQ(0, node1->self_ticks());
- CHECK_EQ(NULL, helper.Walk(&entry1, &entry1));
- CHECK_EQ(NULL, helper.Walk(&entry1, &entry3));
+ CHECK(node1);
+ CHECK_EQ(0u, node1->self_ticks());
+ CHECK(!helper.Walk(&entry1, &entry1));
+ CHECK(!helper.Walk(&entry1, &entry3));
ProfileNode* node2 = helper.Walk(&entry1, &entry2);
- CHECK_NE(NULL, node2);
+ CHECK(node2);
CHECK_NE(node1, node2);
- CHECK_EQ(0, node2->self_ticks());
- CHECK_EQ(NULL, helper.Walk(&entry1, &entry2, &entry1));
- CHECK_EQ(NULL, helper.Walk(&entry1, &entry2, &entry2));
+ CHECK_EQ(0u, node2->self_ticks());
+ CHECK(!helper.Walk(&entry1, &entry2, &entry1));
+ CHECK(!helper.Walk(&entry1, &entry2, &entry2));
ProfileNode* node3 = helper.Walk(&entry1, &entry2, &entry3);
- CHECK_NE(NULL, node3);
+ CHECK(node3);
CHECK_NE(node1, node3);
CHECK_NE(node2, node3);
- CHECK_EQ(1, node3->self_ticks());
+ CHECK_EQ(1u, node3->self_ticks());
tree.AddPathFromStart(path_vec);
CHECK_EQ(node1, helper.Walk(&entry1));
CHECK_EQ(node2, helper.Walk(&entry1, &entry2));
CHECK_EQ(node3, helper.Walk(&entry1, &entry2, &entry3));
- CHECK_EQ(0, node1->self_ticks());
- CHECK_EQ(0, node2->self_ticks());
- CHECK_EQ(2, node3->self_ticks());
+ CHECK_EQ(0u, node1->self_ticks());
+ CHECK_EQ(0u, node2->self_ticks());
+ CHECK_EQ(2u, node3->self_ticks());
CodeEntry* path2[] = {&entry1, &entry2, &entry2};
Vector<CodeEntry*> path2_vec(path2, sizeof(path2) / sizeof(path2[0]));
tree.AddPathFromStart(path2_vec);
- CHECK_EQ(NULL, helper.Walk(&entry2));
- CHECK_EQ(NULL, helper.Walk(&entry3));
+ CHECK(!helper.Walk(&entry2));
+ CHECK(!helper.Walk(&entry3));
CHECK_EQ(node1, helper.Walk(&entry1));
- CHECK_EQ(NULL, helper.Walk(&entry1, &entry1));
- CHECK_EQ(NULL, helper.Walk(&entry1, &entry3));
+ CHECK(!helper.Walk(&entry1, &entry1));
+ CHECK(!helper.Walk(&entry1, &entry3));
CHECK_EQ(node2, helper.Walk(&entry1, &entry2));
- CHECK_EQ(NULL, helper.Walk(&entry1, &entry2, &entry1));
+ CHECK(!helper.Walk(&entry1, &entry2, &entry1));
CHECK_EQ(node3, helper.Walk(&entry1, &entry2, &entry3));
- CHECK_EQ(2, node3->self_ticks());
+ CHECK_EQ(2u, node3->self_ticks());
ProfileNode* node4 = helper.Walk(&entry1, &entry2, &entry2);
- CHECK_NE(NULL, node4);
+ CHECK(node4);
CHECK_NE(node3, node4);
- CHECK_EQ(1, node4->self_ticks());
+ CHECK_EQ(1u, node4->self_ticks());
}
CodeEntry entry3(i::Logger::FUNCTION_TAG, "ccc");
ProfileTree tree;
ProfileTreeTestHelper helper(&tree);
- CHECK_EQ(NULL, helper.Walk(&entry1));
- CHECK_EQ(NULL, helper.Walk(&entry2));
- CHECK_EQ(NULL, helper.Walk(&entry3));
+ CHECK(!helper.Walk(&entry1));
+ CHECK(!helper.Walk(&entry2));
+ CHECK(!helper.Walk(&entry3));
CodeEntry* path[] = {NULL, &entry3, NULL, &entry2, NULL, NULL, &entry1, NULL};
Vector<CodeEntry*> path_vec(path, sizeof(path) / sizeof(path[0]));
tree.AddPathFromEnd(path_vec);
- CHECK_EQ(NULL, helper.Walk(&entry2));
- CHECK_EQ(NULL, helper.Walk(&entry3));
+ CHECK(!helper.Walk(&entry2));
+ CHECK(!helper.Walk(&entry3));
ProfileNode* node1 = helper.Walk(&entry1);
- CHECK_NE(NULL, node1);
- CHECK_EQ(0, node1->self_ticks());
- CHECK_EQ(NULL, helper.Walk(&entry1, &entry1));
- CHECK_EQ(NULL, helper.Walk(&entry1, &entry3));
+ CHECK(node1);
+ CHECK_EQ(0u, node1->self_ticks());
+ CHECK(!helper.Walk(&entry1, &entry1));
+ CHECK(!helper.Walk(&entry1, &entry3));
ProfileNode* node2 = helper.Walk(&entry1, &entry2);
- CHECK_NE(NULL, node2);
+ CHECK(node2);
CHECK_NE(node1, node2);
- CHECK_EQ(0, node2->self_ticks());
- CHECK_EQ(NULL, helper.Walk(&entry1, &entry2, &entry1));
- CHECK_EQ(NULL, helper.Walk(&entry1, &entry2, &entry2));
+ CHECK_EQ(0u, node2->self_ticks());
+ CHECK(!helper.Walk(&entry1, &entry2, &entry1));
+ CHECK(!helper.Walk(&entry1, &entry2, &entry2));
ProfileNode* node3 = helper.Walk(&entry1, &entry2, &entry3);
- CHECK_NE(NULL, node3);
+ CHECK(node3);
CHECK_NE(node1, node3);
CHECK_NE(node2, node3);
- CHECK_EQ(1, node3->self_ticks());
+ CHECK_EQ(1u, node3->self_ticks());
tree.AddPathFromEnd(path_vec);
CHECK_EQ(node1, helper.Walk(&entry1));
CHECK_EQ(node2, helper.Walk(&entry1, &entry2));
CHECK_EQ(node3, helper.Walk(&entry1, &entry2, &entry3));
- CHECK_EQ(0, node1->self_ticks());
- CHECK_EQ(0, node2->self_ticks());
- CHECK_EQ(2, node3->self_ticks());
+ CHECK_EQ(0u, node1->self_ticks());
+ CHECK_EQ(0u, node2->self_ticks());
+ CHECK_EQ(2u, node3->self_ticks());
CodeEntry* path2[] = {&entry2, &entry2, &entry1};
Vector<CodeEntry*> path2_vec(path2, sizeof(path2) / sizeof(path2[0]));
tree.AddPathFromEnd(path2_vec);
- CHECK_EQ(NULL, helper.Walk(&entry2));
- CHECK_EQ(NULL, helper.Walk(&entry3));
+ CHECK(!helper.Walk(&entry2));
+ CHECK(!helper.Walk(&entry3));
CHECK_EQ(node1, helper.Walk(&entry1));
- CHECK_EQ(NULL, helper.Walk(&entry1, &entry1));
- CHECK_EQ(NULL, helper.Walk(&entry1, &entry3));
+ CHECK(!helper.Walk(&entry1, &entry1));
+ CHECK(!helper.Walk(&entry1, &entry3));
CHECK_EQ(node2, helper.Walk(&entry1, &entry2));
- CHECK_EQ(NULL, helper.Walk(&entry1, &entry2, &entry1));
+ CHECK(!helper.Walk(&entry1, &entry2, &entry1));
CHECK_EQ(node3, helper.Walk(&entry1, &entry2, &entry3));
- CHECK_EQ(2, node3->self_ticks());
+ CHECK_EQ(2u, node3->self_ticks());
ProfileNode* node4 = helper.Walk(&entry1, &entry2, &entry2);
- CHECK_NE(NULL, node4);
+ CHECK(node4);
CHECK_NE(node3, node4);
- CHECK_EQ(1, node4->self_ticks());
+ CHECK_EQ(1u, node4->self_ticks());
}
TEST(ProfileTreeCalculateTotalTicks) {
ProfileTree empty_tree;
- CHECK_EQ(0, empty_tree.root()->self_ticks());
+ CHECK_EQ(0u, empty_tree.root()->self_ticks());
empty_tree.root()->IncrementSelfTicks();
- CHECK_EQ(1, empty_tree.root()->self_ticks());
+ CHECK_EQ(1u, empty_tree.root()->self_ticks());
CodeEntry entry1(i::Logger::FUNCTION_TAG, "aaa");
CodeEntry* e1_path[] = {&entry1};
ProfileTree single_child_tree;
single_child_tree.AddPathFromStart(e1_path_vec);
single_child_tree.root()->IncrementSelfTicks();
- CHECK_EQ(1, single_child_tree.root()->self_ticks());
+ CHECK_EQ(1u, single_child_tree.root()->self_ticks());
ProfileTreeTestHelper single_child_helper(&single_child_tree);
ProfileNode* node1 = single_child_helper.Walk(&entry1);
- CHECK_NE(NULL, node1);
- CHECK_EQ(1, single_child_tree.root()->self_ticks());
- CHECK_EQ(1, node1->self_ticks());
+ CHECK(node1);
+ CHECK_EQ(1u, single_child_tree.root()->self_ticks());
+ CHECK_EQ(1u, node1->self_ticks());
CodeEntry entry2(i::Logger::FUNCTION_TAG, "bbb");
CodeEntry* e1_e2_path[] = {&entry1, &entry2};
flat_tree.AddPathFromStart(e1_e2_path_vec);
flat_tree.AddPathFromStart(e1_e2_path_vec);
// Results in {root,0,0} -> {entry1,0,2} -> {entry2,0,3}
- CHECK_EQ(0, flat_tree.root()->self_ticks());
+ CHECK_EQ(0u, flat_tree.root()->self_ticks());
node1 = flat_helper.Walk(&entry1);
- CHECK_NE(NULL, node1);
- CHECK_EQ(2, node1->self_ticks());
+ CHECK(node1);
+ CHECK_EQ(2u, node1->self_ticks());
ProfileNode* node2 = flat_helper.Walk(&entry1, &entry2);
- CHECK_NE(NULL, node2);
- CHECK_EQ(3, node2->self_ticks());
+ CHECK(node2);
+ CHECK_EQ(3u, node2->self_ticks());
// Must calculate {root,5,0} -> {entry1,5,2} -> {entry2,3,3}
- CHECK_EQ(0, flat_tree.root()->self_ticks());
- CHECK_EQ(2, node1->self_ticks());
+ CHECK_EQ(0u, flat_tree.root()->self_ticks());
+ CHECK_EQ(2u, node1->self_ticks());
CodeEntry* e2_path[] = {&entry2};
Vector<CodeEntry*> e2_path_vec(
// Results in -> {entry1,0,2} -> {entry2,0,1}
// {root,0,0} -> {entry2,0,3}
// -> {entry3,0,4}
- CHECK_EQ(0, wide_tree.root()->self_ticks());
+ CHECK_EQ(0u, wide_tree.root()->self_ticks());
node1 = wide_helper.Walk(&entry1);
- CHECK_NE(NULL, node1);
- CHECK_EQ(2, node1->self_ticks());
+ CHECK(node1);
+ CHECK_EQ(2u, node1->self_ticks());
ProfileNode* node1_2 = wide_helper.Walk(&entry1, &entry2);
- CHECK_NE(NULL, node1_2);
- CHECK_EQ(1, node1_2->self_ticks());
+ CHECK(node1_2);
+ CHECK_EQ(1u, node1_2->self_ticks());
node2 = wide_helper.Walk(&entry2);
- CHECK_NE(NULL, node2);
- CHECK_EQ(3, node2->self_ticks());
+ CHECK(node2);
+ CHECK_EQ(3u, node2->self_ticks());
ProfileNode* node3 = wide_helper.Walk(&entry3);
- CHECK_NE(NULL, node3);
- CHECK_EQ(4, node3->self_ticks());
+ CHECK(node3);
+ CHECK_EQ(4u, node3->self_ticks());
// Calculates -> {entry1,3,2} -> {entry2,1,1}
// {root,10,0} -> {entry2,3,3}
// -> {entry3,4,4}
- CHECK_EQ(0, wide_tree.root()->self_ticks());
- CHECK_EQ(2, node1->self_ticks());
- CHECK_EQ(1, node1_2->self_ticks());
- CHECK_EQ(3, node2->self_ticks());
- CHECK_EQ(4, node3->self_ticks());
+ CHECK_EQ(0u, wide_tree.root()->self_ticks());
+ CHECK_EQ(2u, node1->self_ticks());
+ CHECK_EQ(1u, node1_2->self_ticks());
+ CHECK_EQ(3u, node2->self_ticks());
+ CHECK_EQ(4u, node3->self_ticks());
}
code_map.AddCode(ToAddress(0x1700), &entry2, 0x100);
code_map.AddCode(ToAddress(0x1900), &entry3, 0x50);
code_map.AddCode(ToAddress(0x1950), &entry4, 0x10);
- CHECK_EQ(NULL, code_map.FindEntry(0));
- CHECK_EQ(NULL, code_map.FindEntry(ToAddress(0x1500 - 1)));
+ CHECK(!code_map.FindEntry(0));
+ CHECK(!code_map.FindEntry(ToAddress(0x1500 - 1)));
CHECK_EQ(&entry1, code_map.FindEntry(ToAddress(0x1500)));
CHECK_EQ(&entry1, code_map.FindEntry(ToAddress(0x1500 + 0x100)));
CHECK_EQ(&entry1, code_map.FindEntry(ToAddress(0x1500 + 0x200 - 1)));
CHECK_EQ(&entry2, code_map.FindEntry(ToAddress(0x1700)));
CHECK_EQ(&entry2, code_map.FindEntry(ToAddress(0x1700 + 0x50)));
CHECK_EQ(&entry2, code_map.FindEntry(ToAddress(0x1700 + 0x100 - 1)));
- CHECK_EQ(NULL, code_map.FindEntry(ToAddress(0x1700 + 0x100)));
- CHECK_EQ(NULL, code_map.FindEntry(ToAddress(0x1900 - 1)));
+ CHECK(!code_map.FindEntry(ToAddress(0x1700 + 0x100)));
+ CHECK(!code_map.FindEntry(ToAddress(0x1900 - 1)));
CHECK_EQ(&entry3, code_map.FindEntry(ToAddress(0x1900)));
CHECK_EQ(&entry3, code_map.FindEntry(ToAddress(0x1900 + 0x28)));
CHECK_EQ(&entry4, code_map.FindEntry(ToAddress(0x1950)));
CHECK_EQ(&entry4, code_map.FindEntry(ToAddress(0x1950 + 0x7)));
CHECK_EQ(&entry4, code_map.FindEntry(ToAddress(0x1950 + 0x10 - 1)));
- CHECK_EQ(NULL, code_map.FindEntry(ToAddress(0x1950 + 0x10)));
- CHECK_EQ(NULL, code_map.FindEntry(ToAddress(0xFFFFFFFF)));
+ CHECK(!code_map.FindEntry(ToAddress(0x1950 + 0x10)));
+ CHECK(!code_map.FindEntry(ToAddress(0xFFFFFFFF)));
}
CHECK_EQ(&entry1, code_map.FindEntry(ToAddress(0x1500)));
CHECK_EQ(&entry2, code_map.FindEntry(ToAddress(0x1700)));
code_map.MoveCode(ToAddress(0x1500), ToAddress(0x1700)); // Deprecate bbb.
- CHECK_EQ(NULL, code_map.FindEntry(ToAddress(0x1500)));
+ CHECK(!code_map.FindEntry(ToAddress(0x1500)));
CHECK_EQ(&entry1, code_map.FindEntry(ToAddress(0x1700)));
CodeEntry entry3(i::Logger::FUNCTION_TAG, "ccc");
code_map.AddCode(ToAddress(0x1750), &entry3, 0x100);
- CHECK_EQ(NULL, code_map.FindEntry(ToAddress(0x1700)));
+ CHECK(!code_map.FindEntry(ToAddress(0x1700)));
CHECK_EQ(&entry3, code_map.FindEntry(ToAddress(0x1750)));
}
generator.RecordTickSample(sample3);
CpuProfile* profile = profiles.StopProfiling("");
- CHECK_NE(NULL, profile);
+ CHECK(profile);
ProfileTreeTestHelper top_down_test_helper(profile->top_down());
- CHECK_EQ(NULL, top_down_test_helper.Walk(entry2));
- CHECK_EQ(NULL, top_down_test_helper.Walk(entry3));
+ CHECK(!top_down_test_helper.Walk(entry2));
+ CHECK(!top_down_test_helper.Walk(entry3));
ProfileNode* node1 = top_down_test_helper.Walk(entry1);
- CHECK_NE(NULL, node1);
+ CHECK(node1);
CHECK_EQ(entry1, node1->entry());
ProfileNode* node2 = top_down_test_helper.Walk(entry1, entry1);
- CHECK_NE(NULL, node2);
+ CHECK(node2);
CHECK_EQ(entry1, node2->entry());
ProfileNode* node3 = top_down_test_helper.Walk(entry1, entry2, entry3);
- CHECK_NE(NULL, node3);
+ CHECK(node3);
CHECK_EQ(entry3, node3->entry());
ProfileNode* node4 = top_down_test_helper.Walk(entry1, entry3, entry1);
- CHECK_NE(NULL, node4);
+ CHECK(node4);
CHECK_EQ(entry1, node4->entry());
}
-static void CheckNodeIds(ProfileNode* node, int* expectedId) {
+static void CheckNodeIds(ProfileNode* node, unsigned* expectedId) {
CHECK_EQ((*expectedId)++, node->id());
for (int i = 0; i < node->children()->length(); i++) {
CheckNodeIds(node->children()->at(i), expectedId);
generator.RecordTickSample(sample3);
CpuProfile* profile = profiles.StopProfiling("");
- int nodeId = 1;
+ unsigned nodeId = 1;
CheckNodeIds(profile->top_down()->root(), &nodeId);
- CHECK_EQ(7, nodeId - 1);
+ CHECK_EQ(7u, nodeId - 1);
CHECK_EQ(3, profile->samples_count());
- int expected_id[] = {3, 5, 7};
+ unsigned expected_id[] = {3, 5, 7};
for (int i = 0; i < 3; i++) {
CHECK_EQ(expected_id[i], profile->sample(i)->id());
}
generator.RecordTickSample(sample1);
CpuProfile* profile = profiles.StopProfiling("");
- int nodeId = 1;
+ unsigned nodeId = 1;
CheckNodeIds(profile->top_down()->root(), &nodeId);
- CHECK_EQ(3, nodeId - 1);
+ CHECK_EQ(3u, nodeId - 1);
CHECK_EQ(0, profile->samples_count());
}
// startProfiling
// if the sampler managed to get a tick.
current = PickChild(current, "");
- CHECK_NE(NULL, const_cast<ProfileNode*>(current));
+ CHECK(const_cast<ProfileNode*>(current));
current = PickChild(current, "a");
- CHECK_NE(NULL, const_cast<ProfileNode*>(current));
+ CHECK(const_cast<ProfileNode*>(current));
current = PickChild(current, "b");
- CHECK_NE(NULL, const_cast<ProfileNode*>(current));
+ CHECK(const_cast<ProfileNode*>(current));
current = PickChild(current, "c");
- CHECK_NE(NULL, const_cast<ProfileNode*>(current));
+ CHECK(const_cast<ProfileNode*>(current));
CHECK(current->children()->length() == 0 ||
current->children()->length() == 1);
if (current->children()->length() == 1) {
// startProfiling
// if the sampler managed to get a tick.
current = PickChild(current, "");
- CHECK_NE(NULL, const_cast<v8::CpuProfileNode*>(current));
+ CHECK(const_cast<v8::CpuProfileNode*>(current));
current = PickChild(current, "b");
- CHECK_NE(NULL, const_cast<v8::CpuProfileNode*>(current));
+ CHECK(const_cast<v8::CpuProfileNode*>(current));
CHECK_EQ(script_b->GetUnboundScript()->GetId(), current->GetScriptId());
current = PickChild(current, "a");
- CHECK_NE(NULL, const_cast<v8::CpuProfileNode*>(current));
+ CHECK(const_cast<v8::CpuProfileNode*>(current));
CHECK_EQ(script_a->GetUnboundScript()->GetId(), current->GetScriptId());
}
// kTryFinally
// kTryCatch
current = PickChild(current, "");
- CHECK_NE(NULL, const_cast<v8::CpuProfileNode*>(current));
+ CHECK(const_cast<v8::CpuProfileNode*>(current));
current = PickChild(current, "TryFinally");
- CHECK_NE(NULL, const_cast<v8::CpuProfileNode*>(current));
+ CHECK(const_cast<v8::CpuProfileNode*>(current));
CHECK(!strcmp("TryFinallyStatement", current->GetBailoutReason()));
current = PickChild(current, "TryCatch");
- CHECK_NE(NULL, const_cast<v8::CpuProfileNode*>(current));
+ CHECK(const_cast<v8::CpuProfileNode*>(current));
CHECK(!strcmp("TryCatchStatement", current->GetBailoutReason()));
}
CHECK(result.error.is_null());
std::ostringstream os;
result.tree->Print(os, &zone);
- CHECK_EQ(expected, os.str().c_str());
+ CHECK_EQ(0, strcmp(expected, os.str().c_str()));
}
CHECK(result.tree == NULL);
CHECK(!result.error.is_null());
SmartArrayPointer<char> str = result.error->ToCString(ALLOW_NULLS);
- CHECK_EQ(expected, str.get());
+ CHECK_EQ(0, strcmp(expected, str.get()));
}
} while (false)
for (int i = 0; i < 50; i++) {
for (int j = 0; j < 50; j++) {
- unsigned next = PseudoRandom(i, j) % kLimit;
+ int next = PseudoRandom(i, j) % kLimit;
if (seen[next]) {
// We've already seen this one. Check the value and remove
// it.
TEST(LatinCanonicalize) {
unibrow::Mapping<unibrow::Ecma262UnCanonicalize> un_canonicalize;
- for (char lower = 'a'; lower <= 'z'; lower++) {
- char upper = lower + ('A' - 'a');
+ for (unibrow::uchar lower = 'a'; lower <= 'z'; lower++) {
+ unibrow::uchar upper = lower + ('A' - 'a');
CHECK_EQ(canonicalize(lower), canonicalize(upper));
unibrow::uchar uncanon[unibrow::Ecma262UnCanonicalize::kMaxWidth];
int length = un_canonicalize.get(lower, '\0', uncanon);
explicit SamplingTestHelper(const std::string& test_function)
: sample_is_taken_(false), isolate_(CcTest::isolate()) {
- DCHECK_EQ(NULL, instance_);
+ DCHECK(!instance_);
instance_ = this;
v8::HandleScope scope(isolate_);
v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(isolate_);
const SamplingTestHelper::CodeEventEntry* entry;
entry = helper.FindEventEntry(sample.begin()[0]);
- CHECK_NE(NULL, entry);
+ CHECK(entry);
CHECK(std::string::npos != entry->name.find("test_sampler_api_inner"));
entry = helper.FindEventEntry(sample.begin()[1]);
- CHECK_NE(NULL, entry);
+ CHECK(entry);
CHECK(std::string::npos != entry->name.find("test_sampler_api_outer"));
}
}
-static int make_code(TypeCode type, int id) {
+static uint32_t make_code(TypeCode type, int id) {
return static_cast<uint32_t>(type) << kReferenceTypeShift | id;
}
CHECK(v8::Utils::OpenHandle(*slice)->IsSlicedString());
CHECK(v8::Utils::OpenHandle(*underlying)->IsExternalTwoByteString());
- CHECK_EQ("\"bcdefghijklmnopqrstuvwxyz\"",
- *v8::String::Utf8Value(CompileRun("JSON.stringify(slice)")));
+ CHECK_EQ(0,
+ strcmp("\"bcdefghijklmnopqrstuvwxyz\"",
+ *v8::String::Utf8Value(CompileRun("JSON.stringify(slice)"))));
}
CHECK(result->IsString());
string = v8::Utils::OpenHandle(v8::String::Cast(*result));
CHECK(string->IsSlicedString());
- CHECK_EQ("bcdefghijklmnopqrstuvwxy", string->ToCString().get());
+ CHECK_EQ(0, strcmp("bcdefghijklmnopqrstuvwxy", string->ToCString().get()));
}
string = v8::Utils::OpenHandle(v8::String::Cast(*result));
CHECK(string->IsSlicedString());
CHECK(SlicedString::cast(*string)->parent()->IsSeqString());
- CHECK_EQ("bcdefghijklmnopqrstuvwxy", string->ToCString().get());
+ CHECK_EQ(0, strcmp("bcdefghijklmnopqrstuvwxy", string->ToCString().get()));
result = CompileRun(slice_from_slice);
CHECK(result->IsString());
string = v8::Utils::OpenHandle(v8::String::Cast(*result));
CHECK(string->IsSlicedString());
CHECK(SlicedString::cast(*string)->parent()->IsSeqString());
- CHECK_EQ("cdefghijklmnopqrstuvwx", string->ToCString().get());
+ CHECK_EQ(0, strcmp("cdefghijklmnopqrstuvwx", string->ToCString().get()));
}
// Ordinary HeapNumbers can be handled (in runtime).
result = CompileRun("%_SubString(short, Math.sqrt(4), 5.1);");
string = v8::Utils::OpenHandle(v8::String::Cast(*result));
- CHECK_EQ("cde", string->ToCString().get());
+ CHECK_EQ(0, strcmp("cde", string->ToCString().get()));
CompileRun("var long = 'abcdefghijklmnopqrstuvwxyz';");
// Invalid indices.
// Ordinary HeapNumbers within bounds can be handled (in runtime).
result = CompileRun("%_SubString(long, Math.sqrt(4), 17.1);");
string = v8::Utils::OpenHandle(v8::String::Cast(*result));
- CHECK_EQ("cdefghijklmnopq", string->ToCString().get());
+ CHECK_EQ(0, strcmp("cdefghijklmnopq", string->ToCString().get()));
// Test that out-of-bounds substring of a slice fails when the indices
// would have been valid for the underlying string.
CHECK(symbols[i]->IsName());
CHECK(symbols[i]->IsSymbol());
CHECK(symbols[i]->HasHashCode());
- CHECK_GT(symbols[i]->Hash(), 0);
+ CHECK_GT(symbols[i]->Hash(), 0u);
os << Brief(*symbols[i]) << "\n";
#if OBJECT_PRINT
symbols[i]->Print(os);
// Test version without specific SONAME.
SetVersion(major, minor, build, patch, candidate, "");
Version::GetString(version_str);
- CHECK_EQ(expected_version_string, version_str.start());
+ CHECK_EQ(0, strcmp(expected_version_string, version_str.start()));
Version::GetSONAME(soname_str);
- CHECK_EQ(expected_generic_soname, soname_str.start());
+ CHECK_EQ(0, strcmp(expected_generic_soname, soname_str.start()));
// Test version with specific SONAME.
const char* soname = "libv8.so.1";
SetVersion(major, minor, build, patch, candidate, soname);
Version::GetString(version_str);
- CHECK_EQ(expected_version_string, version_str.start());
+ CHECK_EQ(0, strcmp(expected_version_string, version_str.start()));
Version::GetSONAME(soname_str);
- CHECK_EQ(soname, soname_str.start());
+ CHECK_EQ(0, strcmp(soname, soname_str.start()));
}
Address TraceExtension::GetJsEntrySp() {
- CHECK_NE(NULL, CcTest::i_isolate()->thread_local_top());
+ CHECK(CcTest::i_isolate()->thread_local_top());
return CcTest::i_isolate()->js_entry_sp();
}
void TraceExtension::JSEntrySP(
const v8::FunctionCallbackInfo<v8::Value>& args) {
- CHECK_NE(0, GetJsEntrySp());
+ CHECK(GetJsEntrySp());
}
const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::HandleScope scope(args.GetIsolate());
const Address js_entry_sp = GetJsEntrySp();
- CHECK_NE(0, js_entry_sp);
+ CHECK(js_entry_sp);
CompileRun("js_entry_sp();");
CHECK_EQ(js_entry_sp, GetJsEntrySp());
}
--- /dev/null
+// Copyright 2015 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "src/base/logging.h"
+#include "testing/gtest-support.h"
+
+namespace v8 {
+namespace base {
+
+TEST(LoggingTest, CheckEQImpl) {
+ EXPECT_EQ(nullptr, CheckEQImpl(0.0, 0.0, ""));
+ EXPECT_EQ(nullptr, CheckEQImpl(0.0, -0.0, ""));
+ EXPECT_EQ(nullptr, CheckEQImpl(-0.0, 0.0, ""));
+ EXPECT_EQ(nullptr, CheckEQImpl(-0.0, -0.0, ""));
+}
+
+} // namespace base
+} // namespace v8
InstructionCode code, size_t outputs_size, InstructionOperand** outputs,
size_t inputs_size, InstructionOperand** inputs, size_t temps_size,
InstructionOperand** temps) {
- CHECK_NE(nullptr, current_block_);
+ CHECK(current_block_);
return Instruction::New(zone(), code, outputs_size, outputs, inputs_size,
inputs, temps_size, temps);
}
void InstructionSequenceTest::WireBlocks() {
- CHECK_EQ(nullptr, current_block());
+ CHECK(!current_block());
CHECK(instruction_blocks_.size() == completions_.size());
size_t offset = 0;
for (const auto& completion : completions_) {
for (int i = 0; i < static_cast<int>(order->size()); i++) {
CHECK(order->at(i)->rpo_number() == i);
if (!loops_allowed) {
- CHECK_EQ(NULL, order->at(i)->loop_end());
- CHECK_EQ(NULL, order->at(i)->loop_header());
+ CHECK(!order->at(i)->loop_end());
+ CHECK(!order->at(i)->loop_header());
}
}
}
int body_size) {
BasicBlock* header = blocks[0];
BasicBlock* end = header->loop_end();
- CHECK_NE(NULL, end);
+ CHECK(end);
CHECK_GT(end->rpo_number(), 0);
CHECK_EQ(body_size, end->rpo_number() - header->rpo_number());
for (int i = 0; i < body_size; i++) {
'base/division-by-constant-unittest.cc',
'base/flags-unittest.cc',
'base/functional-unittest.cc',
+ 'base/logging-unittest.cc',
'base/iterator-unittest.cc',
'base/platform/condition-variable-unittest.cc',
'base/platform/mutex-unittest.cc',