Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Side by Side Diff: src/checks.h

Issue 5302003: Working stand-alone preparser. (Closed)
Patch Set: Add names to exit codes, fix bug in preparser. Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « preparser/preparser-process.cc ('k') | src/checks.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 13 matching lines...) Expand all
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #ifndef V8_CHECKS_H_ 28 #ifndef V8_CHECKS_H_
29 #define V8_CHECKS_H_ 29 #define V8_CHECKS_H_
30 30
31 #include <string.h> 31 #include <string.h>
32 32
33 extern "C" void V8_Fatal(const char* file, int line, const char* format, ...); 33 extern "C" void V8_Fatal(const char* file, int line, const char* format, ...);
34 void API_Fatal(const char* location, const char* format, ...);
35 34
36 // The FATAL, UNREACHABLE and UNIMPLEMENTED macros are useful during 35 // The FATAL, UNREACHABLE and UNIMPLEMENTED macros are useful during
37 // development, but they should not be relied on in the final product. 36 // development, but they should not be relied on in the final product.
38 #ifdef DEBUG 37 #ifdef DEBUG
39 #define FATAL(msg) \ 38 #define FATAL(msg) \
40 V8_Fatal(__FILE__, __LINE__, "%s", (msg)) 39 V8_Fatal(__FILE__, __LINE__, "%s", (msg))
41 #define UNIMPLEMENTED() \ 40 #define UNIMPLEMENTED() \
42 V8_Fatal(__FILE__, __LINE__, "unimplemented code") 41 V8_Fatal(__FILE__, __LINE__, "unimplemented code")
43 #define UNREACHABLE() \ 42 #define UNREACHABLE() \
44 V8_Fatal(__FILE__, __LINE__, "unreachable code") 43 V8_Fatal(__FILE__, __LINE__, "unreachable code")
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 if (*exp == *val) { 214 if (*exp == *val) {
216 V8_Fatal(file, line, 215 V8_Fatal(file, line,
217 "CHECK_NE(%s, %s) failed\n# Value: %f", 216 "CHECK_NE(%s, %s) failed\n# Value: %f",
218 expected_source, value_source, *val); 217 expected_source, value_source, *val);
219 } 218 }
220 delete[] exp; 219 delete[] exp;
221 delete[] val; 220 delete[] val;
222 } 221 }
223 222
224 223
225 namespace v8 {
226 class Value;
227 template <class T> class Handle;
228 }
229
230
231 void CheckNonEqualsHelper(const char* file,
232 int line,
233 const char* unexpected_source,
234 v8::Handle<v8::Value> unexpected,
235 const char* value_source,
236 v8::Handle<v8::Value> value);
237
238
239 void CheckEqualsHelper(const char* file,
240 int line,
241 const char* expected_source,
242 v8::Handle<v8::Value> expected,
243 const char* value_source,
244 v8::Handle<v8::Value> value);
245
246
247 #define CHECK_EQ(expected, value) CheckEqualsHelper(__FILE__, __LINE__, \ 224 #define CHECK_EQ(expected, value) CheckEqualsHelper(__FILE__, __LINE__, \
248 #expected, expected, #value, value) 225 #expected, expected, #value, value)
249 226
250 227
251 #define CHECK_NE(unexpected, value) CheckNonEqualsHelper(__FILE__, __LINE__, \ 228 #define CHECK_NE(unexpected, value) CheckNonEqualsHelper(__FILE__, __LINE__, \
252 #unexpected, unexpected, #value, value) 229 #unexpected, unexpected, #value, value)
253 230
254 231
255 #define CHECK_GT(a, b) CHECK((a) > (b)) 232 #define CHECK_GT(a, b) CHECK((a) > (b))
256 #define CHECK_GE(a, b) CHECK((a) >= (b)) 233 #define CHECK_GE(a, b) CHECK((a) >= (b))
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 #define ASSERT_GE(v1, v2) ((void) 0) 277 #define ASSERT_GE(v1, v2) ((void) 0)
301 #define SLOW_ASSERT(condition) ((void) 0) 278 #define SLOW_ASSERT(condition) ((void) 0)
302 #endif 279 #endif
303 // Static asserts has no impact on runtime performance, so they can be 280 // Static asserts has no impact on runtime performance, so they can be
304 // safely enabled in release mode. Moreover, the ((void) 0) expression 281 // safely enabled in release mode. Moreover, the ((void) 0) expression
305 // obeys different syntax rules than typedef's, e.g. it can't appear 282 // obeys different syntax rules than typedef's, e.g. it can't appear
306 // inside class declaration, this leads to inconsistency between debug 283 // inside class declaration, this leads to inconsistency between debug
307 // and release compilation modes behaviour. 284 // and release compilation modes behaviour.
308 #define STATIC_ASSERT(test) STATIC_CHECK(test) 285 #define STATIC_ASSERT(test) STATIC_CHECK(test)
309 286
310 namespace v8 { namespace internal {
311
312 intptr_t HeapObjectTagMask();
313
314 } } // namespace v8::internal
315
316 #define ASSERT_TAG_ALIGNED(address) \
317 ASSERT((reinterpret_cast<intptr_t>(address) & HeapObjectTagMask()) == 0)
318
319 #define ASSERT_SIZE_TAG_ALIGNED(size) ASSERT((size & HeapObjectTagMask()) == 0)
320
321 #define ASSERT_NOT_NULL(p) ASSERT_NE(NULL, p) 287 #define ASSERT_NOT_NULL(p) ASSERT_NE(NULL, p)
322 288
323 #endif // V8_CHECKS_H_ 289 #endif // V8_CHECKS_H_
OLDNEW
« no previous file with comments | « preparser/preparser-process.cc ('k') | src/checks.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698