From 985c98a1ebc927da4fd620f3e62dc7a966bacc4b Mon Sep 17 00:00:00 2001 From: "jkummerow@chromium.org" Date: Wed, 26 Mar 2014 16:18:28 +0000 Subject: [PATCH] Don't try to use ASan on Windows 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 | 3 --- src/zone-inl.h | 6 +++--- src/zone.h | 7 ++++++- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/build/standalone.gypi b/build/standalone.gypi index 116cf8d..6ff0170 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" \ diff --git a/src/zone-inl.h b/src/zone-inl.h index 9a5de34..9b82c05 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 #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); diff --git a/src/zone.h b/src/zone.h index 75224a6..83421b3 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 -- 2.7.4