ADDRESS_SANITIZER macro is overloaded
authorap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 6 Jan 2015 22:24:15 +0000 (22:24 +0000)
committerap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 6 Jan 2015 22:24:15 +0000 (22:24 +0000)
https://bugs.webkit.org/show_bug.cgi?id=140130

Reviewed by Anders Carlsson.

Source/JavaScriptCore:

* interpreter/JSStack.cpp: (JSC::JSStack::sanitizeStack): Use the new macro.
This code is nearly unused (only compiled in when JIT is disabled at build time),
however I've been told that it's best to keep it.

Source/WebCore:

* platform/RefCountedSupplement.h:
* platform/Supplementable.h:
Change the conditional to ENABLE(SECURITY_ASSERTIONS). These checks will be used
in debug builds, and also when one explicitly passes -DENABLE_SECURITY_ASSERTIONS.

Source/WTF:

* wtf/Compiler.h: Added an ASAN_ENABLED macro. The abbreviation should become well
known - we already use it in tools.

* wtf/Assertions.h:
* wtf/RefCounted.h:
* wtf/SizeLimits.cpp:
Change the conditional to ENABLE(SECURITY_ASSERTIONS). These checks will be used
in debug builds, and also when one explicitly passes -DENABLE_SECURITY_ASSERTIONS.

Tools:

* WebKitTestRunner/TestController.cpp: Use the new macro.

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

12 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/interpreter/JSStack.cpp
Source/WTF/ChangeLog
Source/WTF/wtf/Assertions.h
Source/WTF/wtf/Compiler.h
Source/WTF/wtf/RefCounted.h
Source/WTF/wtf/SizeLimits.cpp
Source/WebCore/ChangeLog
Source/WebCore/platform/RefCountedSupplement.h
Source/WebCore/platform/Supplementable.h
Tools/ChangeLog
Tools/WebKitTestRunner/TestController.cpp

index 2a98685..2e92c96 100644 (file)
@@ -1,3 +1,14 @@
+2015-01-06  Alexey Proskuryakov  <ap@apple.com>
+
+        ADDRESS_SANITIZER macro is overloaded
+        https://bugs.webkit.org/show_bug.cgi?id=140130
+
+        Reviewed by Anders Carlsson.
+
+        * interpreter/JSStack.cpp: (JSC::JSStack::sanitizeStack): Use the new macro.
+        This code is nearly unused (only compiled in when JIT is disabled at build time),
+        however I've been told that it's best to keep it.
+
 2015-01-06  Mark Lam  <mark.lam@apple.com>
 
         Fix Use details for op_create_arguments.
index c6a703c..3ce0159 100644 (file)
@@ -118,7 +118,7 @@ void JSStack::gatherConservativeRoots(ConservativeRoots& conservativeRoots, JITS
 
 void JSStack::sanitizeStack()
 {
-#if !defined(ADDRESS_SANITIZER)
+#if !ASAN_ENABLED
     ASSERT(topOfStack() <= baseOfStack());
     
     if (m_lastStackTop < topOfStack()) {
index 149c8ed..c9ab040 100644 (file)
@@ -1,3 +1,19 @@
+2015-01-06  Alexey Proskuryakov  <ap@apple.com>
+
+        ADDRESS_SANITIZER macro is overloaded
+        https://bugs.webkit.org/show_bug.cgi?id=140130
+
+        Reviewed by Anders Carlsson.
+
+        * wtf/Compiler.h: Added an ASAN_ENABLED macro. The abbreviation should become well
+        known - we already use it in tools.
+
+        * wtf/Assertions.h:
+        * wtf/RefCounted.h:
+        * wtf/SizeLimits.cpp:
+        Change the conditional to ENABLE(SECURITY_ASSERTIONS). These checks will be used
+        in debug builds, and also when one explicitly passes -DENABLE_SECURITY_ASSERTIONS.
+
 2015-01-05  Andreas Kling  <akling@apple.com>
 
         Purge PassRefPtr from Page.
index 054750a..9a638bb 100644 (file)
@@ -213,7 +213,7 @@ extern "C" {
 
 #define ASSERT_UNUSED(variable, assertion) ((void)variable)
 
-#ifdef ADDRESS_SANITIZER
+#if ENABLE(SECURITY_ASSERTIONS)
 #define ASSERT_WITH_SECURITY_IMPLICATION(assertion) \
     (!(assertion) ? \
         (WTFReportAssertionFailure(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, #assertion), \
index 37f78a4..a0752aa 100644 (file)
 #define WTF_COMPILER_SUPPORTS_EABI 1
 #endif
 
+#if defined(__has_feature)
+#define ASAN_ENABLED __has_feature(address_sanitizer)
+#else
+#define ASAN_ENABLED false
+#endif
+
 /* ==== Compiler-independent macros for various compiler features, in alphabetical order ==== */
 
 /* ALWAYS_INLINE */
index 611ba5f..c9c6639 100644 (file)
@@ -27,7 +27,7 @@
 
 namespace WTF {
 
-#if defined(NDEBUG) && !defined(ADDRESS_SANITIZER)
+#if defined(NDEBUG) && !ENABLE(SECURITY_ASSERTIONS)
 #define CHECK_REF_COUNTED_LIFECYCLE 0
 #else
 #define CHECK_REF_COUNTED_LIFECYCLE 1
index 21d7ac6..03939e3 100644 (file)
@@ -41,7 +41,7 @@
 
 namespace WTF {
 
-#if !defined(NDEBUG) || defined(ADDRESS_SANITIZER)
+#if !defined(NDEBUG) || ENABLE(SECURITY_ASSERTIONS)
 struct SameSizeAsRefCounted {
     int a;
     bool b;
index 35460fa..fa8de7d 100644 (file)
@@ -1,3 +1,15 @@
+2015-01-06  Alexey Proskuryakov  <ap@apple.com>
+
+        ADDRESS_SANITIZER macro is overloaded
+        https://bugs.webkit.org/show_bug.cgi?id=140130
+
+        Reviewed by Anders Carlsson.
+
+        * platform/RefCountedSupplement.h:
+        * platform/Supplementable.h:
+        Change the conditional to ENABLE(SECURITY_ASSERTIONS). These checks will be used
+        in debug builds, and also when one explicitly passes -DENABLE_SECURITY_ASSERTIONS.
+
 2015-01-06  Brian J. Burg  <burg@cs.washington.edu>
 
         Web Inspector: pass parameters to inspector agents by reference where possible
index 0ccaff0..6052363 100644 (file)
@@ -44,7 +44,7 @@ public:
     public:
         explicit Wrapper(PassRefPtr<ThisType> wrapped) : m_wrapped(wrapped) { }
         virtual ~Wrapper() { m_wrapped->hostDestroyed();  }
-#if !ASSERT_DISABLED || defined(ADDRESS_SANITIZER)
+#if !ASSERT_DISABLED || ENABLE(SECURITY_ASSERTIONS)
         virtual bool isRefCountedWrapper() const override { return true; }
 #endif
         ThisType* wrapped() const { return m_wrapped.get(); }
index ec7f90f..fdfa246 100644 (file)
@@ -79,7 +79,7 @@ template<typename T>
 class Supplement {
 public:
     virtual ~Supplement() { }
-#if !ASSERT_DISABLED || defined(ADDRESS_SANITIZER)
+#if !ASSERT_DISABLED || ENABLE(SECURITY_ASSERTIONS)
     virtual bool isRefCountedWrapper() const { return false; }
 #endif
 
index b311474..7635b54 100644 (file)
@@ -1,3 +1,12 @@
+2015-01-06  Alexey Proskuryakov  <ap@apple.com>
+
+        ADDRESS_SANITIZER macro is overloaded
+        https://bugs.webkit.org/show_bug.cgi?id=140130
+
+        Reviewed by Anders Carlsson.
+
+        * WebKitTestRunner/TestController.cpp: Use the new macro.
+
 2015-01-05  Joseph Pecoraro  <pecoraro@apple.com>
 
         Remove some stale class names in check-for-inappropriate-objc-class-names
index 791cef7..19800b7 100644 (file)
@@ -70,15 +70,11 @@ const unsigned TestController::viewHeight = 600;
 const unsigned TestController::w3cSVGViewWidth = 480;
 const unsigned TestController::w3cSVGViewHeight = 360;
 
-#if defined(__has_feature)
-#if __has_feature(address_sanitizer)
+#if ASAN_ENABLED
 const double TestController::shortTimeout = 10.0;
 #else
 const double TestController::shortTimeout = 5.0;
 #endif
-#else
-const double TestController::shortTimeout = 5.0;
-#endif
 
 const double TestController::noTimeout = -1;