X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/6fe7ccc865dc7d7541b93c5bcaf6368d2c98a174..refs/heads/master:/heap/GCAssertions.h?ds=inline diff --git a/heap/GCAssertions.h b/heap/GCAssertions.h index 9feefe1..c163a19 100644 --- a/heap/GCAssertions.h +++ b/heap/GCAssertions.h @@ -26,20 +26,18 @@ #ifndef GCAssertions_h #define GCAssertions_h +#include #include #if ENABLE(GC_VALIDATION) #define ASSERT_GC_OBJECT_LOOKS_VALID(cell) do { \ - if (!(cell))\ - CRASH();\ - if (cell->unvalidatedStructure()->unvalidatedStructure() != cell->unvalidatedStructure()->unvalidatedStructure()->unvalidatedStructure())\ - CRASH();\ + RELEASE_ASSERT(cell);\ + RELEASE_ASSERT(cell->structure()->structure() == cell->structure()->structure()->structure()); \ } while (0) #define ASSERT_GC_OBJECT_INHERITS(object, classInfo) do {\ ASSERT_GC_OBJECT_LOOKS_VALID(object); \ - if (!object->inherits(classInfo)) \ - CRASH();\ + RELEASE_ASSERT(object->inherits(classInfo)); \ } while (0) #else @@ -47,10 +45,14 @@ #define ASSERT_GC_OBJECT_INHERITS(object, classInfo) do { (void)object; (void)classInfo; } while (0) #endif -#if COMPILER_SUPPORTS(HAS_TRIVIAL_DESTRUCTOR) -#define ASSERT_HAS_TRIVIAL_DESTRUCTOR(klass) COMPILE_ASSERT(__has_trivial_destructor(klass), klass##_has_trivial_destructor_check) +#if COMPILER(CLANG) +#define STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(klass) static_assert(std::is_trivially_destructible::value, #klass " must have a trivial destructor") +#elif COMPILER(MSVC) +// An earlier verison of the C++11 spec used to call this type trait std::has_trivial_destructor, and that's what MSVC uses. +#define STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(klass) static_assert(std::has_trivial_destructor::value, #klass " must have a trivial destructor") #else -#define ASSERT_HAS_TRIVIAL_DESTRUCTOR(klass) +// This is not enabled on GCC due to http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52702 +#define STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(klass) #endif #endif // GCAssertions_h