Don't try to use ASan on Windows
authorjkummerow@chromium.org <jkummerow@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 26 Mar 2014 16:18:28 +0000 (16:18 +0000)
committerjkummerow@chromium.org <jkummerow@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 26 Mar 2014 16:18:28 +0000 (16:18 +0000)
Let ASan support depend on __has_feature(address_sanitizer) instead of defined(ADDRESS_SANITIZER)

R=yangguo@chromium.org

Review URL: https://codereview.chromium.org/213133002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20287 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

build/standalone.gypi
src/zone-inl.h
src/zone.h

index 116cf8d..6ff0170 100644 (file)
         'ldflags': [
           '-fsanitize=address',
         ],
-        'defines': [
-          'ADDRESS_SANITIZER',
-        ],
       },
     }],
     ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \
index 9a5de34..9b82c05 100644 (file)
@@ -30,7 +30,7 @@
 
 #include "zone.h"
 
-#ifdef ADDRESS_SANITIZER
+#ifdef V8_USE_ADDRESS_SANITIZER
   #include <sanitizer/asan_interface.h>
 #else
   #define ASAN_UNPOISON_MEMORY_REGION(start, size) ((void) 0)
@@ -64,7 +64,7 @@ inline void* Zone::New(int size) {
   Address result = position_;
 
   int size_with_redzone =
-#ifdef ADDRESS_SANITIZER
+#ifdef V8_USE_ADDRESS_SANITIZER
       size + kASanRedzoneBytes;
 #else
       size;
@@ -76,7 +76,7 @@ inline void* Zone::New(int size) {
      position_ += size_with_redzone;
   }
 
-#ifdef ADDRESS_SANITIZER
+#ifdef V8_USE_ADDRESS_SANITIZER
   Address redzone_position = result + size;
   ASSERT(redzone_position + kASanRedzoneBytes == position_);
   ASAN_POISON_MEMORY_REGION(redzone_position, kASanRedzoneBytes);
index 75224a6..83421b3 100644 (file)
 namespace v8 {
 namespace internal {
 
+#if defined(__has_feature)
+  #if __has_feature(address_sanitizer)
+    #define V8_USE_ADDRESS_SANITIZER
+  #endif
+#endif
 
 class Segment;
 class Isolate;
@@ -90,7 +95,7 @@ class Zone {
   // All pointers returned from New() have this alignment.  In addition, if the
   // object being allocated has a size that is divisible by 8 then its alignment
   // will be 8. ASan requires 8-byte alignment.
-#ifdef ADDRESS_SANITIZER
+#ifdef V8_USE_ADDRESS_SANITIZER
   static const int kAlignment = 8;
   STATIC_ASSERT(kPointerSize <= 8);
 #else