Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(532)

Unified Diff: base/compiler_specific.h

Issue 2473153003: Move some compiler intrinsic #defines to base/. (Closed)
Patch Set: Don't redefine ALWAYS_INLINE in ios/... . Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: base/compiler_specific.h
diff --git a/base/compiler_specific.h b/base/compiler_specific.h
index 0dbc3ae576688908b41a1b5921c744a71f5ada4c..bb4c52be45e298b31c73566f8b927445a7a952f4 100644
--- a/base/compiler_specific.h
+++ b/base/compiler_specific.h
@@ -100,6 +100,14 @@
#define NOINLINE
#endif
+#if COMPILER_GCC && defined(NDEBUG)
+#define ALWAYS_INLINE inline __attribute__((__always_inline__))
+#elif COMPILER_MSVC && defined(NDEBUG)
+#define ALWAYS_INLINE __forceinline
+#else
+#define ALWAYS_INLINE inline
+#endif
+
// Specify memory alignment for structs, classes, etc.
// Use like:
// class ALIGNAS(16) MyClass { ... }
@@ -196,6 +204,14 @@
#endif // defined(COMPILER_GCC)
#endif // !defined(UNLIKELY)
+#if !defined(LIKELY)
+#if defined(COMPILER_GCC)
+#define LIKELY(x) __builtin_expect((x), 1)
sdefresne 2016/11/08 08:40:20 Shouldn't this be __builtin_expect(!!(x), 1)? Othe
palmer 2016/11/16 23:45:21 Somehow, I missed this comment. Fix coming right u
+#else
+#define LIKELY(x) (x)
+#endif // defined(COMPILER_GCC)
+#endif // !defined(LIKELY)
+
// Compiler feature-detection.
// clang.llvm.org/docs/LanguageExtensions.html#has-feature-and-has-extension
#if defined(__has_feature)
« no previous file with comments | « no previous file | ios/third_party/blink/src/html_tokenizer_adapter.h » ('j') | ios/third_party/blink/src/html_tokenizer_adapter.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698