From 2cf6c8816a73e0132bd8fa3b509d62d7c51b6e47 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 7 May 2012 11:21:11 +0200 Subject: Imported WebKit commit 7e538425aa020340619e927792f3d895061fb54b (http://svn.webkit.org/repository/webkit/trunk@116286) --- Source/JavaScriptCore/runtime/JSCell.h | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'Source/JavaScriptCore/runtime/JSCell.h') diff --git a/Source/JavaScriptCore/runtime/JSCell.h b/Source/JavaScriptCore/runtime/JSCell.h index 2ef359b76..431e67145 100644 --- a/Source/JavaScriptCore/runtime/JSCell.h +++ b/Source/JavaScriptCore/runtime/JSCell.h @@ -178,7 +178,7 @@ namespace JSC { { #if ENABLE(GC_VALIDATION) ASSERT(globalData.isInitializingObject()); - globalData.setInitializingObject(false); + globalData.setInitializingObjectClass(0); #else UNUSED_PARAM(globalData); #endif @@ -328,9 +328,8 @@ namespace JSC { void* allocateCell(Heap& heap) { #if ENABLE(GC_VALIDATION) - ASSERT(sizeof(T) == T::s_info.cellSize); ASSERT(!heap.globalData()->isInitializingObject()); - heap.globalData()->setInitializingObject(true); + heap.globalData()->setInitializingObjectClass(&T::s_info); #endif JSCell* result = 0; if (NeedsDestructor::value) @@ -351,16 +350,29 @@ namespace JSC { template inline To jsCast(From* from) { - ASSERT(from->inherits(&WTF::RemovePointer::Type::s_info)); + ASSERT(!from || from->JSCell::inherits(&WTF::RemovePointer::Type::s_info)); return static_cast(from); } + template + inline To jsCast(JSValue from) + { + ASSERT(from.isCell() && from.asCell()->JSCell::inherits(&WTF::RemovePointer::Type::s_info)); + return static_cast(from.asCell()); + } + template inline To jsDynamicCast(From* from) { return from->inherits(&WTF::RemovePointer::Type::s_info) ? static_cast(from) : 0; } + template + inline To jsDynamicCast(JSValue from) + { + return from.isCell() && from.asCell()->inherits(&WTF::RemovePointer::Type::s_info) ? static_cast(from.asCell()) : 0; + } + } // namespace JSC #endif // JSCell_h -- cgit v1.2.1