33 #include "../include/v8stdint.h"
34 extern "C" void V8_Fatal(
const char* file,
int line,
const char* format, ...);
40 V8_Fatal(__FILE__, __LINE__, "%s", (msg))
41 #define UNIMPLEMENTED() \
42 V8_Fatal(__FILE__, __LINE__, "unimplemented code")
43 #define UNREACHABLE() \
44 V8_Fatal(__FILE__, __LINE__, "unreachable code")
47 V8_Fatal("", 0, "%s", (msg))
48 #define UNIMPLEMENTED() \
49 V8_Fatal("", 0, "unimplemented code")
50 #define UNREACHABLE() ((void) 0)
56 #define CHECK(condition) do { \
58 V8_Fatal(__FILE__, __LINE__, "CHECK(%s) failed", #condition); \
66 const char* expected_source,
int expected,
67 const char* value_source,
int value) {
68 if (expected != value) {
70 "CHECK_EQ(%s, %s) failed\n# Expected: %i\n# Found: %i",
71 expected_source, value_source, expected, value);
79 const char* expected_source,
81 const char* value_source,
83 if (expected != value) {
87 "CHECK_EQ(%s, %s) failed\n#"
88 " Expected: 0x%08x%08x\n# Found: 0x%08x%08x",
89 expected_source, value_source,
90 static_cast<uint32_t>(expected >> 32),
91 static_cast<uint32_t>(expected),
92 static_cast<uint32_t>(value >> 32),
93 static_cast<uint32_t>(value));
102 const char* unexpected_source,
104 const char* value_source,
106 if (unexpected == value) {
107 V8_Fatal(file, line,
"CHECK_NE(%s, %s) failed\n# Value: %i",
108 unexpected_source, value_source, value);
117 const char* expected_source,
118 const char* expected,
119 const char* value_source,
121 if ((expected ==
NULL && value !=
NULL) ||
122 (expected !=
NULL && value ==
NULL) ||
123 (expected !=
NULL && value !=
NULL && strcmp(expected, value) != 0)) {
125 "CHECK_EQ(%s, %s) failed\n# Expected: %s\n# Found: %s",
126 expected_source, value_source, expected, value);
133 const char* expected_source,
134 const char* expected,
135 const char* value_source,
137 if (expected == value ||
138 (expected !=
NULL && value !=
NULL && strcmp(expected, value) == 0)) {
139 V8_Fatal(file, line,
"CHECK_NE(%s, %s) failed\n# Value: %s",
140 expected_source, value_source, value);
149 const char* expected_source,
150 const void* expected,
151 const char* value_source,
153 if (expected != value) {
155 "CHECK_EQ(%s, %s) failed\n# Expected: %p\n# Found: %p",
156 expected_source, value_source,
164 const char* expected_source,
165 const void* expected,
166 const char* value_source,
168 if (expected == value) {
169 V8_Fatal(file, line,
"CHECK_NE(%s, %s) failed\n# Value: %p",
170 expected_source, value_source, value);
179 const char* expected_source,
181 const char* value_source,
184 volatile double* exp =
new double[1];
186 volatile double* val =
new double[1];
190 "CHECK_EQ(%s, %s) failed\n# Expected: %f\n# Found: %f",
191 expected_source, value_source, *exp, *val);
200 const char* expected_source,
202 const char* value_source,
205 volatile double* exp =
new double[1];
207 volatile double* val =
new double[1];
211 "CHECK_NE(%s, %s) failed\n# Value: %f",
212 expected_source, value_source, *val);
219 #define CHECK_EQ(expected, value) CheckEqualsHelper(__FILE__, __LINE__, \
220 #expected, expected, #value, value)
223 #define CHECK_NE(unexpected, value) CheckNonEqualsHelper(__FILE__, __LINE__, \
224 #unexpected, unexpected, #value, value)
227 #define CHECK_GT(a, b) CHECK((a) > (b))
228 #define CHECK_GE(a, b) CHECK((a) >= (b))
229 #define CHECK_LT(a, b) CHECK((a) < (b))
230 #define CHECK_LE(a, b) CHECK((a) <= (b))
240 #define SEMI_STATIC_JOIN(a, b) SEMI_STATIC_JOIN_HELPER(a, b)
241 #define SEMI_STATIC_JOIN_HELPER(a, b) a##b
248 #define STATIC_CHECK(test) \
250 StaticAssertionHelper<sizeof(StaticAssertion<static_cast<bool>((test))>)> \
251 SEMI_STATIC_JOIN(__StaticAssertTypedef__, __LINE__)
260 #define ASSERT_RESULT(expr) CHECK(expr)
261 #define ASSERT(condition) CHECK(condition)
262 #define ASSERT_EQ(v1, v2) CHECK_EQ(v1, v2)
263 #define ASSERT_NE(v1, v2) CHECK_NE(v1, v2)
264 #define ASSERT_GE(v1, v2) CHECK_GE(v1, v2)
265 #define ASSERT_LT(v1, v2) CHECK_LT(v1, v2)
266 #define ASSERT_LE(v1, v2) CHECK_LE(v1, v2)
267 #define SLOW_ASSERT(condition) CHECK(!FLAG_enable_slow_asserts || (condition))
269 #define ASSERT_RESULT(expr) (expr)
270 #define ASSERT(condition) ((void) 0)
271 #define ASSERT_EQ(v1, v2) ((void) 0)
272 #define ASSERT_NE(v1, v2) ((void) 0)
273 #define ASSERT_GE(v1, v2) ((void) 0)
274 #define ASSERT_LT(v1, v2) ((void) 0)
275 #define ASSERT_LE(v1, v2) ((void) 0)
276 #define SLOW_ASSERT(condition) ((void) 0)
283 #define STATIC_ASSERT(test) STATIC_CHECK(test)
285 #define ASSERT_NOT_NULL(p) ASSERT_NE(NULL, p)
287 #endif // V8_CHECKS_H_
bool FLAG_enable_slow_asserts
activate correct semantics for inheriting readonliness enable harmony semantics for typeof enable harmony enable harmony proxies enable all harmony harmony_scoping harmony_proxies harmony_scoping true
void V8_Fatal(const char *file, int line, const char *format,...)
void CheckNonEqualsHelper(const char *file, int line, const char *unexpected_source, int unexpected, const char *value_source, int value)
activate correct semantics for inheriting readonliness enable harmony semantics for typeof enable harmony enable harmony proxies enable all harmony harmony_scoping harmony_proxies harmony_scoping tracks arrays with only smi values automatically unbox arrays of doubles use crankshaft use hydrogen range analysis use hydrogen global value numbering use function inlining maximum number of AST nodes considered for a single inlining loop invariant code motion print statistics for hydrogen trace generated IR for specified phases trace register allocator trace range analysis trace representation types environment for every instruction put a break point before deoptimizing polymorphic inlining perform array bounds checks elimination trace on stack replacement optimize closures functions with arguments object optimize functions containing for in loops profiler considers IC stability primitive functions trigger their own optimization re try self optimization if it failed insert an interrupt check at function exit execution budget before interrupt is triggered call count before self optimization self_optimization count_based_interrupts weighted_back_edges trace_opt emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of SAHF instruction if enable use of VFP3 instructions if available this implies enabling ARMv7 enable use of ARMv7 instructions if enable use of MIPS FPU instructions if NULL
void CheckEqualsHelper(const char *file, int line, const char *expected_source, int expected, const char *value_source, int value)