[msan] Do not unpoison heap if running on simulator.
authorjkummerow@chromium.org <jkummerow@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 1 Apr 2014 12:45:00 +0000 (12:45 +0000)
committerjkummerow@chromium.org <jkummerow@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 1 Apr 2014 12:45:00 +0000 (12:45 +0000)
With the simulator, MSan detects all memory accesses from JIT code
without the need for annotations.

We'd like to keep the annotation in the native (w/o simulator) mode
until we can move all MSan+V8 users to simulator mode.

R=jkummerow@chromium.org

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

Patch from Evgeniy Stepanov <eugenis@chromium.org>.

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

src/msan.h
src/spaces.cc

index 484c9fa..b07d66d 100644 (file)
@@ -30,6 +30,8 @@
 #ifndef V8_MSAN_H_
 #define V8_MSAN_H_
 
+#include "globals.h"
+
 #ifndef __has_feature
 # define __has_feature(x) 0
 #endif
 # define MEMORY_SANITIZER
 #endif
 
-#ifdef MEMORY_SANITIZER
-# include <sanitizer/msan_interface.h>
+#if defined(MEMORY_SANITIZER) && !defined(USE_SIMULATOR)
+# include <sanitizer/msan_interface.h>  // NOLINT
 // Marks a memory range as fully initialized.
-# define MSAN_MEMORY_IS_INITIALIZED(p, s) __msan_unpoison((p), (s))
+# define MSAN_MEMORY_IS_INITIALIZED_IN_JIT(p, s) __msan_unpoison((p), (s))
 #else
-# define MSAN_MEMORY_IS_INITIALIZED(p, s)
+# define MSAN_MEMORY_IS_INITIALIZED_IN_JIT(p, s)
 #endif
 
 #endif  // V8_MSAN_H_
index 6df15fa..7831ef1 100644 (file)
@@ -711,7 +711,7 @@ MemoryChunk* MemoryAllocator::AllocateChunk(intptr_t reserve_area_size,
                                                 executable,
                                                 owner);
   result->set_reserved_memory(&reservation);
-  MSAN_MEMORY_IS_INITIALIZED(base, chunk_size);
+  MSAN_MEMORY_IS_INITIALIZED_IN_JIT(base, chunk_size);
   return result;
 }