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

Side by Side Diff: src/globals.h

Issue 151163005: A64: Synchronize with r16356. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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 | « src/global-handles.cc ('k') | src/handles.cc » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 10 matching lines...) Expand all
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #ifndef V8_GLOBALS_H_ 28 #ifndef V8_GLOBALS_H_
29 #define V8_GLOBALS_H_ 29 #define V8_GLOBALS_H_
30 30
31 // Define V8_INFINITY 31 #include "../include/v8stdint.h"
32 #define V8_INFINITY INFINITY
33
34 // GCC specific stuff
35 #ifdef __GNUC__
36
37 #define __GNUC_VERSION_FOR_INFTY__ (__GNUC__ * 10000 + __GNUC_MINOR__ * 100)
38 32
39 // Unfortunately, the INFINITY macro cannot be used with the '-pedantic' 33 // Unfortunately, the INFINITY macro cannot be used with the '-pedantic'
40 // warning flag and certain versions of GCC due to a bug: 34 // warning flag and certain versions of GCC due to a bug:
41 // http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11931 35 // http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11931
42 // For now, we use the more involved template-based version from <limits>, but 36 // For now, we use the more involved template-based version from <limits>, but
43 // only when compiling with GCC versions affected by the bug (2.96.x - 4.0.x) 37 // only when compiling with GCC versions affected by the bug (2.96.x - 4.0.x)
44 // __GNUC_PREREQ is not defined in GCC for Mac OS X, so we define our own macro 38 #if V8_CC_GNU && V8_GNUC_PREREQ(2, 96, 0) && !V8_GNUC_PREREQ(4, 1, 0)
45 #if __GNUC_VERSION_FOR_INFTY__ >= 29600 && __GNUC_VERSION_FOR_INFTY__ < 40100 39 # include <limits> // NOLINT
46 #include <limits> 40 # define V8_INFINITY std::numeric_limits<double>::infinity()
47 #undef V8_INFINITY 41 #elif V8_CC_MSVC
48 #define V8_INFINITY std::numeric_limits<double>::infinity() 42 # define V8_INFINITY HUGE_VAL
43 #else
44 # define V8_INFINITY INFINITY
49 #endif 45 #endif
50 #undef __GNUC_VERSION_FOR_INFTY__
51
52 #endif // __GNUC__
53
54 #ifdef _MSC_VER
55 #undef V8_INFINITY
56 #define V8_INFINITY HUGE_VAL
57 #endif
58
59
60 #include "../include/v8stdint.h"
61 46
62 namespace v8 { 47 namespace v8 {
63 namespace internal { 48 namespace internal {
64 49
65 // Processor architecture detection. For more info on what's defined, see: 50 // Processor architecture detection. For more info on what's defined, see:
66 // http://msdn.microsoft.com/en-us/library/b0084kay.aspx 51 // http://msdn.microsoft.com/en-us/library/b0084kay.aspx
67 // http://www.agner.org/optimize/calling_conventions.pdf 52 // http://www.agner.org/optimize/calling_conventions.pdf
68 // or with gcc, run: "echo | gcc -E -dM -" 53 // or with gcc, run: "echo | gcc -E -dM -"
69 #if defined(_M_X64) || defined(__x86_64__) 54 #if defined(_M_X64) || defined(__x86_64__)
70 #if defined(__native_client__) 55 #if defined(__native_client__)
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 284
300 // Latin1/UTF-16 constants 285 // Latin1/UTF-16 constants
301 // Code-point values in Unicode 4.0 are 21 bits wide. 286 // Code-point values in Unicode 4.0 are 21 bits wide.
302 // Code units in UTF-16 are 16 bits wide. 287 // Code units in UTF-16 are 16 bits wide.
303 typedef uint16_t uc16; 288 typedef uint16_t uc16;
304 typedef int32_t uc32; 289 typedef int32_t uc32;
305 const int kOneByteSize = kCharSize; 290 const int kOneByteSize = kCharSize;
306 const int kUC16Size = sizeof(uc16); // NOLINT 291 const int kUC16Size = sizeof(uc16); // NOLINT
307 292
308 293
294 // Round up n to be a multiple of sz, where sz is a power of 2.
295 #define ROUND_UP(n, sz) (((n) + ((sz) - 1)) & ~((sz) - 1))
296
297
309 // The expression OFFSET_OF(type, field) computes the byte-offset 298 // The expression OFFSET_OF(type, field) computes the byte-offset
310 // of the specified field relative to the containing type. This 299 // of the specified field relative to the containing type. This
311 // corresponds to 'offsetof' (in stddef.h), except that it doesn't 300 // corresponds to 'offsetof' (in stddef.h), except that it doesn't
312 // use 0 or NULL, which causes a problem with the compiler warnings 301 // use 0 or NULL, which causes a problem with the compiler warnings
313 // we have enabled (which is also why 'offsetof' doesn't seem to work). 302 // we have enabled (which is also why 'offsetof' doesn't seem to work).
314 // Here we simply use the non-zero value 4, which seems to work. 303 // Here we simply use the non-zero value 4, which seems to work.
315 #define OFFSET_OF(type, field) \ 304 #define OFFSET_OF(type, field) \
316 (reinterpret_cast<intptr_t>(&(reinterpret_cast<type*>(4)->field)) - 4) 305 (reinterpret_cast<intptr_t>(&(reinterpret_cast<type*>(4)->field)) - 4)
317 306
318 307
(...skipping 18 matching lines...) Expand all
337 326
338 327
339 // FUNCTION_CAST<F>(addr) casts an address into a function 328 // FUNCTION_CAST<F>(addr) casts an address into a function
340 // of type F. Used to invoke generated code from within C. 329 // of type F. Used to invoke generated code from within C.
341 template <typename F> 330 template <typename F>
342 F FUNCTION_CAST(Address addr) { 331 F FUNCTION_CAST(Address addr) {
343 return reinterpret_cast<F>(reinterpret_cast<intptr_t>(addr)); 332 return reinterpret_cast<F>(reinterpret_cast<intptr_t>(addr));
344 } 333 }
345 334
346 335
347 // Compiler feature detection.
348 #if defined(__clang__)
349
350 # if __has_feature(cxx_override_control)
351 # define V8_HAVE_CXX11_FINAL
352 # define V8_HAVE_CXX11_OVERRIDE
353 # endif
354
355 #elif defined(__GNUC__)
356
357 // g++ requires -std=c++0x or -std=gnu++0x to support C++11 functionality
358 // without warnings (functionality used by the macros below). These modes
359 // are detectable by checking whether __GXX_EXPERIMENTAL_CXX0X__ is defined or,
360 // more standardly, by checking whether __cplusplus has a C++11 or greater
361 // value. Current versions of g++ do not correctly set __cplusplus, so we check
362 // both for forward compatibility.
363 # if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L
364 # if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)
365 # define V8_HAVE_CXX11_OVERRIDE
366 # define V8_HAVE_CXX11_FINAL
367 # endif
368 # else
369 // '__final' is a non-C++11 GCC synonym for 'final', per GCC r176655.
370 # if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)
371 # define V8_HAVE_GXX_FINAL
372 # endif
373 # endif
374
375 #elif defined(_MSC_VER)
376
377 // Override control was added with Visual Studio 2005.
378 # if _MSC_VER >= 1400
379 # if _MSC_VER >= 1700
380 # define V8_HAVE_CXX11_FINAL
381 # else
382 // Visual Studio 2010 and earlier spell "final" as "sealed".
383 # define V8_HAVE_MSVC_SEALED
384 # endif
385 # define V8_HAVE_CXX11_OVERRIDE
386 # endif
387
388 #endif
389
390
391 #if __cplusplus >= 201103L
392 #define DISALLOW_BY_DELETE = delete
393 #else
394 #define DISALLOW_BY_DELETE
395 #endif
396
397
398 // A macro to disallow the evil copy constructor and operator= functions 336 // A macro to disallow the evil copy constructor and operator= functions
399 // This should be used in the private: declarations for a class 337 // This should be used in the private: declarations for a class
400 #define DISALLOW_COPY_AND_ASSIGN(TypeName) \ 338 #define DISALLOW_COPY_AND_ASSIGN(TypeName) \
401 TypeName(const TypeName&) DISALLOW_BY_DELETE; \ 339 TypeName(const TypeName&) V8_DELETE; \
402 void operator=(const TypeName&) DISALLOW_BY_DELETE 340 void operator=(const TypeName&) V8_DELETE
403 341
404 342
405 // A macro to disallow all the implicit constructors, namely the 343 // A macro to disallow all the implicit constructors, namely the
406 // default constructor, copy constructor and operator= functions. 344 // default constructor, copy constructor and operator= functions.
407 // 345 //
408 // This should be used in the private: declarations for a class 346 // This should be used in the private: declarations for a class
409 // that wants to prevent anyone from instantiating it. This is 347 // that wants to prevent anyone from instantiating it. This is
410 // especially useful for classes containing only static methods. 348 // especially useful for classes containing only static methods.
411 #define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \ 349 #define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \
412 TypeName() DISALLOW_BY_DELETE; \ 350 TypeName() V8_DELETE; \
413 DISALLOW_COPY_AND_ASSIGN(TypeName) 351 DISALLOW_COPY_AND_ASSIGN(TypeName)
414 352
415 353
416 // Define used for helping GCC to make better inlining. Don't bother for debug 354 // Newly written code should use V8_INLINE() and V8_NOINLINE() directly.
417 // builds. On GCC 3.4.5 using __attribute__((always_inline)) causes compilation 355 #define INLINE(declarator) V8_INLINE(declarator)
418 // errors in debug build. 356 #define NO_INLINE(declarator) V8_NOINLINE(declarator)
419 #if defined(__GNUC__) && !defined(DEBUG)
420 #if (__GNUC__ >= 4)
421 #define INLINE(header) inline header __attribute__((always_inline))
422 #define NO_INLINE(header) header __attribute__((noinline))
423 #else
424 #define INLINE(header) inline __attribute__((always_inline)) header
425 #define NO_INLINE(header) __attribute__((noinline)) header
426 #endif
427 #elif defined(_MSC_VER) && !defined(DEBUG)
428 #define INLINE(header) __forceinline header
429 #define NO_INLINE(header) header
430 #else
431 #define INLINE(header) inline header
432 #define NO_INLINE(header) header
433 #endif
434 357
435 358
436 // Annotate a virtual method indicating it must be overriding a virtual 359 // Newly written code should use V8_WARN_UNUSED_RESULT.
437 // method in the parent class. 360 #define MUST_USE_RESULT V8_WARN_UNUSED_RESULT
438 // Use like:
439 // virtual void bar() V8_OVERRIDE;
440 #if defined(V8_HAVE_CXX11_OVERRIDE)
441 #define V8_OVERRIDE override
442 #else
443 #define V8_OVERRIDE
444 #endif
445
446
447 // Annotate a virtual method indicating that subclasses must not override it,
448 // or annotate a class to indicate that it cannot be subclassed.
449 // Use like:
450 // class B V8_FINAL : public A {};
451 // virtual void bar() V8_FINAL;
452 #if defined(V8_HAVE_CXX11_FINAL)
453 #define V8_FINAL final
454 #elif defined(V8_HAVE_GXX_FINAL)
455 #define V8_FINAL __final
456 #elif defined(V8_HAVE_MSVC_SEALED)
457 #define V8_FINAL sealed
458 #else
459 #define V8_FINAL
460 #endif
461
462
463 #if defined(__GNUC__) && __GNUC__ >= 4
464 #define MUST_USE_RESULT __attribute__ ((warn_unused_result))
465 #else
466 #define MUST_USE_RESULT
467 #endif
468 361
469 362
470 // Define DISABLE_ASAN macros. 363 // Define DISABLE_ASAN macros.
471 #if defined(__has_feature) 364 #if defined(__has_feature)
472 #if __has_feature(address_sanitizer) 365 #if __has_feature(address_sanitizer)
473 #define DISABLE_ASAN __attribute__((no_address_safety_analysis)) 366 #define DISABLE_ASAN __attribute__((no_address_safety_analysis))
474 #endif 367 #endif
475 #endif 368 #endif
476 369
477 370
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 // the backend, so both modes are represented by the kStrictMode value. 421 // the backend, so both modes are represented by the kStrictMode value.
529 enum StrictModeFlag { 422 enum StrictModeFlag {
530 kNonStrictMode, 423 kNonStrictMode,
531 kStrictMode 424 kStrictMode
532 }; 425 };
533 426
534 427
535 } } // namespace v8::internal 428 } } // namespace v8::internal
536 429
537 #endif // V8_GLOBALS_H_ 430 #endif // V8_GLOBALS_H_
OLDNEW
« no previous file with comments | « src/global-handles.cc ('k') | src/handles.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698