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

Side by Side Diff: runtime/platform/assert.h

Issue 12871010: Replace scalarlist optimizations and split external array loads into two IL instructions. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 9 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 | « runtime/lib/string.cc ('k') | runtime/vm/deopt_instructions.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 (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef PLATFORM_ASSERT_H_ 5 #ifndef PLATFORM_ASSERT_H_
6 #define PLATFORM_ASSERT_H_ 6 #define PLATFORM_ASSERT_H_
7 7
8 // TODO(5411406): include sstream for now, once we have a Utils::toString() 8 // TODO(5411406): include sstream for now, once we have a Utils::toString()
9 // implemented for all the primitive types we can replace the usage of 9 // implemented for all the primitive types we can replace the usage of
10 // sstream by Utils::toString() 10 // sstream by Utils::toString()
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 260
261 #else // if defined(DEBUG) 261 #else // if defined(DEBUG)
262 262
263 // In order to avoid variable unused warnings for code that only uses 263 // In order to avoid variable unused warnings for code that only uses
264 // a variable in an ASSERT or EXPECT, we make sure to use the macro 264 // a variable in an ASSERT or EXPECT, we make sure to use the macro
265 // argument. 265 // argument.
266 #define ASSERT(condition) do {} while (false && (condition)) 266 #define ASSERT(condition) do {} while (false && (condition))
267 267
268 #define DEBUG_ASSERT(cond) 268 #define DEBUG_ASSERT(cond)
269 269
270 #endif // if defined(DEBUG)
271
272
270 // The COMPILE_ASSERT macro can be used to verify that a compile time 273 // The COMPILE_ASSERT macro can be used to verify that a compile time
271 // expression is true. For example, you could use it to verify the 274 // expression is true. For example, you could use it to verify the
272 // size of a static array: 275 // size of a static array:
273 // 276 //
274 // COMPILE_ASSERT(ARRAYSIZE(content_type_names) == CONTENT_NUM_TYPES, 277 // COMPILE_ASSERT(ARRAYSIZE(content_type_names) == CONTENT_NUM_TYPES,
275 // content_type_names_incorrect_size); 278 // content_type_names_incorrect_size);
276 // 279 //
277 // or to make sure a struct is smaller than a certain size: 280 // or to make sure a struct is smaller than a certain size:
278 // 281 //
279 // COMPILE_ASSERT(sizeof(foo) < 128, foo_too_large); 282 // COMPILE_ASSERT(sizeof(foo) < 128, foo_too_large);
280 // 283 //
281 // The second argument to the macro is the name of the variable. If 284 // The second argument to the macro is the name of the variable. If
282 // the expression is false, most compilers will issue a warning/error 285 // the expression is false, most compilers will issue a warning/error
283 // containing the name of the variable. 286 // containing the name of the variable.
284 287
285 template <bool> 288 template <bool>
286 struct CompileAssert { 289 struct CompileAssert {
287 }; 290 };
288 291
289 #define COMPILE_ASSERT(expr, msg) \ 292 #define COMPILE_ASSERT(expr, msg) \
290 typedef CompileAssert<(static_cast<bool>(expr))> \ 293 typedef CompileAssert<(static_cast<bool>(expr))> \
291 msg[static_cast<bool>(expr) ? 1 : -1] 294 msg[static_cast<bool>(expr) ? 1 : -1]
292 295
293 #endif // if defined(DEBUG)
294
295 296
296 #if defined(TESTING) 297 #if defined(TESTING)
297 #define EXPECT(condition) \ 298 #define EXPECT(condition) \
298 if (!(condition)) { \ 299 if (!(condition)) { \
299 dart::Expect(__FILE__, __LINE__).Fail("expected: %s", #condition); \ 300 dart::Expect(__FILE__, __LINE__).Fail("expected: %s", #condition); \
300 } 301 }
301 302
302 #define EXPECT_EQ(expected, actual) \ 303 #define EXPECT_EQ(expected, actual) \
303 dart::Expect(__FILE__, __LINE__).Equals((expected), (actual)) 304 dart::Expect(__FILE__, __LINE__).Equals((expected), (actual))
304 305
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 #define WARN(error) \ 342 #define WARN(error) \
342 dart::Expect(__FILE__, __LINE__).Fail("%s", error) 343 dart::Expect(__FILE__, __LINE__).Fail("%s", error)
343 344
344 #define WARN1(format, p1) \ 345 #define WARN1(format, p1) \
345 dart::Expect(__FILE__, __LINE__).Fail(format, (p1)) 346 dart::Expect(__FILE__, __LINE__).Fail(format, (p1))
346 347
347 #define WARN2(format, p1, p2) \ 348 #define WARN2(format, p1, p2) \
348 dart::Expect(__FILE__, __LINE__).Fail(format, (p1), (p2)) 349 dart::Expect(__FILE__, __LINE__).Fail(format, (p1), (p2))
349 350
350 #endif // PLATFORM_ASSERT_H_ 351 #endif // PLATFORM_ASSERT_H_
OLDNEW
« no previous file with comments | « runtime/lib/string.cc ('k') | runtime/vm/deopt_instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698