15de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org// Copyright 2012 the V8 project authors. All rights reserved.
25de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org// Use of this source code is governed by a BSD-style license that can be
35de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org// found in the LICENSE file.
45de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org
55de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org#ifndef V8_BASE_LOGGING_H_
65de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org#define V8_BASE_LOGGING_H_
75de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org
85de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org#include <string.h>
95de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org
105de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org#include "include/v8stdint.h"
115de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org#include "src/base/build_config.h"
125de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org
135de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.orgextern "C" void V8_Fatal(const char* file, int line, const char* format, ...);
145de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org
155de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org
165de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org// The FATAL, UNREACHABLE and UNIMPLEMENTED macros are useful during
175de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org// development, but they should not be relied on in the final product.
185de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org#ifdef DEBUG
195de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org#define FATAL(msg)                              \
205de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org  V8_Fatal(__FILE__, __LINE__, "%s", (msg))
215de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org#define UNIMPLEMENTED()                         \
225de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org  V8_Fatal(__FILE__, __LINE__, "unimplemented code")
235de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org#define UNREACHABLE()                           \
245de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org  V8_Fatal(__FILE__, __LINE__, "unreachable code")
255de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org#else
265de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org#define FATAL(msg)                              \
275de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org  V8_Fatal("", 0, "%s", (msg))
285de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org#define UNIMPLEMENTED()                         \
295de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org  V8_Fatal("", 0, "unimplemented code")
305de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org#define UNREACHABLE() ((void) 0)
315de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org#endif
325de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org
335de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org
345de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org// The CHECK macro checks that the given condition is true; if not, it
355de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org// prints a message to stderr and aborts.
365de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org#define CHECK(condition) do {                                       \
375de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org    if (!(condition)) {                                             \
385de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org      V8_Fatal(__FILE__, __LINE__, "CHECK(%s) failed", #condition); \
395de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org    }                                                               \
405de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org  } while (0)
415de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org
425de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org
435de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org// Helper function used by the CHECK_EQ function when given int
445de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org// arguments.  Should not be called directly.
455de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.orginline void CheckEqualsHelper(const char* file, int line,
465de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org                              const char* expected_source, int expected,
475de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org                              const char* value_source, int value) {
485de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org  if (expected != value) {
495de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org    V8_Fatal(file, line,
505de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org             "CHECK_EQ(%s, %s) failed\n#   Expected: %i\n#   Found: %i",
515de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org             expected_source, value_source, expected, value);
525de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org  }
535de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org}
545de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org
555de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org
565de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org// Helper function used by the CHECK_EQ function when given int64_t
575de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org// arguments.  Should not be called directly.
585de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.orginline void CheckEqualsHelper(const char* file, int line,
595de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org                              const char* expected_source,
605de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org                              int64_t expected,
615de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org                              const char* value_source,
625de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org                              int64_t value) {
635de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org  if (expected != value) {
645de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org    // Print int64_t values in hex, as two int32s,
655de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org    // to avoid platform-dependencies.
665de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org    V8_Fatal(file, line,
675de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org             "CHECK_EQ(%s, %s) failed\n#"
685de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org             "   Expected: 0x%08x%08x\n#   Found: 0x%08x%08x",
695de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org             expected_source, value_source,
705de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org             static_cast<uint32_t>(expected >> 32),
715de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org             static_cast<uint32_t>(expected),
725de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org             static_cast<uint32_t>(value >> 32),
735de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org             static_cast<uint32_t>(value));
745de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org  }
755de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org}
765de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org
775de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org
785de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org// Helper function used by the CHECK_NE function when given int
795de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org// arguments.  Should not be called directly.
805de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.orginline void CheckNonEqualsHelper(const char* file,
815de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org                                 int line,
825de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org                                 const char* unexpected_source,
835de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org                                 int unexpected,
845de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org                                 const char* value_source,
855de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org                                 int value) {
865de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org  if (unexpected == value) {
875de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org    V8_Fatal(file, line, "CHECK_NE(%s, %s) failed\n#   Value: %i",
885de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org             unexpected_source, value_source, value);
895de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org  }
905de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org}
915de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org
925de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org
935de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org// Helper function used by the CHECK function when given string
945de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org// arguments.  Should not be called directly.
955de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.orginline void CheckEqualsHelper(const char* file,
965de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org                              int line,
975de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org                              const char* expected_source,
985de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org                              const char* expected,
995de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org                              const char* value_source,
1005de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org                              const char* value) {
1015de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org  if ((expected == NULL && value != NULL) ||
1025de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org      (expected != NULL && value == NULL) ||
1035de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org      (expected != NULL && value != NULL && strcmp(expected, value) != 0)) {
1045de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org    V8_Fatal(file, line,
1055de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org             "CHECK_EQ(%s, %s) failed\n#   Expected: %s\n#   Found: %s",
1065de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org             expected_source, value_source, expected, value);
1075de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org  }
1085de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org}
1095de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org
1105de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org
1115de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.orginline void CheckNonEqualsHelper(const char* file,
1125de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org                                 int line,
1135de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org                                 const char* expected_source,
1145de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org                                 const char* expected,
1155de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org                                 const char* value_source,
1165de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org                                 const char* value) {
1175de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org  if (expected == value ||
1185de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org      (expected != NULL && value != NULL && strcmp(expected, value) == 0)) {
1195de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org    V8_Fatal(file, line, "CHECK_NE(%s, %s) failed\n#   Value: %s",
1205de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org             expected_source, value_source, value);
1215de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org  }
1225de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org}
1235de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org
1245de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org
1255de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org// Helper function used by the CHECK function when given pointer
1265de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org// arguments.  Should not be called directly.
1275de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.orginline void CheckEqualsHelper(const char* file,
1285de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org                              int line,
1295de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org                              const char* expected_source,
1305de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org                              const void* expected,
1315de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org                              const char* value_source,
1325de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org                              const void* value) {
1335de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org  if (expected != value) {
1345de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org    V8_Fatal(file, line,
1355de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org             "CHECK_EQ(%s, %s) failed\n#   Expected: %p\n#   Found: %p",
1365de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org             expected_source, value_source,
1375de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org             expected, value);
1385de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org  }
1395de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org}
1405de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org
1415de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org
1425de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.orginline void CheckNonEqualsHelper(const char* file,
1435de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org                                 int line,
1445de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org                                 const char* expected_source,
1455de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org                                 const void* expected,
1465de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org                                 const char* value_source,
1475de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org                                 const void* value) {
1485de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org  if (expected == value) {
1495de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org    V8_Fatal(file, line, "CHECK_NE(%s, %s) failed\n#   Value: %p",
1505de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org             expected_source, value_source, value);
1515de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org  }
1525de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org}
1535de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org
1545de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org
1555de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.orginline void CheckNonEqualsHelper(const char* file,
1565de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org                              int line,
1575de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org                              const char* expected_source,
1585de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org                              int64_t expected,
1595de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org                              const char* value_source,
1605de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org                              int64_t value) {
1615de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org  if (expected == value) {
1625de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org    V8_Fatal(file, line,
1635de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org             "CHECK_EQ(%s, %s) failed\n#   Expected: %f\n#   Found: %f",
1645de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org             expected_source, value_source, expected, value);
1655de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org  }
1665de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org}
1675de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org
1685de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org
1695de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org#define CHECK_EQ(expected, value) CheckEqualsHelper(__FILE__, __LINE__, \
1705de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org  #expected, expected, #value, value)
1715de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org
1725de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org
1735de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org#define CHECK_NE(unexpected, value) CheckNonEqualsHelper(__FILE__, __LINE__, \
1745de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org  #unexpected, unexpected, #value, value)
1755de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org
1765de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org
1775de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org#define CHECK_GT(a, b) CHECK((a) > (b))
1785de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org#define CHECK_GE(a, b) CHECK((a) >= (b))
1795de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org#define CHECK_LT(a, b) CHECK((a) < (b))
1805de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org#define CHECK_LE(a, b) CHECK((a) <= (b))
1815de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org
1825de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org
1835de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.orgnamespace v8 {
1845de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.orgnamespace base {
1855de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org
1865de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org// Exposed for making debugging easier (to see where your function is being
1875de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org// called, just add a call to DumpBacktrace).
1885de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.orgvoid DumpBacktrace();
1895de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org
1905de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org} }  // namespace v8::base
1915de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org
1925de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org
193e3c177a423baa3c30225c4e422b6f6c76d38b951machenbach@chromium.org// The DCHECK macro is equivalent to CHECK except that it only
1945de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org// generates code in debug builds.
1955de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org#ifdef DEBUG
196e3c177a423baa3c30225c4e422b6f6c76d38b951machenbach@chromium.org#define DCHECK_RESULT(expr)    CHECK(expr)
197e3c177a423baa3c30225c4e422b6f6c76d38b951machenbach@chromium.org#define DCHECK(condition)      CHECK(condition)
198e3c177a423baa3c30225c4e422b6f6c76d38b951machenbach@chromium.org#define DCHECK_EQ(v1, v2)      CHECK_EQ(v1, v2)
199e3c177a423baa3c30225c4e422b6f6c76d38b951machenbach@chromium.org#define DCHECK_NE(v1, v2)      CHECK_NE(v1, v2)
200e3c177a423baa3c30225c4e422b6f6c76d38b951machenbach@chromium.org#define DCHECK_GE(v1, v2)      CHECK_GE(v1, v2)
201e3c177a423baa3c30225c4e422b6f6c76d38b951machenbach@chromium.org#define DCHECK_LT(v1, v2)      CHECK_LT(v1, v2)
202e3c177a423baa3c30225c4e422b6f6c76d38b951machenbach@chromium.org#define DCHECK_LE(v1, v2)      CHECK_LE(v1, v2)
2035de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org#else
204e3c177a423baa3c30225c4e422b6f6c76d38b951machenbach@chromium.org#define DCHECK_RESULT(expr)    (expr)
205e3c177a423baa3c30225c4e422b6f6c76d38b951machenbach@chromium.org#define DCHECK(condition)      ((void) 0)
206e3c177a423baa3c30225c4e422b6f6c76d38b951machenbach@chromium.org#define DCHECK_EQ(v1, v2)      ((void) 0)
207e3c177a423baa3c30225c4e422b6f6c76d38b951machenbach@chromium.org#define DCHECK_NE(v1, v2)      ((void) 0)
208e3c177a423baa3c30225c4e422b6f6c76d38b951machenbach@chromium.org#define DCHECK_GE(v1, v2)      ((void) 0)
209e3c177a423baa3c30225c4e422b6f6c76d38b951machenbach@chromium.org#define DCHECK_LT(v1, v2)      ((void) 0)
210e3c177a423baa3c30225c4e422b6f6c76d38b951machenbach@chromium.org#define DCHECK_LE(v1, v2)      ((void) 0)
2115de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org#endif
2125de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org
213e3c177a423baa3c30225c4e422b6f6c76d38b951machenbach@chromium.org#define DCHECK_NOT_NULL(p)  DCHECK_NE(NULL, p)
2145de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org
2155de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org// "Extra checks" are lightweight checks that are enabled in some release
2165de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org// builds.
2175de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org#ifdef ENABLE_EXTRA_CHECKS
2185de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org#define EXTRA_CHECK(condition) CHECK(condition)
2195de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org#else
2205de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org#define EXTRA_CHECK(condition) ((void) 0)
2215de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org#endif
2225de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org
2235de0074a922429f5e0ec2cf140c2d2989bf88140yangguo@chromium.org#endif  // V8_BASE_LOGGING_H_
224