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

Unified Diff: base/compiler_specific.h

Issue 2473153003: Move some compiler intrinsic #defines to base/. (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/wtf/Compiler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/compiler_specific.h
diff --git a/base/compiler_specific.h b/base/compiler_specific.h
index 0dbc3ae576688908b41a1b5921c744a71f5ada4c..996db0e5a70e47190a58bd6a34e1f26dcb572b13 100644
--- a/base/compiler_specific.h
+++ b/base/compiler_specific.h
@@ -100,6 +100,17 @@
#define NOINLINE
#endif
+// For compatibility with callers in Blink:
+#define NEVER_INLINE NOINLINE
dcheng 2016/11/07 20:43:10 Btw, maybe a TODO here for eventual convergence. I
palmer 2016/11/07 21:54:14 Done.
+
+#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 +207,14 @@
#endif // defined(COMPILER_GCC)
#endif // !defined(UNLIKELY)
+#if !defined(LIKELY)
+#if defined(COMPILER_GCC)
+#define LIKELY(x) __builtin_expect((x), 1)
+#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 | third_party/WebKit/Source/wtf/Compiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698