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

Side by Side Diff: src/checks.h

Issue 4576001: Move part of scanner.* into scanner-base.* for reuse in preparser scanner. (Closed)
Patch Set: 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 | « src/SConscript ('k') | src/checks.cc » ('j') | src/scanner-base.h » ('J')
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 12 matching lines...) Expand all
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
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 #include "flags.h" 33 #include "../include/v8stdint.h"
34 34
35 extern "C" void V8_Fatal(const char* file, int line, const char* format, ...); 35 extern "C" void V8_Fatal(const char* file, int line, const char* format, ...);
36 void API_Fatal(const char* location, const char* format, ...); 36 void API_Fatal(const char* location, const char* format, ...);
37 37
38 // The FATAL, UNREACHABLE and UNIMPLEMENTED macros are useful during 38 // The FATAL, UNREACHABLE and UNIMPLEMENTED macros are useful during
39 // development, but they should not be relied on in the final product. 39 // development, but they should not be relied on in the final product.
40 #ifdef DEBUG 40 #ifdef DEBUG
41 #define FATAL(msg) \ 41 #define FATAL(msg) \
42 V8_Fatal(__FILE__, __LINE__, "%s", (msg)) 42 V8_Fatal(__FILE__, __LINE__, "%s", (msg))
43 #define UNIMPLEMENTED() \ 43 #define UNIMPLEMENTED() \
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 // it can be used wherever a typedef can be used. Beware that this 272 // it can be used wherever a typedef can be used. Beware that this
273 // actually causes each use to introduce a new defined type with a 273 // actually causes each use to introduce a new defined type with a
274 // name depending on the source line. 274 // name depending on the source line.
275 template <int> class StaticAssertionHelper { }; 275 template <int> class StaticAssertionHelper { };
276 #define STATIC_CHECK(test) \ 276 #define STATIC_CHECK(test) \
277 typedef \ 277 typedef \
278 StaticAssertionHelper<sizeof(StaticAssertion<static_cast<bool>(test)>)> \ 278 StaticAssertionHelper<sizeof(StaticAssertion<static_cast<bool>(test)>)> \
279 SEMI_STATIC_JOIN(__StaticAssertTypedef__, __LINE__) 279 SEMI_STATIC_JOIN(__StaticAssertTypedef__, __LINE__)
280 280
281 281
282 namespace v8 { namespace internal {
283
284 bool EnableSlowAsserts();
285
286 } } // namespace v8::internal
287
282 // The ASSERT macro is equivalent to CHECK except that it only 288 // The ASSERT macro is equivalent to CHECK except that it only
283 // generates code in debug builds. 289 // generates code in debug builds.
284 #ifdef DEBUG 290 #ifdef DEBUG
285 #define ASSERT_RESULT(expr) CHECK(expr) 291 #define ASSERT_RESULT(expr) CHECK(expr)
286 #define ASSERT(condition) CHECK(condition) 292 #define ASSERT(condition) CHECK(condition)
287 #define ASSERT_EQ(v1, v2) CHECK_EQ(v1, v2) 293 #define ASSERT_EQ(v1, v2) CHECK_EQ(v1, v2)
288 #define ASSERT_NE(v1, v2) CHECK_NE(v1, v2) 294 #define ASSERT_NE(v1, v2) CHECK_NE(v1, v2)
289 #define ASSERT_GE(v1, v2) CHECK_GE(v1, v2) 295 #define ASSERT_GE(v1, v2) CHECK_GE(v1, v2)
290 #define SLOW_ASSERT(condition) if (FLAG_enable_slow_asserts) CHECK(condition) 296 #define SLOW_ASSERT(condition) if (EnableSlowAsserts()) CHECK(condition)
291 #else 297 #else
292 #define ASSERT_RESULT(expr) (expr) 298 #define ASSERT_RESULT(expr) (expr)
293 #define ASSERT(condition) ((void) 0) 299 #define ASSERT(condition) ((void) 0)
294 #define ASSERT_EQ(v1, v2) ((void) 0) 300 #define ASSERT_EQ(v1, v2) ((void) 0)
295 #define ASSERT_NE(v1, v2) ((void) 0) 301 #define ASSERT_NE(v1, v2) ((void) 0)
296 #define ASSERT_GE(v1, v2) ((void) 0) 302 #define ASSERT_GE(v1, v2) ((void) 0)
297 #define SLOW_ASSERT(condition) ((void) 0) 303 #define SLOW_ASSERT(condition) ((void) 0)
298 #endif 304 #endif
299 // Static asserts has no impact on runtime performance, so they can be 305 // Static asserts has no impact on runtime performance, so they can be
300 // safely enabled in release mode. Moreover, the ((void) 0) expression 306 // safely enabled in release mode. Moreover, the ((void) 0) expression
301 // obeys different syntax rules than typedef's, e.g. it can't appear 307 // obeys different syntax rules than typedef's, e.g. it can't appear
302 // inside class declaration, this leads to inconsistency between debug 308 // inside class declaration, this leads to inconsistency between debug
303 // and release compilation modes behaviour. 309 // and release compilation modes behaviour.
304 #define STATIC_ASSERT(test) STATIC_CHECK(test) 310 #define STATIC_ASSERT(test) STATIC_CHECK(test)
305 311
312 namespace v8 { namespace internal {
313
314 intptr_t HeapObjectTagMask();
315
316 } } // namespace v8::internal
306 317
307 #define ASSERT_TAG_ALIGNED(address) \ 318 #define ASSERT_TAG_ALIGNED(address) \
308 ASSERT((reinterpret_cast<intptr_t>(address) & kHeapObjectTagMask) == 0) 319 ASSERT((reinterpret_cast<intptr_t>(address) & HeapObjectTagMask()) == 0)
309 320
310 #define ASSERT_SIZE_TAG_ALIGNED(size) ASSERT((size & kHeapObjectTagMask) == 0) 321 #define ASSERT_SIZE_TAG_ALIGNED(size) ASSERT((size & HeapObjectTagMask()) == 0)
311 322
312 #define ASSERT_NOT_NULL(p) ASSERT_NE(NULL, p) 323 #define ASSERT_NOT_NULL(p) ASSERT_NE(NULL, p)
313 324
314 #endif // V8_CHECKS_H_ 325 #endif // V8_CHECKS_H_
OLDNEW
« no previous file with comments | « src/SConscript ('k') | src/checks.cc » ('j') | src/scanner-base.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698