2013-10-23 08:39:15 +00:00
|
|
|
// Copyright 2013 the V8 project authors. All rights reserved.
|
2014-04-29 06:42:26 +00:00
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
2013-10-23 08:39:15 +00:00
|
|
|
|
|
|
|
// MemorySanitizer support.
|
|
|
|
|
|
|
|
#ifndef V8_MSAN_H_
|
|
|
|
#define V8_MSAN_H_
|
|
|
|
|
2014-06-03 08:12:43 +00:00
|
|
|
#include "src/globals.h"
|
2014-04-01 12:45:00 +00:00
|
|
|
|
2013-10-23 08:39:15 +00:00
|
|
|
#ifndef __has_feature
|
|
|
|
# define __has_feature(x) 0
|
|
|
|
#endif
|
|
|
|
|
2013-10-23 13:50:01 +00:00
|
|
|
#if __has_feature(memory_sanitizer) && !defined(MEMORY_SANITIZER)
|
2013-10-23 08:39:15 +00:00
|
|
|
# define MEMORY_SANITIZER
|
|
|
|
#endif
|
|
|
|
|
2014-08-21 09:35:59 +00:00
|
|
|
#if defined(MEMORY_SANITIZER)
|
2014-04-01 12:45:00 +00:00
|
|
|
# include <sanitizer/msan_interface.h> // NOLINT
|
2014-08-21 09:35:59 +00:00
|
|
|
|
|
|
|
// Marks a memory range as uninitialized, as if it was allocated here.
|
|
|
|
# define MSAN_ALLOCATED_UNINITIALIZED_MEMORY(p, s) \
|
|
|
|
__msan_allocated_memory((p), (s))
|
2014-09-19 11:32:17 +00:00
|
|
|
// Marks a memory range as initialized.
|
|
|
|
#define MSAN_MEMORY_IS_INITIALIZED(p, s) __msan_unpoison((p), (s))
|
2014-08-21 09:35:59 +00:00
|
|
|
#else
|
|
|
|
# define MSAN_ALLOCATED_UNINITIALIZED_MEMORY(p, s)
|
2014-09-19 11:32:17 +00:00
|
|
|
#define MSAN_MEMORY_IS_INITIALIZED(p, s)
|
2014-08-21 09:35:59 +00:00
|
|
|
#endif
|
|
|
|
|
2013-10-23 08:39:15 +00:00
|
|
|
#endif // V8_MSAN_H_
|