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

Side by Side Diff: src/globals.h

Issue 109017: Use our own macros for 64-bit constants. (Closed)
Patch Set: Remove setting of __STDC_CONSTANT_MACROS. Created 11 years, 7 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
« no previous file with comments | « include/v8.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 // include very early in the main include file. 43 // include very early in the main include file.
44 44
45 #ifdef USE_MYBOOL 45 #ifdef USE_MYBOOL
46 typedef unsigned int __my_bool__; 46 typedef unsigned int __my_bool__;
47 #define bool __my_bool__ // use 'indirection' to avoid name clashes 47 #define bool __my_bool__ // use 'indirection' to avoid name clashes
48 #endif 48 #endif
49 49
50 typedef uint8_t byte; 50 typedef uint8_t byte;
51 typedef byte* Address; 51 typedef byte* Address;
52 52
53 // Define macros for writing 64-bit constants and pointer-size constants. 53 // Define our own macros for writing 64-bit constants. This is less fragile
54 // than defining __STDC_CONSTANT_MACROS before including <stdint.h>, and it
55 // works on compilers that don't have it (like MSVC).
54 #ifdef _MSC_VER 56 #ifdef _MSC_VER
55 #define UINT64_C(x) (x ## UI64) 57 #define V8_UINT64_C(x) (x ## UI64)
56 #define INT64_C(x) (x ## I64) 58 #define V8_INT64_C(x) (x ## I64)
59 #else
60 #define V8_UINT64_C(x) (x ## ULL)
61 #define V8_INT64_C(x) (x ## LL)
57 #endif 62 #endif
58 63
59 // Code-point values in Unicode 4.0 are 21 bits wide. 64 // Code-point values in Unicode 4.0 are 21 bits wide.
60 typedef uint16_t uc16; 65 typedef uint16_t uc16;
61 typedef int32_t uc32; 66 typedef int32_t uc32;
62 67
63 #if defined(V8_ARCH_IA32) || defined(V8_ARCH_X64) 68 #if defined(V8_ARCH_IA32) || defined(V8_ARCH_X64)
64 #define CAN_READ_UNALIGNED 1 69 #define CAN_READ_UNALIGNED 1
65 #endif 70 #endif
66 71
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 const int kBitsPerByte = 8; 118 const int kBitsPerByte = 8;
114 const int kBitsPerByteLog2 = 3; 119 const int kBitsPerByteLog2 = 3;
115 const int kBitsPerPointer = kPointerSize * kBitsPerByte; 120 const int kBitsPerPointer = kPointerSize * kBitsPerByte;
116 const int kBitsPerInt = kIntSize * kBitsPerByte; 121 const int kBitsPerInt = kIntSize * kBitsPerByte;
117 122
118 123
119 // Zap-value: The value used for zapping dead objects. 124 // Zap-value: The value used for zapping dead objects.
120 // Should be a recognizable hex value tagged as a heap object pointer. 125 // Should be a recognizable hex value tagged as a heap object pointer.
121 #ifdef V8_ARCH_X64 126 #ifdef V8_ARCH_X64
122 const Address kZapValue = 127 const Address kZapValue =
123 reinterpret_cast<Address>(UINT64_C(0xdeadbeedbeadbeed)); 128 reinterpret_cast<Address>(V8_UINT64_C(0xdeadbeedbeadbeed));
124 const Address kHandleZapValue = 129 const Address kHandleZapValue =
125 reinterpret_cast<Address>(UINT64_C(0x1baddead0baddead)); 130 reinterpret_cast<Address>(V8_UINT64_C(0x1baddead0baddead));
126 const Address kFromSpaceZapValue = 131 const Address kFromSpaceZapValue =
127 reinterpret_cast<Address>(UINT64_C(0x1beefdad0beefdad)); 132 reinterpret_cast<Address>(V8_UINT64_C(0x1beefdad0beefdad));
128 #else 133 #else
129 const Address kZapValue = reinterpret_cast<Address>(0xdeadbeed); 134 const Address kZapValue = reinterpret_cast<Address>(0xdeadbeed);
130 const Address kHandleZapValue = reinterpret_cast<Address>(0xbaddead); 135 const Address kHandleZapValue = reinterpret_cast<Address>(0xbaddead);
131 const Address kFromSpaceZapValue = reinterpret_cast<Address>(0xbeefdad); 136 const Address kFromSpaceZapValue = reinterpret_cast<Address>(0xbeefdad);
132 #endif 137 #endif
133 138
134 139
135 // ----------------------------------------------------------------------------- 140 // -----------------------------------------------------------------------------
136 // Forward declarations for frequently used classes 141 // Forward declarations for frequently used classes
137 // (sorted alphabetically) 142 // (sorted alphabetically)
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 511
507 Dest dest; 512 Dest dest;
508 memcpy(&dest, &source, sizeof(dest)); 513 memcpy(&dest, &source, sizeof(dest));
509 return dest; 514 return dest;
510 } 515 }
511 516
512 517
513 } } // namespace v8::internal 518 } } // namespace v8::internal
514 519
515 #endif // V8_GLOBALS_H_ 520 #endif // V8_GLOBALS_H_
OLDNEW
« no previous file with comments | « include/v8.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698