33 #include "../include/v8stdint.h"
35 extern "C" void V8_Fatal(
const char* file,
int line,
const char* format, ...);
42 V8_Fatal(__FILE__, __LINE__, "%s", (msg))
43 #define UNIMPLEMENTED() \
44 V8_Fatal(__FILE__, __LINE__, "unimplemented code")
45 #define UNREACHABLE() \
46 V8_Fatal(__FILE__, __LINE__, "unreachable code")
49 V8_Fatal("", 0, "%s", (msg))
50 #define UNIMPLEMENTED() \
51 V8_Fatal("", 0, "unimplemented code")
52 #define UNREACHABLE() ((void) 0)
56 #if defined(USE_SIMULATOR) && defined(V8_TARGET_ARCH_ARM64)
59 #define ASM_UNIMPLEMENTED(message) \
60 __ Debug(message, __LINE__, NO_PARAM)
61 #define ASM_UNIMPLEMENTED_BREAK(message) \
62 __ Debug(message, __LINE__, \
63 FLAG_ignore_asm_unimplemented_break ? NO_PARAM : BREAK)
64 #define ASM_LOCATION(message) \
65 __ Debug("LOCATION: " message, __LINE__, NO_PARAM)
67 #define ASM_UNIMPLEMENTED(message)
68 #define ASM_UNIMPLEMENTED_BREAK(message)
69 #define ASM_LOCATION(message)
75 #define CHECK(condition) do { \
77 V8_Fatal(__FILE__, __LINE__, "CHECK(%s) failed", #condition); \
85 const char* expected_source,
int expected,
86 const char* value_source,
int value) {
87 if (expected != value) {
89 "CHECK_EQ(%s, %s) failed\n# Expected: %i\n# Found: %i",
90 expected_source, value_source, expected, value);
98 const char* expected_source,
100 const char* value_source,
102 if (expected != value) {
106 "CHECK_EQ(%s, %s) failed\n#"
107 " Expected: 0x%08x%08x\n# Found: 0x%08x%08x",
108 expected_source, value_source,
109 static_cast<uint32_t>(expected >> 32),
110 static_cast<uint32_t>(expected),
111 static_cast<uint32_t>(value >> 32),
112 static_cast<uint32_t>(value));
121 const char* unexpected_source,
123 const char* value_source,
125 if (unexpected == value) {
126 V8_Fatal(file, line,
"CHECK_NE(%s, %s) failed\n# Value: %i",
127 unexpected_source, value_source, value);
136 const char* expected_source,
137 const char* expected,
138 const char* value_source,
140 if ((expected ==
NULL && value !=
NULL) ||
141 (expected !=
NULL && value ==
NULL) ||
142 (expected !=
NULL && value !=
NULL && strcmp(expected, value) != 0)) {
144 "CHECK_EQ(%s, %s) failed\n# Expected: %s\n# Found: %s",
145 expected_source, value_source, expected, value);
152 const char* expected_source,
153 const char* expected,
154 const char* value_source,
156 if (expected == value ||
157 (expected !=
NULL && value !=
NULL && strcmp(expected, value) == 0)) {
158 V8_Fatal(file, line,
"CHECK_NE(%s, %s) failed\n# Value: %s",
159 expected_source, value_source, value);
168 const char* expected_source,
169 const void* expected,
170 const char* value_source,
172 if (expected != value) {
174 "CHECK_EQ(%s, %s) failed\n# Expected: %p\n# Found: %p",
175 expected_source, value_source,
183 const char* expected_source,
184 const void* expected,
185 const char* value_source,
187 if (expected == value) {
188 V8_Fatal(file, line,
"CHECK_NE(%s, %s) failed\n# Value: %p",
189 expected_source, value_source, value);
198 const char* expected_source,
200 const char* value_source,
203 volatile double* exp =
new double[1];
205 volatile double* val =
new double[1];
209 "CHECK_EQ(%s, %s) failed\n# Expected: %f\n# Found: %f",
210 expected_source, value_source, *exp, *val);
219 const char* expected_source,
221 const char* value_source,
223 if (expected == value) {
225 "CHECK_EQ(%s, %s) failed\n# Expected: %f\n# Found: %f",
226 expected_source, value_source, expected, value);
233 const char* expected_source,
235 const char* value_source,
238 volatile double* exp =
new double[1];
240 volatile double* val =
new double[1];
244 "CHECK_NE(%s, %s) failed\n# Value: %f",
245 expected_source, value_source, *val);
252 #define CHECK_EQ(expected, value) CheckEqualsHelper(__FILE__, __LINE__, \
253 #expected, expected, #value, value)
256 #define CHECK_NE(unexpected, value) CheckNonEqualsHelper(__FILE__, __LINE__, \
257 #unexpected, unexpected, #value, value)
260 #define CHECK_GT(a, b) CHECK((a) > (b))
261 #define CHECK_GE(a, b) CHECK((a) >= (b))
262 #define CHECK_LT(a, b) CHECK((a) < (b))
263 #define CHECK_LE(a, b) CHECK((a) <= (b))
268 #if V8_HAS_CXX11_STATIC_ASSERT
269 #define STATIC_CHECK(test) static_assert(test, #test)
278 #define SEMI_STATIC_JOIN(a, b) SEMI_STATIC_JOIN_HELPER(a, b)
279 #define SEMI_STATIC_JOIN_HELPER(a, b) a##b
286 #define STATIC_CHECK(test) \
288 StaticAssertionHelper<sizeof(StaticAssertion<static_cast<bool>((test))>)> \
289 SEMI_STATIC_JOIN(__StaticAssertTypedef__, __LINE__) V8_UNUSED
294 #ifndef OPTIMIZED_DEBUG
295 #define ENABLE_SLOW_ASSERTS 1
301 #ifdef ENABLE_SLOW_ASSERTS
302 #define SLOW_ASSERT(condition) \
303 CHECK(!v8::internal::FLAG_enable_slow_asserts || (condition))
306 #define SLOW_ASSERT(condition) ((void) 0)
320 #define ASSERT_RESULT(expr) CHECK(expr)
321 #define ASSERT(condition) CHECK(condition)
322 #define ASSERT_EQ(v1, v2) CHECK_EQ(v1, v2)
323 #define ASSERT_NE(v1, v2) CHECK_NE(v1, v2)
324 #define ASSERT_GE(v1, v2) CHECK_GE(v1, v2)
325 #define ASSERT_LT(v1, v2) CHECK_LT(v1, v2)
326 #define ASSERT_LE(v1, v2) CHECK_LE(v1, v2)
328 #define ASSERT_RESULT(expr) (expr)
329 #define ASSERT(condition) ((void) 0)
330 #define ASSERT_EQ(v1, v2) ((void) 0)
331 #define ASSERT_NE(v1, v2) ((void) 0)
332 #define ASSERT_GE(v1, v2) ((void) 0)
333 #define ASSERT_LT(v1, v2) ((void) 0)
334 #define ASSERT_LE(v1, v2) ((void) 0)
341 #define STATIC_ASSERT(test) STATIC_CHECK(test)
343 #define ASSERT_NOT_NULL(p) ASSERT_NE(NULL, p)
347 #ifdef ENABLE_EXTRA_CHECKS
348 #define EXTRA_CHECK(condition) CHECK(condition)
350 #define EXTRA_CHECK(condition) ((void) 0)
353 #endif // V8_CHECKS_H_
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter NULL
void V8_Fatal(const char *file, int line, const char *format,...)
const bool FLAG_enable_slow_asserts
void CheckNonEqualsHelper(const char *file, int line, const char *unexpected_source, int unexpected, const char *value_source, int value)
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths true
void CheckEqualsHelper(const char *file, int line, const char *expected_source, int expected, const char *value_source, int value)