1 // Copyright 2017 the V8 project authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef V8_BASE_TSAN_H_ 6 #define V8_BASE_TSAN_H_ 7 8 namespace v8 { 9 namespace base { 10 11 // This file contains annotations for ThreadSanitizer (TSan), a race detector. 12 // See 13 // https://llvm.org/svn/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_interface_ann.cc 14 15 #if THREAD_SANITIZER 16 17 #define TSAN_ANNOTATE_IGNORE_READS_BEGIN \ 18 v8::base::AnnotateIgnoreReadsBegin(__FILE__, __LINE__) 19 #define TSAN_ANNOTATE_IGNORE_READS_END \ 20 v8::base::AnnotateIgnoreReadsEnd(__FILE__, __LINE__) 21 #define TSAN_ANNOTATE_IGNORE_WRITES_BEGIN \ 22 v8::base::AnnotateIgnoreWritesBegin(__FILE__, __LINE__) 23 #define TSAN_ANNOTATE_IGNORE_WRITES_END \ 24 v8::base::AnnotateIgnoreWritesEnd(__FILE__, __LINE__) 25 26 extern "C" { 27 28 void AnnotateIgnoreReadsBegin(const char* file, int line); 29 void AnnotateIgnoreReadsEnd(const char* file, int line); 30 void AnnotateIgnoreWritesBegin(const char* file, int line); 31 void AnnotateIgnoreWritesEnd(const char* file, int line); 32 33 } // extern "C" 34 35 #else 36 37 #define TSAN_ANNOTATE_IGNORE_READS_BEGIN ((void)0) 38 #define TSAN_ANNOTATE_IGNORE_READS_END ((void)0) 39 #define TSAN_ANNOTATE_IGNORE_WRITES_BEGIN ((void)0) 40 #define TSAN_ANNOTATE_IGNORE_WRITES_END ((void)0) 41 42 #endif 43 44 } // namespace base 45 } // namespace v8 46 47 #endif // V8_BASE_TSAN_H_ 48