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

Side by Side Diff: src/checks.h

Issue 143003013: Initial patch for a64. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 11 months 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 | Annotate | Revision Log
« no previous file with comments | « src/builtins.cc ('k') | src/code-stubs.h » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 15 matching lines...) Expand all
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 #include "../include/v8stdint.h" 33 #include "../include/v8stdint.h"
34 extern "C" void V8_Fatal(const char* file, int line, const char* format, ...); 34 extern "C" void V8_Fatal(const char* file, int line, const char* format, ...);
35 35
36 // Define custom A64 preprocessor helpers to facilitate development.
37 #ifndef V8_TARGET_ARCH_A64
38
36 // The FATAL, UNREACHABLE and UNIMPLEMENTED macros are useful during 39 // The FATAL, UNREACHABLE and UNIMPLEMENTED macros are useful during
37 // development, but they should not be relied on in the final product. 40 // development, but they should not be relied on in the final product.
38 #ifdef DEBUG 41 #ifdef DEBUG
39 #define FATAL(msg) \ 42 #define FATAL(msg) \
40 V8_Fatal(__FILE__, __LINE__, "%s", (msg)) 43 V8_Fatal(__FILE__, __LINE__, "%s", (msg))
41 #define UNIMPLEMENTED() \ 44 #define UNIMPLEMENTED() \
42 V8_Fatal(__FILE__, __LINE__, "unimplemented code") 45 V8_Fatal(__FILE__, __LINE__, "unimplemented code")
43 #define UNREACHABLE() \ 46 #define UNREACHABLE() \
44 V8_Fatal(__FILE__, __LINE__, "unreachable code") 47 V8_Fatal(__FILE__, __LINE__, "unreachable code")
45 #else 48 #else
46 #define FATAL(msg) \ 49 #define FATAL(msg) \
47 V8_Fatal("", 0, "%s", (msg)) 50 V8_Fatal("", 0, "%s", (msg))
48 #define UNIMPLEMENTED() \ 51 #define UNIMPLEMENTED() \
49 V8_Fatal("", 0, "unimplemented code") 52 V8_Fatal("", 0, "unimplemented code")
50 #define UNREACHABLE() ((void) 0) 53 #define UNREACHABLE() ((void) 0)
51 #endif 54 #endif
52 55
56 #else
57
58 #ifdef DEBUG
59 #define FATAL(msg) \
60 V8_Fatal(__FILE__, __LINE__, "%s", (msg))
61 #define UNREACHABLE() \
62 V8_Fatal(__FILE__, __LINE__, "unreachable code")
63 #else
64 #define FATAL(msg) \
65 V8_Fatal("", 0, "%s", (msg))
66 #define UNREACHABLE() ((void) 0)
67 #endif
68
69 #define ABORT() printf("in %s, line %i, %s", __FILE__, __LINE__, __func__); \
70 abort()
71
72 #define ALIGNMENT_EXCEPTION() printf("ALIGNMENT EXCEPTION\t"); ABORT()
73
74 // Helpers for unimplemented sections.
75 #define UNIMPLEMENTED() \
76 do { \
77 printf("UNIMPLEMENTED: %s, line %d, %s\n", \
78 __FILE__, __LINE__, __func__); \
79 V8_Fatal(__FILE__, __LINE__, "unimplemented code"); \
80 } while (0)
81 #define UNIMPLEMENTED_M(message) \
82 do { \
83 printf("UNIMPLEMENTED: %s, line %d, %s : %s\n", \
84 __FILE__, __LINE__, __func__, message); \
85 V8_Fatal(__FILE__, __LINE__, "unimplemented code"); \
86 } while (0)
87 // Like UNIMPLEMENTED, but does not abort.
88 #define TODO_UNIMPLEMENTED(message) \
89 do { \
90 static const unsigned int kLimit = 1; \
91 static unsigned int printed = 0; \
92 if (printed < UINT_MAX) { \
93 printed++; \
94 } \
95 if (printed <= kLimit) { \
96 printf("UNIMPLEMENTED: %s, line %d, %s: %s\n", \
97 __FILE__, __LINE__, __func__, message); \
98 } \
99 } while (0)
100
101 // Simulator specific helpers.
102 #ifdef USE_SIMULATOR
103 // Helpers for unimplemented sections.
104 // TODO(all): If possible automatically prepend an indicator like
105 // UNIMPLEMENTED or LOCATION.
106 #define ASM_UNIMPLEMENTED(message) \
107 __ Debug(message, __LINE__, NO_PARAM)
108 #define ASM_UNIMPLEMENTED_BREAK(message) \
109 __ Debug(message, __LINE__, \
110 FLAG_ignore_asm_unimplemented_break ? NO_PARAM : BREAK)
111 #define ASM_LOCATION(message) \
112 __ Debug("LOCATION: " message, __LINE__, NO_PARAM)
113 #else
114 #define ASM_UNIMPLEMENTED(message)
115 #define ASM_UNIMPLEMENTED_BREAK(message)
116 #define ASM_LOCATION(message)
117 #endif
118
119 #endif
120
53 121
54 // The CHECK macro checks that the given condition is true; if not, it 122 // The CHECK macro checks that the given condition is true; if not, it
55 // prints a message to stderr and aborts. 123 // prints a message to stderr and aborts.
56 #define CHECK(condition) do { \ 124 #define CHECK(condition) do { \
57 if (!(condition)) { \ 125 if (!(condition)) { \
58 V8_Fatal(__FILE__, __LINE__, "CHECK(%s) failed", #condition); \ 126 V8_Fatal(__FILE__, __LINE__, "CHECK(%s) failed", #condition); \
59 } \ 127 } \
60 } while (0) 128 } while (0)
61 129
62 130
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 354
287 // "Extra checks" are lightweight checks that are enabled in some release 355 // "Extra checks" are lightweight checks that are enabled in some release
288 // builds. 356 // builds.
289 #ifdef ENABLE_EXTRA_CHECKS 357 #ifdef ENABLE_EXTRA_CHECKS
290 #define EXTRA_CHECK(condition) CHECK(condition) 358 #define EXTRA_CHECK(condition) CHECK(condition)
291 #else 359 #else
292 #define EXTRA_CHECK(condition) ((void) 0) 360 #define EXTRA_CHECK(condition) ((void) 0)
293 #endif 361 #endif
294 362
295 #endif // V8_CHECKS_H_ 363 #endif // V8_CHECKS_H_
OLDNEW
« no previous file with comments | « src/builtins.cc ('k') | src/code-stubs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698