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

Side by Side Diff: include/v8config.h

Issue 23414003: Add V8_NOINLINE() and define INLINE()/NO_INLINE() in terms of their V8_*() counterparts. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE Created 7 years, 3 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/globals.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 // V8_HAS_CXX11_OVERRIDE - override marker supported 105 // V8_HAS_CXX11_OVERRIDE - override marker supported
106 // 106 //
107 // Compiler-specific feature detection 107 // Compiler-specific feature detection
108 // 108 //
109 // V8_HAS___ALIGNOF - __alignof(type) operator supported 109 // V8_HAS___ALIGNOF - __alignof(type) operator supported
110 // V8_HAS___ALIGNOF__ - __alignof__(type) operator supported 110 // V8_HAS___ALIGNOF__ - __alignof__(type) operator supported
111 // V8_HAS_ATTRIBUTE_ALIGNED - __attribute__((aligned(n))) supported 111 // V8_HAS_ATTRIBUTE_ALIGNED - __attribute__((aligned(n))) supported
112 // V8_HAS_ATTRIBUTE_ALWAYS_INLINE - __attribute__((always_inline)) 112 // V8_HAS_ATTRIBUTE_ALWAYS_INLINE - __attribute__((always_inline))
113 // supported 113 // supported
114 // V8_HAS_ATTRIBUTE_DEPRECATED - __attribute__((deprecated)) supported 114 // V8_HAS_ATTRIBUTE_DEPRECATED - __attribute__((deprecated)) supported
115 // V8_HAS_ATTRIBUTE_NOINLINE - __attribute__((noinline)) supported
115 // V8_HAS_ATTRIBUTE_VISIBILITY - __attribute__((visibility)) supported 116 // V8_HAS_ATTRIBUTE_VISIBILITY - __attribute__((visibility)) supported
116 // V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT - __attribute__((warn_unused_result)) 117 // V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT - __attribute__((warn_unused_result))
117 // supported 118 // supported
118 // V8_HAS_BUILTIN_EXPECT - __builtin_expect() supported 119 // V8_HAS_BUILTIN_EXPECT - __builtin_expect() supported
119 // V8_HAS_DECLSPEC_ALIGN - __declspec(align(n)) supported 120 // V8_HAS_DECLSPEC_ALIGN - __declspec(align(n)) supported
120 // V8_HAS_DECLSPEC_DEPRECATED - __declspec(deprecated) supported 121 // V8_HAS_DECLSPEC_DEPRECATED - __declspec(deprecated) supported
122 // V8_HAS_DECLSPEC_NOINLINE - __declspec(noinline) supported
121 // V8_HAS___FINAL - __final supported in non-C++11 mode 123 // V8_HAS___FINAL - __final supported in non-C++11 mode
122 // V8_HAS___FORCEINLINE - __forceinline supported 124 // V8_HAS___FORCEINLINE - __forceinline supported
123 // V8_HAS_SEALED - MSVC style sealed marker supported 125 // V8_HAS_SEALED - MSVC style sealed marker supported
124 // 126 //
125 // Note that testing for compilers and/or features must be done using #if 127 // Note that testing for compilers and/or features must be done using #if
126 // not #ifdef. For example, to test for Intel C++ Compiler, use: 128 // not #ifdef. For example, to test for Intel C++ Compiler, use:
127 // #if V8_CC_INTEL 129 // #if V8_CC_INTEL
128 // ... 130 // ...
129 // #endif 131 // #endif
130 132
131 #if defined(__clang__) 133 #if defined(__clang__)
132 134
133 // Don't treat clang as GCC. 135 // Don't treat clang as GCC.
134 # define V8_GNUC_PREREQ(major, minor, patchlevel) 0 136 # define V8_GNUC_PREREQ(major, minor, patchlevel) 0
135 137
136 # define V8_CC_CLANG 1 138 # define V8_CC_CLANG 1
137 139
138 // Clang defines __alignof__ as alias for __alignof 140 // Clang defines __alignof__ as alias for __alignof
139 # define V8_HAS___ALIGNOF 1 141 # define V8_HAS___ALIGNOF 1
140 # define V8_HAS___ALIGNOF__ V8_HAS___ALIGNOF 142 # define V8_HAS___ALIGNOF__ V8_HAS___ALIGNOF
141 143
142 # define V8_HAS_ATTRIBUTE_ALIGNED (__has_attribute(aligned)) 144 # define V8_HAS_ATTRIBUTE_ALIGNED (__has_attribute(aligned))
143 # define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (__has_attribute(always_inline)) 145 # define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (__has_attribute(always_inline))
144 # define V8_HAS_ATTRIBUTE_DEPRECATED (__has_attribute(deprecated)) 146 # define V8_HAS_ATTRIBUTE_DEPRECATED (__has_attribute(deprecated))
147 # define V8_HAS_ATTRIBUTE_NOINLINE (__has_attribute(noinline))
145 # define V8_HAS_ATTRIBUTE_VISIBILITY (__has_attribute(visibility)) 148 # define V8_HAS_ATTRIBUTE_VISIBILITY (__has_attribute(visibility))
146 # define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT \ 149 # define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT \
147 (__has_attribute(warn_unused_result)) 150 (__has_attribute(warn_unused_result))
148 151
149 # define V8_HAS_BUILTIN_EXPECT (__has_builtin(__builtin_expect)) 152 # define V8_HAS_BUILTIN_EXPECT (__has_builtin(__builtin_expect))
150 153
151 # define V8_HAS_CXX11_ALIGNAS (__has_feature(cxx_alignas)) 154 # define V8_HAS_CXX11_ALIGNAS (__has_feature(cxx_alignas))
152 # define V8_HAS_CXX11_STATIC_ASSERT (__has_feature(cxx_static_assert)) 155 # define V8_HAS_CXX11_STATIC_ASSERT (__has_feature(cxx_static_assert))
153 # define V8_HAS_CXX11_DELETE (__has_feature(cxx_deleted_functions)) 156 # define V8_HAS_CXX11_DELETE (__has_feature(cxx_deleted_functions))
154 # define V8_HAS_CXX11_FINAL (__has_feature(cxx_override_control)) 157 # define V8_HAS_CXX11_FINAL (__has_feature(cxx_override_control))
(...skipping 11 matching lines...) Expand all
166 # define V8_CC_MINGW (defined(__MINGW32__)) 169 # define V8_CC_MINGW (defined(__MINGW32__))
167 170
168 # define V8_HAS___ALIGNOF__ (V8_GNUC_PREREQ(4, 3, 0)) 171 # define V8_HAS___ALIGNOF__ (V8_GNUC_PREREQ(4, 3, 0))
169 172
170 # define V8_HAS_ATTRIBUTE_ALIGNED (V8_GNUC_PREREQ(2, 95, 0)) 173 # define V8_HAS_ATTRIBUTE_ALIGNED (V8_GNUC_PREREQ(2, 95, 0))
171 // always_inline is available in gcc 4.0 but not very reliable until 4.4. 174 // always_inline is available in gcc 4.0 but not very reliable until 4.4.
172 // Works around "sorry, unimplemented: inlining failed" build errors with 175 // Works around "sorry, unimplemented: inlining failed" build errors with
173 // older compilers. 176 // older compilers.
174 # define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (V8_GNUC_PREREQ(4, 4, 0)) 177 # define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (V8_GNUC_PREREQ(4, 4, 0))
175 # define V8_HAS_ATTRIBUTE_DEPRECATED (V8_GNUC_PREREQ(3, 4, 0)) 178 # define V8_HAS_ATTRIBUTE_DEPRECATED (V8_GNUC_PREREQ(3, 4, 0))
179 # define V8_HAS_ATTRIBUTE_NOINLINE (V8_GNUC_PREREQ(3, 4, 0))
176 # define V8_HAS_ATTRIBUTE_VISIBILITY (V8_GNUC_PREREQ(4, 3, 0)) 180 # define V8_HAS_ATTRIBUTE_VISIBILITY (V8_GNUC_PREREQ(4, 3, 0))
177 # define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT \ 181 # define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT \
178 (!V8_CC_INTEL && V8_GNUC_PREREQ(4, 1, 0)) 182 (!V8_CC_INTEL && V8_GNUC_PREREQ(4, 1, 0))
179 183
180 # define V8_HAS_BUILTIN_EXPECT (V8_GNUC_PREREQ(2, 96, 0)) 184 # define V8_HAS_BUILTIN_EXPECT (V8_GNUC_PREREQ(2, 96, 0))
181 185
182 // g++ requires -std=c++0x or -std=gnu++0x to support C++11 functionality 186 // g++ requires -std=c++0x or -std=gnu++0x to support C++11 functionality
183 // without warnings (functionality used by the macros below). These modes 187 // without warnings (functionality used by the macros below). These modes
184 // are detectable by checking whether __GXX_EXPERIMENTAL_CXX0X__ is defined or, 188 // are detectable by checking whether __GXX_EXPERIMENTAL_CXX0X__ is defined or,
185 // more standardly, by checking whether __cplusplus has a C++11 or greater 189 // more standardly, by checking whether __cplusplus has a C++11 or greater
(...skipping 20 matching lines...) Expand all
206 # define V8_HAS___ALIGNOF 1 210 # define V8_HAS___ALIGNOF 1
207 211
208 // Override control was added with Visual Studio 2005, but 212 // Override control was added with Visual Studio 2005, but
209 // Visual Studio 2010 and earlier spell "final" as "sealed". 213 // Visual Studio 2010 and earlier spell "final" as "sealed".
210 # define V8_HAS_CXX11_FINAL (_MSC_VER >= 1700) 214 # define V8_HAS_CXX11_FINAL (_MSC_VER >= 1700)
211 # define V8_HAS_CXX11_OVERRIDE (_MSC_VER >= 1400) 215 # define V8_HAS_CXX11_OVERRIDE (_MSC_VER >= 1400)
212 # define V8_HAS_SEALED (_MSC_VER >= 1400) 216 # define V8_HAS_SEALED (_MSC_VER >= 1400)
213 217
214 # define V8_HAS_DECLSPEC_ALIGN 1 218 # define V8_HAS_DECLSPEC_ALIGN 1
215 # define V8_HAS_DECLSPEC_DEPRECATED (_MSC_VER >= 1300) 219 # define V8_HAS_DECLSPEC_DEPRECATED (_MSC_VER >= 1300)
220 # define V8_HAS_DECLSPEC_NOINLINE 1
216 221
217 # define V8_HAS___FORCEINLINE 1 222 # define V8_HAS___FORCEINLINE 1
218 223
219 #endif 224 #endif
220 225
221 226
222 // ----------------------------------------------------------------------------- 227 // -----------------------------------------------------------------------------
223 // Helper macros 228 // Helper macros
224 229
225 // A macro used to make better inlining. Don't bother for debug builds. 230 // A macro used to make better inlining. Don't bother for debug builds.
226 #if !defined(DEBUG) && V8_HAS_ATTRIBUTE_ALWAYS_INLINE 231 #if !defined(DEBUG) && V8_HAS_ATTRIBUTE_ALWAYS_INLINE
227 # define V8_INLINE(declarator) inline __attribute__((always_inline)) declarator 232 # define V8_INLINE(declarator) inline __attribute__((always_inline)) declarator
228 #elif !defined(DEBUG) && V8_HAS___FORCEINLINE 233 #elif !defined(DEBUG) && V8_HAS___FORCEINLINE
229 # define V8_INLINE(declarator) __forceinline declarator 234 # define V8_INLINE(declarator) __forceinline declarator
230 #else 235 #else
231 # define V8_INLINE(declarator) inline declarator 236 # define V8_INLINE(declarator) inline declarator
232 #endif 237 #endif
233 238
234 239
240 // A macro used to tell the compiler to never inline a particular function.
241 // Don't bother for debug builds.
242 #if !defined(DEBUG) && V8_HAS_ATTRIBUTE_NOINLINE
243 # define V8_NOINLINE(declarator) __attribute__((noinline)) declarator
244 #elif !defined(DEBUG) && V8_HAS_DECLSPEC_NOINLINE
245 # define V8_NOINLINE(declarator) __declspec(noinline) declarator
246 #else
247 # define V8_NOINLINE(declarator) declarator
248 #endif
249
250
235 // A macro to mark classes or functions as deprecated. 251 // A macro to mark classes or functions as deprecated.
236 #if !V8_DISABLE_DEPRECATIONS && V8_HAS_ATTRIBUTE_DEPRECATED 252 #if !V8_DISABLE_DEPRECATIONS && V8_HAS_ATTRIBUTE_DEPRECATED
237 # define V8_DEPRECATED(declarator) declarator __attribute__((deprecated)) 253 # define V8_DEPRECATED(declarator) declarator __attribute__((deprecated))
238 #elif !V8_DISABLE_DEPRECATIONS && V8_HAS_DECLSPEC_DEPRECATED 254 #elif !V8_DISABLE_DEPRECATIONS && V8_HAS_DECLSPEC_DEPRECATED
239 # define V8_DEPRECATED(declarator) __declspec(deprecated) declarator 255 # define V8_DEPRECATED(declarator) __declspec(deprecated) declarator
240 #else 256 #else
241 # define V8_DEPRECATED(declarator) declarator 257 # define V8_DEPRECATED(declarator) declarator
242 #endif 258 #endif
243 259
244 260
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 # define V8_ALIGNOF(type) __alignof__(type) 371 # define V8_ALIGNOF(type) __alignof__(type)
356 #else 372 #else
357 // Note that alignment of a type within a struct can be less than the 373 // Note that alignment of a type within a struct can be less than the
358 // alignment of the type stand-alone (because of ancient ABIs), so this 374 // alignment of the type stand-alone (because of ancient ABIs), so this
359 // should only be used as a last resort. 375 // should only be used as a last resort.
360 namespace v8 { template <typename T> class AlignOfHelper { char c; T t; }; } 376 namespace v8 { template <typename T> class AlignOfHelper { char c; T t; }; }
361 # define V8_ALIGNOF(type) (sizeof(::v8::AlignOfHelper<type>) - sizeof(type)) 377 # define V8_ALIGNOF(type) (sizeof(::v8::AlignOfHelper<type>) - sizeof(type))
362 #endif 378 #endif
363 379
364 #endif // V8CONFIG_H_ 380 #endif // V8CONFIG_H_
OLDNEW
« no previous file with comments | « no previous file | src/globals.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698