12e5b6d6dSopenharmony_ci// Copyright 2006-2008 the V8 project authors. All rights reserved.
22e5b6d6dSopenharmony_ci// Redistribution and use in source and binary forms, with or without
32e5b6d6dSopenharmony_ci// modification, are permitted provided that the following conditions are
42e5b6d6dSopenharmony_ci// met:
52e5b6d6dSopenharmony_ci//
62e5b6d6dSopenharmony_ci//     * Redistributions of source code must retain the above copyright
72e5b6d6dSopenharmony_ci//       notice, this list of conditions and the following disclaimer.
82e5b6d6dSopenharmony_ci//     * Redistributions in binary form must reproduce the above
92e5b6d6dSopenharmony_ci//       copyright notice, this list of conditions and the following
102e5b6d6dSopenharmony_ci//       disclaimer in the documentation and/or other materials provided
112e5b6d6dSopenharmony_ci//       with the distribution.
122e5b6d6dSopenharmony_ci//     * Neither the name of Google Inc. nor the names of its
132e5b6d6dSopenharmony_ci//       contributors may be used to endorse or promote products derived
142e5b6d6dSopenharmony_ci//       from this software without specific prior written permission.
152e5b6d6dSopenharmony_ci//
162e5b6d6dSopenharmony_ci// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
172e5b6d6dSopenharmony_ci// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
182e5b6d6dSopenharmony_ci// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
192e5b6d6dSopenharmony_ci// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
202e5b6d6dSopenharmony_ci// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
212e5b6d6dSopenharmony_ci// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
222e5b6d6dSopenharmony_ci// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
232e5b6d6dSopenharmony_ci// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
242e5b6d6dSopenharmony_ci// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
252e5b6d6dSopenharmony_ci// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
262e5b6d6dSopenharmony_ci// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
272e5b6d6dSopenharmony_ci
282e5b6d6dSopenharmony_ci#ifndef V8_CHECKS_H_
292e5b6d6dSopenharmony_ci#define V8_CHECKS_H_
302e5b6d6dSopenharmony_ci
312e5b6d6dSopenharmony_ci#include <string.h>
322e5b6d6dSopenharmony_ci
332e5b6d6dSopenharmony_ci#include "flags.h"
342e5b6d6dSopenharmony_ci
352e5b6d6dSopenharmony_ciextern "C" void V8_Fatal(const char* file, int line, const char* format, ...);
362e5b6d6dSopenharmony_civoid API_Fatal(const char* location, const char* format, ...);
372e5b6d6dSopenharmony_ci
382e5b6d6dSopenharmony_ci// The FATAL, DOUBLE_CONVERSION_UNREACHABLE and DOUBLE_CONVERSION_UNIMPLEMENTED macros are useful during
392e5b6d6dSopenharmony_ci// development, but they should not be relied on in the final product.
402e5b6d6dSopenharmony_ci#ifdef DEBUG
412e5b6d6dSopenharmony_ci#define FATAL(msg)                              \
422e5b6d6dSopenharmony_ci  V8_Fatal(__FILE__, __LINE__, "%s", (msg))
432e5b6d6dSopenharmony_ci#define DOUBLE_CONVERSION_UNIMPLEMENTED()                         \
442e5b6d6dSopenharmony_ci  V8_Fatal(__FILE__, __LINE__, "unimplemented code")
452e5b6d6dSopenharmony_ci#define DOUBLE_CONVERSION_UNREACHABLE()                           \
462e5b6d6dSopenharmony_ci  V8_Fatal(__FILE__, __LINE__, "unreachable code")
472e5b6d6dSopenharmony_ci#else
482e5b6d6dSopenharmony_ci#define FATAL(msg)                              \
492e5b6d6dSopenharmony_ci  V8_Fatal("", 0, "%s", (msg))
502e5b6d6dSopenharmony_ci#define DOUBLE_CONVERSION_UNIMPLEMENTED()                         \
512e5b6d6dSopenharmony_ci  V8_Fatal("", 0, "unimplemented code")
522e5b6d6dSopenharmony_ci#define DOUBLE_CONVERSION_UNREACHABLE() ((void) 0)
532e5b6d6dSopenharmony_ci#endif
542e5b6d6dSopenharmony_ci
552e5b6d6dSopenharmony_ci
562e5b6d6dSopenharmony_ci// Used by the CHECK macro -- should not be called directly.
572e5b6d6dSopenharmony_cistatic inline void CheckHelper(const char* file,
582e5b6d6dSopenharmony_ci                               int line,
592e5b6d6dSopenharmony_ci                               const char* source,
602e5b6d6dSopenharmony_ci                               bool condition) {
612e5b6d6dSopenharmony_ci  if (!condition)
622e5b6d6dSopenharmony_ci    V8_Fatal(file, line, "CHECK(%s) failed", source);
632e5b6d6dSopenharmony_ci}
642e5b6d6dSopenharmony_ci
652e5b6d6dSopenharmony_ci
662e5b6d6dSopenharmony_ci// The CHECK macro checks that the given condition is true; if not, it
672e5b6d6dSopenharmony_ci// prints a message to stderr and aborts.
682e5b6d6dSopenharmony_ci#define CHECK(condition) CheckHelper(__FILE__, __LINE__, #condition, condition)
692e5b6d6dSopenharmony_ci
702e5b6d6dSopenharmony_ci
712e5b6d6dSopenharmony_ci// Helper function used by the CHECK_EQ function when given int
722e5b6d6dSopenharmony_ci// arguments.  Should not be called directly.
732e5b6d6dSopenharmony_cistatic inline void CheckEqualsHelper(const char* file, int line,
742e5b6d6dSopenharmony_ci                                     const char* expected_source, int expected,
752e5b6d6dSopenharmony_ci                                     const char* value_source, int value) {
762e5b6d6dSopenharmony_ci  if (expected != value) {
772e5b6d6dSopenharmony_ci    V8_Fatal(file, line,
782e5b6d6dSopenharmony_ci             "CHECK_EQ(%s, %s) failed\n#   Expected: %i\n#   Found: %i",
792e5b6d6dSopenharmony_ci             expected_source, value_source, expected, value);
802e5b6d6dSopenharmony_ci  }
812e5b6d6dSopenharmony_ci}
822e5b6d6dSopenharmony_ci
832e5b6d6dSopenharmony_ci
842e5b6d6dSopenharmony_ci// Helper function used by the CHECK_EQ function when given int64_t
852e5b6d6dSopenharmony_ci// arguments.  Should not be called directly.
862e5b6d6dSopenharmony_cistatic inline void CheckEqualsHelper(const char* file, int line,
872e5b6d6dSopenharmony_ci                                     const char* expected_source,
882e5b6d6dSopenharmony_ci                                     int64_t expected,
892e5b6d6dSopenharmony_ci                                     const char* value_source,
902e5b6d6dSopenharmony_ci                                     int64_t value) {
912e5b6d6dSopenharmony_ci  if (expected != value) {
922e5b6d6dSopenharmony_ci    // Print int64_t values in hex, as two int32s,
932e5b6d6dSopenharmony_ci    // to avoid platform-dependencies.
942e5b6d6dSopenharmony_ci    V8_Fatal(file, line,
952e5b6d6dSopenharmony_ci             "CHECK_EQ(%s, %s) failed\n#"
962e5b6d6dSopenharmony_ci             "   Expected: 0x%08x%08x\n#   Found: 0x%08x%08x",
972e5b6d6dSopenharmony_ci             expected_source, value_source,
982e5b6d6dSopenharmony_ci             static_cast<uint32_t>(expected >> 32),
992e5b6d6dSopenharmony_ci             static_cast<uint32_t>(expected),
1002e5b6d6dSopenharmony_ci             static_cast<uint32_t>(value >> 32),
1012e5b6d6dSopenharmony_ci             static_cast<uint32_t>(value));
1022e5b6d6dSopenharmony_ci  }
1032e5b6d6dSopenharmony_ci}
1042e5b6d6dSopenharmony_ci
1052e5b6d6dSopenharmony_ci
1062e5b6d6dSopenharmony_ci// Helper function used by the CHECK_NE function when given int
1072e5b6d6dSopenharmony_ci// arguments.  Should not be called directly.
1082e5b6d6dSopenharmony_cistatic inline void CheckNonEqualsHelper(const char* file,
1092e5b6d6dSopenharmony_ci                                        int line,
1102e5b6d6dSopenharmony_ci                                        const char* unexpected_source,
1112e5b6d6dSopenharmony_ci                                        int unexpected,
1122e5b6d6dSopenharmony_ci                                        const char* value_source,
1132e5b6d6dSopenharmony_ci                                        int value) {
1142e5b6d6dSopenharmony_ci  if (unexpected == value) {
1152e5b6d6dSopenharmony_ci    V8_Fatal(file, line, "CHECK_NE(%s, %s) failed\n#   Value: %i",
1162e5b6d6dSopenharmony_ci             unexpected_source, value_source, value);
1172e5b6d6dSopenharmony_ci  }
1182e5b6d6dSopenharmony_ci}
1192e5b6d6dSopenharmony_ci
1202e5b6d6dSopenharmony_ci
1212e5b6d6dSopenharmony_ci// Helper function used by the CHECK function when given string
1222e5b6d6dSopenharmony_ci// arguments.  Should not be called directly.
1232e5b6d6dSopenharmony_cistatic inline void CheckEqualsHelper(const char* file,
1242e5b6d6dSopenharmony_ci                                     int line,
1252e5b6d6dSopenharmony_ci                                     const char* expected_source,
1262e5b6d6dSopenharmony_ci                                     const char* expected,
1272e5b6d6dSopenharmony_ci                                     const char* value_source,
1282e5b6d6dSopenharmony_ci                                     const char* value) {
1292e5b6d6dSopenharmony_ci  if ((expected == NULL && value != NULL) ||
1302e5b6d6dSopenharmony_ci      (expected != NULL && value == NULL) ||
1312e5b6d6dSopenharmony_ci      (expected != NULL && value != NULL && strcmp(expected, value) != 0)) {
1322e5b6d6dSopenharmony_ci    V8_Fatal(file, line,
1332e5b6d6dSopenharmony_ci             "CHECK_EQ(%s, %s) failed\n#   Expected: %s\n#   Found: %s",
1342e5b6d6dSopenharmony_ci             expected_source, value_source, expected, value);
1352e5b6d6dSopenharmony_ci  }
1362e5b6d6dSopenharmony_ci}
1372e5b6d6dSopenharmony_ci
1382e5b6d6dSopenharmony_ci
1392e5b6d6dSopenharmony_cistatic inline void CheckNonEqualsHelper(const char* file,
1402e5b6d6dSopenharmony_ci                                        int line,
1412e5b6d6dSopenharmony_ci                                        const char* expected_source,
1422e5b6d6dSopenharmony_ci                                        const char* expected,
1432e5b6d6dSopenharmony_ci                                        const char* value_source,
1442e5b6d6dSopenharmony_ci                                        const char* value) {
1452e5b6d6dSopenharmony_ci  if (expected == value ||
1462e5b6d6dSopenharmony_ci      (expected != NULL && value != NULL && strcmp(expected, value) == 0)) {
1472e5b6d6dSopenharmony_ci    V8_Fatal(file, line, "CHECK_NE(%s, %s) failed\n#   Value: %s",
1482e5b6d6dSopenharmony_ci             expected_source, value_source, value);
1492e5b6d6dSopenharmony_ci  }
1502e5b6d6dSopenharmony_ci}
1512e5b6d6dSopenharmony_ci
1522e5b6d6dSopenharmony_ci
1532e5b6d6dSopenharmony_ci// Helper function used by the CHECK function when given pointer
1542e5b6d6dSopenharmony_ci// arguments.  Should not be called directly.
1552e5b6d6dSopenharmony_cistatic inline void CheckEqualsHelper(const char* file,
1562e5b6d6dSopenharmony_ci                                     int line,
1572e5b6d6dSopenharmony_ci                                     const char* expected_source,
1582e5b6d6dSopenharmony_ci                                     const void* expected,
1592e5b6d6dSopenharmony_ci                                     const char* value_source,
1602e5b6d6dSopenharmony_ci                                     const void* value) {
1612e5b6d6dSopenharmony_ci  if (expected != value) {
1622e5b6d6dSopenharmony_ci    V8_Fatal(file, line,
1632e5b6d6dSopenharmony_ci             "CHECK_EQ(%s, %s) failed\n#   Expected: %p\n#   Found: %p",
1642e5b6d6dSopenharmony_ci             expected_source, value_source,
1652e5b6d6dSopenharmony_ci             expected, value);
1662e5b6d6dSopenharmony_ci  }
1672e5b6d6dSopenharmony_ci}
1682e5b6d6dSopenharmony_ci
1692e5b6d6dSopenharmony_ci
1702e5b6d6dSopenharmony_cistatic inline void CheckNonEqualsHelper(const char* file,
1712e5b6d6dSopenharmony_ci                                        int line,
1722e5b6d6dSopenharmony_ci                                        const char* expected_source,
1732e5b6d6dSopenharmony_ci                                        const void* expected,
1742e5b6d6dSopenharmony_ci                                        const char* value_source,
1752e5b6d6dSopenharmony_ci                                        const void* value) {
1762e5b6d6dSopenharmony_ci  if (expected == value) {
1772e5b6d6dSopenharmony_ci    V8_Fatal(file, line, "CHECK_NE(%s, %s) failed\n#   Value: %p",
1782e5b6d6dSopenharmony_ci             expected_source, value_source, value);
1792e5b6d6dSopenharmony_ci  }
1802e5b6d6dSopenharmony_ci}
1812e5b6d6dSopenharmony_ci
1822e5b6d6dSopenharmony_ci
1832e5b6d6dSopenharmony_ci// Helper function used by the CHECK function when given floating
1842e5b6d6dSopenharmony_ci// point arguments.  Should not be called directly.
1852e5b6d6dSopenharmony_cistatic inline void CheckEqualsHelper(const char* file,
1862e5b6d6dSopenharmony_ci                                     int line,
1872e5b6d6dSopenharmony_ci                                     const char* expected_source,
1882e5b6d6dSopenharmony_ci                                     double expected,
1892e5b6d6dSopenharmony_ci                                     const char* value_source,
1902e5b6d6dSopenharmony_ci                                     double value) {
1912e5b6d6dSopenharmony_ci  // Force values to 64 bit memory to truncate 80 bit precision on IA32.
1922e5b6d6dSopenharmony_ci  volatile double* exp = new double[1];
1932e5b6d6dSopenharmony_ci  *exp = expected;
1942e5b6d6dSopenharmony_ci  volatile double* val = new double[1];
1952e5b6d6dSopenharmony_ci  *val = value;
1962e5b6d6dSopenharmony_ci  if (*exp != *val) {
1972e5b6d6dSopenharmony_ci    V8_Fatal(file, line,
1982e5b6d6dSopenharmony_ci             "CHECK_EQ(%s, %s) failed\n#   Expected: %f\n#   Found: %f",
1992e5b6d6dSopenharmony_ci             expected_source, value_source, *exp, *val);
2002e5b6d6dSopenharmony_ci  }
2012e5b6d6dSopenharmony_ci  delete[] exp;
2022e5b6d6dSopenharmony_ci  delete[] val;
2032e5b6d6dSopenharmony_ci}
2042e5b6d6dSopenharmony_ci
2052e5b6d6dSopenharmony_ci
2062e5b6d6dSopenharmony_cistatic inline void CheckNonEqualsHelper(const char* file,
2072e5b6d6dSopenharmony_ci                                     int line,
2082e5b6d6dSopenharmony_ci                                     const char* expected_source,
2092e5b6d6dSopenharmony_ci                                     double expected,
2102e5b6d6dSopenharmony_ci                                     const char* value_source,
2112e5b6d6dSopenharmony_ci                                     double value) {
2122e5b6d6dSopenharmony_ci  // Force values to 64 bit memory to truncate 80 bit precision on IA32.
2132e5b6d6dSopenharmony_ci  volatile double* exp = new double[1];
2142e5b6d6dSopenharmony_ci  *exp = expected;
2152e5b6d6dSopenharmony_ci  volatile double* val = new double[1];
2162e5b6d6dSopenharmony_ci  *val = value;
2172e5b6d6dSopenharmony_ci  if (*exp == *val) {
2182e5b6d6dSopenharmony_ci    V8_Fatal(file, line,
2192e5b6d6dSopenharmony_ci             "CHECK_NE(%s, %s) failed\n#   Value: %f",
2202e5b6d6dSopenharmony_ci             expected_source, value_source, *val);
2212e5b6d6dSopenharmony_ci  }
2222e5b6d6dSopenharmony_ci  delete[] exp;
2232e5b6d6dSopenharmony_ci  delete[] val;
2242e5b6d6dSopenharmony_ci}
2252e5b6d6dSopenharmony_ci
2262e5b6d6dSopenharmony_ci
2272e5b6d6dSopenharmony_cinamespace v8 {
2282e5b6d6dSopenharmony_ci  class Value;
2292e5b6d6dSopenharmony_ci  template <class T> class Handle;
2302e5b6d6dSopenharmony_ci}
2312e5b6d6dSopenharmony_ci
2322e5b6d6dSopenharmony_ci
2332e5b6d6dSopenharmony_civoid CheckNonEqualsHelper(const char* file,
2342e5b6d6dSopenharmony_ci                          int line,
2352e5b6d6dSopenharmony_ci                          const char* unexpected_source,
2362e5b6d6dSopenharmony_ci                          v8::Handle<v8::Value> unexpected,
2372e5b6d6dSopenharmony_ci                          const char* value_source,
2382e5b6d6dSopenharmony_ci                          v8::Handle<v8::Value> value);
2392e5b6d6dSopenharmony_ci
2402e5b6d6dSopenharmony_ci
2412e5b6d6dSopenharmony_civoid CheckEqualsHelper(const char* file,
2422e5b6d6dSopenharmony_ci                       int line,
2432e5b6d6dSopenharmony_ci                       const char* expected_source,
2442e5b6d6dSopenharmony_ci                       v8::Handle<v8::Value> expected,
2452e5b6d6dSopenharmony_ci                       const char* value_source,
2462e5b6d6dSopenharmony_ci                       v8::Handle<v8::Value> value);
2472e5b6d6dSopenharmony_ci
2482e5b6d6dSopenharmony_ci
2492e5b6d6dSopenharmony_ci#define CHECK_EQ(expected, value) CheckEqualsHelper(__FILE__, __LINE__, \
2502e5b6d6dSopenharmony_ci  #expected, expected, #value, value)
2512e5b6d6dSopenharmony_ci
2522e5b6d6dSopenharmony_ci
2532e5b6d6dSopenharmony_ci#define CHECK_NE(unexpected, value) CheckNonEqualsHelper(__FILE__, __LINE__, \
2542e5b6d6dSopenharmony_ci  #unexpected, unexpected, #value, value)
2552e5b6d6dSopenharmony_ci
2562e5b6d6dSopenharmony_ci
2572e5b6d6dSopenharmony_ci#define CHECK_GT(a, b) CHECK((a) > (b))
2582e5b6d6dSopenharmony_ci#define CHECK_GE(a, b) CHECK((a) >= (b))
2592e5b6d6dSopenharmony_ci
2602e5b6d6dSopenharmony_ci
2612e5b6d6dSopenharmony_ci// This is inspired by the static assertion facility in boost.  This
2622e5b6d6dSopenharmony_ci// is pretty magical.  If it causes you trouble on a platform you may
2632e5b6d6dSopenharmony_ci// find a fix in the boost code.
2642e5b6d6dSopenharmony_citemplate <bool> class StaticAssertion;
2652e5b6d6dSopenharmony_citemplate <> class StaticAssertion<true> { };
2662e5b6d6dSopenharmony_ci// This macro joins two tokens.  If one of the tokens is a macro the
2672e5b6d6dSopenharmony_ci// helper call causes it to be resolved before joining.
2682e5b6d6dSopenharmony_ci#define SEMI_STATIC_JOIN(a, b) SEMI_STATIC_JOIN_HELPER(a, b)
2692e5b6d6dSopenharmony_ci#define SEMI_STATIC_JOIN_HELPER(a, b) a##b
2702e5b6d6dSopenharmony_ci// Causes an error during compilation of the condition is not
2712e5b6d6dSopenharmony_ci// statically known to be true.  It is formulated as a typedef so that
2722e5b6d6dSopenharmony_ci// it can be used wherever a typedef can be used.  Beware that this
2732e5b6d6dSopenharmony_ci// actually causes each use to introduce a new defined type with a
2742e5b6d6dSopenharmony_ci// name depending on the source line.
2752e5b6d6dSopenharmony_citemplate <int> class StaticAssertionHelper { };
2762e5b6d6dSopenharmony_ci#define STATIC_CHECK(test)                                                  \
2772e5b6d6dSopenharmony_ci  typedef                                                                   \
2782e5b6d6dSopenharmony_ci    StaticAssertionHelper<sizeof(StaticAssertion<static_cast<bool>(test)>)> \
2792e5b6d6dSopenharmony_ci    SEMI_STATIC_JOIN(__StaticAssertTypedef__, __LINE__)
2802e5b6d6dSopenharmony_ci
2812e5b6d6dSopenharmony_ci
2822e5b6d6dSopenharmony_ci// The DOUBLE_CONVERSION_ASSERT macro is equivalent to CHECK except that it only
2832e5b6d6dSopenharmony_ci// generates code in debug builds.
2842e5b6d6dSopenharmony_ci#ifdef DEBUG
2852e5b6d6dSopenharmony_ci#define DOUBLE_CONVERSION_ASSERT_RESULT(expr)  CHECK(expr)
2862e5b6d6dSopenharmony_ci#define DOUBLE_CONVERSION_ASSERT(condition)    CHECK(condition)
2872e5b6d6dSopenharmony_ci#define DOUBLE_CONVERSION_ASSERT_EQ(v1, v2)    CHECK_EQ(v1, v2)
2882e5b6d6dSopenharmony_ci#define DOUBLE_CONVERSION_ASSERT_NE(v1, v2)    CHECK_NE(v1, v2)
2892e5b6d6dSopenharmony_ci#define DOUBLE_CONVERSION_ASSERT_GE(v1, v2)    CHECK_GE(v1, v2)
2902e5b6d6dSopenharmony_ci#define SLOW_DOUBLE_CONVERSION_ASSERT(condition) if (FLAG_enable_slow_asserts) CHECK(condition)
2912e5b6d6dSopenharmony_ci#else
2922e5b6d6dSopenharmony_ci#define DOUBLE_CONVERSION_ASSERT_RESULT(expr)     (expr)
2932e5b6d6dSopenharmony_ci#define DOUBLE_CONVERSION_ASSERT(condition)      ((void) 0)
2942e5b6d6dSopenharmony_ci#define DOUBLE_CONVERSION_ASSERT_EQ(v1, v2)      ((void) 0)
2952e5b6d6dSopenharmony_ci#define DOUBLE_CONVERSION_ASSERT_NE(v1, v2)      ((void) 0)
2962e5b6d6dSopenharmony_ci#define DOUBLE_CONVERSION_ASSERT_GE(v1, v2)      ((void) 0)
2972e5b6d6dSopenharmony_ci#define SLOW_DOUBLE_CONVERSION_ASSERT(condition) ((void) 0)
2982e5b6d6dSopenharmony_ci#endif
2992e5b6d6dSopenharmony_ci// Static asserts has no impact on runtime performance, so they can be
3002e5b6d6dSopenharmony_ci// safely enabled in release mode. Moreover, the ((void) 0) expression
3012e5b6d6dSopenharmony_ci// obeys different syntax rules than typedef's, e.g. it can't appear
3022e5b6d6dSopenharmony_ci// inside class declaration, this leads to inconsistency between debug
3032e5b6d6dSopenharmony_ci// and release compilation modes behaviour.
3042e5b6d6dSopenharmony_ci#define STATIC_DOUBLE_CONVERSION_ASSERT(test)  STATIC_CHECK(test)
3052e5b6d6dSopenharmony_ci
3062e5b6d6dSopenharmony_ci
3072e5b6d6dSopenharmony_ci#define DOUBLE_CONVERSION_ASSERT_TAG_ALIGNED(address) \
3082e5b6d6dSopenharmony_ci  DOUBLE_CONVERSION_ASSERT((reinterpret_cast<intptr_t>(address) & kHeapObjectTagMask) == 0)
3092e5b6d6dSopenharmony_ci
3102e5b6d6dSopenharmony_ci#define DOUBLE_CONVERSION_ASSERT_SIZE_TAG_ALIGNED(size) DOUBLE_CONVERSION_ASSERT((size & kHeapObjectTagMask) == 0)
3112e5b6d6dSopenharmony_ci
3122e5b6d6dSopenharmony_ci#define DOUBLE_CONVERSION_ASSERT_NOT_NULL(p)  DOUBLE_CONVERSION_ASSERT_NE(NULL, p)
3132e5b6d6dSopenharmony_ci
3142e5b6d6dSopenharmony_ci#endif  // V8_CHECKS_H_
315