Reviewers: Yang,

Description:
Don't try to use ASan on Windows

Let ASan support depend on __has_feature(address_sanitizer) instead of
defined(ADDRESS_SANITIZER)

Please review this at https://codereview.chromium.org/213133002/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+9, -7 lines):
  M build/standalone.gypi
  M src/zone-inl.h
  M src/zone.h


Index: build/standalone.gypi
diff --git a/build/standalone.gypi b/build/standalone.gypi
index 116cf8d80c076c86cc6dac7ebcdca10a6d96d014..6ff0170b9c1d1f9e8db8754f0015adc0e26c0af1 100644
--- a/build/standalone.gypi
+++ b/build/standalone.gypi
@@ -184,9 +184,6 @@
         'ldflags': [
           '-fsanitize=address',
         ],
-        'defines': [
-          'ADDRESS_SANITIZER',
-        ],
       },
     }],
     ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \
Index: src/zone-inl.h
diff --git a/src/zone-inl.h b/src/zone-inl.h
index 9a5de34acb636a826b06dce5158e20b4229beff0..9b82c054088df888f9abe8aa10b60f5b91369bbb 100644
--- a/src/zone-inl.h
+++ b/src/zone-inl.h
@@ -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: src/zone.h
diff --git a/src/zone.h b/src/zone.h
index 75224a6ac8b177b2e14cbc032ae4897d0a7c6fed..83421b3963df8af3018bd24d13655f25f4dbad12 100644
--- a/src/zone.h
+++ b/src/zone.h
@@ -38,6 +38,11 @@
 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


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to