Disabling assertions breaks the debug build
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 11 Nov 2011 07:08:46 +0000 (07:08 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 11 Nov 2011 07:08:46 +0000 (07:08 +0000)
https://bugs.webkit.org/show_bug.cgi?id=72091

Reviewed by Geoff Garen.

Source/JavaScriptCore:

* dfg/DFGNode.h: Made hasIdentifier() available when assertions are
disabled. It is used in Graph::dump().
* runtime/JSObject.cpp:
(JSC::JSObject::visitChildren): Update m_isCheckingForDefaultMarkViolation
only if assertions are enabled.
* wtf/Deque.h:
(WTF::::checkIndexValidity): Changed ASSERT to ASSERT_UNUSED.
* wtf/ThreadRestrictionVerifier.h:
(WTF::ThreadRestrictionVerifier::setShared): Guarded the definition of
a local variable that is only used in an assertion.

Source/WebCore:

* platform/graphics/BitmapImage.cpp:
(WebCore::BitmapImage::didDecodeProperties): Guarded the definition of local variables that are
only used in an assertion correctly.
* platform/graphics/gpu/TilingData.h: Changed ASSERT to ASSERT_UNUSED.
(WebCore::TilingData::assertTile):
* rendering/RenderInline.cpp:
(WebCore::RenderInline::willBeDestroyed): Guarded the definition of a local variable that is
only used in an assertion correctly.
* rendering/svg/RenderSVGResourceClipper.cpp:
(WebCore::RenderSVGResourceClipper::applyResource): Changed ASSERT to ASSERT_UNUSED.
* rendering/svg/RenderSVGResourceFilter.cpp:
(WebCore::RenderSVGResourceFilter::applyResource): Changed ASSERT to ASSERT_UNUSED.
(WebCore::RenderSVGResourceFilter::postApplyResource): Changed ASSERT to ASSERT_UNUSED.
* rendering/svg/RenderSVGResourceMasker.cpp:
(WebCore::RenderSVGResourceMasker::applyResource): Changed ASSERT to ASSERT_UNUSED.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@99929 268f45cc-cd09-0410-ab3c-d52691b4dbfc

12 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/dfg/DFGNode.h
Source/JavaScriptCore/runtime/JSObject.cpp
Source/JavaScriptCore/wtf/Deque.h
Source/JavaScriptCore/wtf/ThreadRestrictionVerifier.h
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/BitmapImage.cpp
Source/WebCore/platform/graphics/gpu/TilingData.h
Source/WebCore/rendering/RenderInline.cpp
Source/WebCore/rendering/svg/RenderSVGResourceClipper.cpp
Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp
Source/WebCore/rendering/svg/RenderSVGResourceMasker.cpp

index 6156c7d..65deebe 100644 (file)
@@ -1,3 +1,21 @@
+2011-11-10  Dan Bernstein  <mitz@apple.com>
+
+        Disabling assertions breaks the debug build
+        https://bugs.webkit.org/show_bug.cgi?id=72091
+
+        Reviewed by Geoff Garen.
+
+        * dfg/DFGNode.h: Made hasIdentifier() available when assertions are
+        disabled. It is used in Graph::dump().
+        * runtime/JSObject.cpp:
+        (JSC::JSObject::visitChildren): Update m_isCheckingForDefaultMarkViolation
+        only if assertions are enabled.
+        * wtf/Deque.h:
+        (WTF::::checkIndexValidity): Changed ASSERT to ASSERT_UNUSED.
+        * wtf/ThreadRestrictionVerifier.h:
+        (WTF::ThreadRestrictionVerifier::setShared): Guarded the definition of
+        a local variable that is only used in an assertion.
+
 2011-11-10  Filip Pizlo  <fpizlo@apple.com>
 
         JSString forgets to clear m_fibers when resolving ropes
index 66f3589..46675b2 100644 (file)
@@ -469,7 +469,7 @@ struct Node {
         return variableAccessData()->local();
     }
 
-#if !ASSERT_DISABLED
+#ifndef NDEBUG
     bool hasIdentifier()
     {
         switch (op) {
index f255333..9ebd7bf 100644 (file)
@@ -84,7 +84,7 @@ void JSObject::visitChildren(JSCell* cell, SlotVisitor& visitor)
 {
     JSObject* thisObject = static_cast<JSObject*>(cell);
     ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
-#ifndef NDEBUG
+#if !ASSERT_DISABLED
     bool wasCheckingForDefaultMarkViolation = visitor.m_isCheckingForDefaultMarkViolation;
     visitor.m_isCheckingForDefaultMarkViolation = false;
 #endif
@@ -97,7 +97,7 @@ void JSObject::visitChildren(JSCell* cell, SlotVisitor& visitor)
     if (thisObject->m_inheritorID)
         visitor.append(&thisObject->m_inheritorID);
 
-#ifndef NDEBUG
+#if !ASSERT_DISABLED
     visitor.m_isCheckingForDefaultMarkViolation = wasCheckingForDefaultMarkViolation;
 #endif
 }
index 1ed47a8..276b59a 100644 (file)
@@ -280,7 +280,7 @@ namespace WTF {
     template<typename T, size_t inlineCapacity>
     void Deque<T, inlineCapacity>::checkIndexValidity(size_t index) const
     {
-        ASSERT(index <= m_buffer.capacity());
+        ASSERT_UNUSED(index, index <= m_buffer.capacity());
         if (m_start <= m_end) {
             ASSERT(index >= m_start);
             ASSERT(index <= m_end);
index e76e6c6..0eeac8e 100644 (file)
@@ -94,7 +94,9 @@ public:
     // Indicates that the object may (or may not) be owned by more than one place.
     void setShared(bool shared)
     {
+#if !ASSERT_DISABLED
         bool previouslyShared = m_shared;
+#endif
         m_shared = shared;
 
         if (!m_shared)
index 84fd21f..189e198 100644 (file)
@@ -1,3 +1,26 @@
+2011-11-10  Dan Bernstein  <mitz@apple.com>
+
+        Disabling assertions breaks the debug build
+        https://bugs.webkit.org/show_bug.cgi?id=72091
+
+        Reviewed by Geoff Garen.
+
+        * platform/graphics/BitmapImage.cpp:
+        (WebCore::BitmapImage::didDecodeProperties): Guarded the definition of local variables that are
+        only used in an assertion correctly.
+        * platform/graphics/gpu/TilingData.h: Changed ASSERT to ASSERT_UNUSED.
+        (WebCore::TilingData::assertTile):
+        * rendering/RenderInline.cpp:
+        (WebCore::RenderInline::willBeDestroyed): Guarded the definition of a local variable that is
+        only used in an assertion correctly.
+        * rendering/svg/RenderSVGResourceClipper.cpp:
+        (WebCore::RenderSVGResourceClipper::applyResource): Changed ASSERT to ASSERT_UNUSED.
+        * rendering/svg/RenderSVGResourceFilter.cpp:
+        (WebCore::RenderSVGResourceFilter::applyResource): Changed ASSERT to ASSERT_UNUSED.
+        (WebCore::RenderSVGResourceFilter::postApplyResource): Changed ASSERT to ASSERT_UNUSED.
+        * rendering/svg/RenderSVGResourceMasker.cpp:
+        (WebCore::RenderSVGResourceMasker::applyResource): Changed ASSERT to ASSERT_UNUSED.
+
 2011-11-10  Daniel Cheng  <dcheng@chromium.org>
 
         [chromium] Add plumbing for JS to write to clipboard in copy/cut events.
index 0862e6f..7e6f686 100644 (file)
@@ -157,7 +157,7 @@ void BitmapImage::didDecodeProperties() const
     if (m_decodedPropertiesSize == updatedSize)
         return;
     int deltaBytes = updatedSize - m_decodedPropertiesSize;
-#ifndef NDEBUG
+#if !ASSERT_DISABLED
     bool overflow = updatedSize > m_decodedPropertiesSize && deltaBytes < 0;
     bool underflow = updatedSize < m_decodedPropertiesSize && deltaBytes > 0;
     ASSERT(!overflow && !underflow);
index bc63a67..de7216e 100644 (file)
@@ -77,11 +77,7 @@ public:
 
 private:
     TilingData() : m_maxTextureSize(0), m_totalSizeX(0), m_totalSizeY(0) {}
-#ifndef NDEBUG
-    void assertTile(int tile) const { ASSERT(tile >= 0 && tile < numTiles()); }
-#else
-    void assertTile(int) const {}
-#endif
+    void assertTile(int tile) const { ASSERT_UNUSED(tile, tile >= 0 && tile < numTiles()); }
     void recomputeNumTiles();
 
     int m_maxTextureSize;
index 3f09633..4499e10 100644 (file)
@@ -55,7 +55,7 @@ RenderInline::RenderInline(Node* node)
 
 void RenderInline::willBeDestroyed()
 {
-#ifndef NDEBUG
+#if !ASSERT_DISABLED
     // Make sure we do not retain "this" in the continuation outline table map of our containing blocks.
     if (parent() && style()->visibility() == VISIBLE && hasOutline()) {
         bool containingBlockPaintsContinuationOutline = continuation() || isInlineElementContinuation();
index f0b11c2..1be58a5 100644 (file)
@@ -96,11 +96,7 @@ bool RenderSVGResourceClipper::applyResource(RenderObject* object, RenderStyle*,
 {
     ASSERT(object);
     ASSERT(context);
-#ifndef NDEBUG
-    ASSERT(resourceMode == ApplyToDefaultMode);
-#else
-    UNUSED_PARAM(resourceMode);
-#endif
+    ASSERT_UNUSED(resourceMode, resourceMode == ApplyToDefaultMode);
 
     return applyClippingToContext(object, object->objectBoundingBox(), object->repaintRectInLocalCoordinates(), context);
 }
index a428ec6..01a205e 100644 (file)
@@ -141,11 +141,7 @@ bool RenderSVGResourceFilter::applyResource(RenderObject* object, RenderStyle*,
 {
     ASSERT(object);
     ASSERT(context);
-#ifndef NDEBUG
-    ASSERT(resourceMode == ApplyToDefaultMode);
-#else
-    UNUSED_PARAM(resourceMode);
-#endif
+    ASSERT_UNUSED(resourceMode, resourceMode == ApplyToDefaultMode);
 
     // Returning false here, to avoid drawings onto the context. We just want to
     // draw the stored filter output, not the unfiltered object as well.
@@ -264,11 +260,7 @@ void RenderSVGResourceFilter::postApplyResource(RenderObject* object, GraphicsCo
 {
     ASSERT(object);
     ASSERT(context);
-#ifndef NDEBUG
-    ASSERT(resourceMode == ApplyToDefaultMode);
-#else
-    UNUSED_PARAM(resourceMode);
-#endif
+    ASSERT_UNUSED(resourceMode, resourceMode == ApplyToDefaultMode);
 
     FilterData* filterData = m_filter.get(object);
     if (!filterData)
index 10037eb..eb6db3d 100644 (file)
@@ -84,11 +84,7 @@ bool RenderSVGResourceMasker::applyResource(RenderObject* object, RenderStyle*,
 {
     ASSERT(object);
     ASSERT(context);
-#ifndef NDEBUG
-    ASSERT(resourceMode == ApplyToDefaultMode);
-#else
-    UNUSED_PARAM(resourceMode);
-#endif
+    ASSERT_UNUSED(resourceMode, resourceMode == ApplyToDefaultMode);
 
     if (!m_masker.contains(object))
         m_masker.set(object, new MaskerData);