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

Side by Side Diff: src/checks.h

Issue 251088: Revert revisions 3013, 3014, and 3016. We need a better solution. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 2 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 | « include/v8.h ('k') | test/cctest/test-api.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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 static inline void CheckEqualsHelper(const char* file, int line, 73 static inline void CheckEqualsHelper(const char* file, int line,
74 const char* expected_source, int expected, 74 const char* expected_source, int expected,
75 const char* value_source, int value) { 75 const char* value_source, int value) {
76 if (expected != value) { 76 if (expected != value) {
77 V8_Fatal(file, line, 77 V8_Fatal(file, line,
78 "CHECK_EQ(%s, %s) failed\n# Expected: %i\n# Found: %i", 78 "CHECK_EQ(%s, %s) failed\n# Expected: %i\n# Found: %i",
79 expected_source, value_source, expected, value); 79 expected_source, value_source, expected, value);
80 } 80 }
81 } 81 }
82 82
83 // Helper function used by the CHECK_INT64_EQ function when given int64_t
84 // arguments. Should not be called directly. We do not overload CHECK_EQ
85 // with both 32-bit and 64-bit integers, because it causes ambiguity
86 // with operands of mixed sizes.
87 static inline void CheckInt64EqualsHelper(const char* file, int line,
88 const char* expected_source,
89 int64_t expected,
90 const char* value_source,
91 int64_t value) {
92 if (expected != value) {
93 // Print int64_t values in hex, as two int32s,
94 // to avoid platform-dependencies.
95 V8_Fatal(file, line,
96 "CHECK_EQ(%s, %s) failed\n#"
97 " Expected: 0x%08x%08x\n# Found: 0x%08x%08x",
98 expected_source, value_source,
99 uint32_t(expected >> 32), uint32_t(expected),
100 uint32_t(value >> 32), uint32_t(value));
101 }
102 }
103
104 83
105 // Helper function used by the CHECK_NE function when given int 84 // Helper function used by the CHECK_NE function when given int
106 // arguments. Should not be called directly. 85 // arguments. Should not be called directly.
107 static inline void CheckNonEqualsHelper(const char* file, 86 static inline void CheckNonEqualsHelper(const char* file,
108 int line, 87 int line,
109 const char* unexpected_source, 88 const char* unexpected_source,
110 int unexpected, 89 int unexpected,
111 const char* value_source, 90 const char* value_source,
112 int value) { 91 int value) {
113 if (unexpected == value) { 92 if (unexpected == value) {
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 #expected, expected, #value, value) 205 #expected, expected, #value, value)
227 206
228 207
229 #define CHECK_NE(unexpected, value) CheckNonEqualsHelper(__FILE__, __LINE__, \ 208 #define CHECK_NE(unexpected, value) CheckNonEqualsHelper(__FILE__, __LINE__, \
230 #unexpected, unexpected, #value, value) 209 #unexpected, unexpected, #value, value)
231 210
232 211
233 #define CHECK_GT(a, b) CHECK((a) > (b)) 212 #define CHECK_GT(a, b) CHECK((a) > (b))
234 #define CHECK_GE(a, b) CHECK((a) >= (b)) 213 #define CHECK_GE(a, b) CHECK((a) >= (b))
235 214
236 #define CHECK_INT64_EQ(expected, value) CheckInt64EqualsHelper(__FILE__, \
237 __LINE__, #expected, expected, #value, value)
238
239 215
240 // This is inspired by the static assertion facility in boost. This 216 // This is inspired by the static assertion facility in boost. This
241 // is pretty magical. If it causes you trouble on a platform you may 217 // is pretty magical. If it causes you trouble on a platform you may
242 // find a fix in the boost code. 218 // find a fix in the boost code.
243 template <bool> class StaticAssertion; 219 template <bool> class StaticAssertion;
244 template <> class StaticAssertion<true> { }; 220 template <> class StaticAssertion<true> { };
245 // This macro joins two tokens. If one of the tokens is a macro the 221 // This macro joins two tokens. If one of the tokens is a macro the
246 // helper call causes it to be resolved before joining. 222 // helper call causes it to be resolved before joining.
247 #define SEMI_STATIC_JOIN(a, b) SEMI_STATIC_JOIN_HELPER(a, b) 223 #define SEMI_STATIC_JOIN(a, b) SEMI_STATIC_JOIN_HELPER(a, b)
248 #define SEMI_STATIC_JOIN_HELPER(a, b) a##b 224 #define SEMI_STATIC_JOIN_HELPER(a, b) a##b
(...skipping 29 matching lines...) Expand all
278 254
279 255
280 #define ASSERT_TAG_ALIGNED(address) \ 256 #define ASSERT_TAG_ALIGNED(address) \
281 ASSERT((reinterpret_cast<intptr_t>(address) & kHeapObjectTagMask) == 0) 257 ASSERT((reinterpret_cast<intptr_t>(address) & kHeapObjectTagMask) == 0)
282 258
283 #define ASSERT_SIZE_TAG_ALIGNED(size) ASSERT((size & kHeapObjectTagMask) == 0) 259 #define ASSERT_SIZE_TAG_ALIGNED(size) ASSERT((size & kHeapObjectTagMask) == 0)
284 260
285 #define ASSERT_NOT_NULL(p) ASSERT_NE(NULL, p) 261 #define ASSERT_NOT_NULL(p) ASSERT_NE(NULL, p)
286 262
287 #endif // V8_CHECKS_H_ 263 #endif // V8_CHECKS_H_
OLDNEW
« no previous file with comments | « include/v8.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698