OLD | NEW |
---|---|
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef VM_GLOBALS_H_ | 5 #ifndef VM_GLOBALS_H_ |
6 #define VM_GLOBALS_H_ | 6 #define VM_GLOBALS_H_ |
7 | 7 |
8 // This file contains global definitions for the VM library only. Anything that | 8 // This file contains global definitions for the VM library only. Anything that |
9 // is more globally useful should be added to 'vm/globals.h'. | 9 // is more globally useful should be added to 'vm/globals.h'. |
10 | 10 |
11 #include "platform/globals.h" | 11 #include "platform/globals.h" |
12 | 12 |
13 #if defined(_WIN32) | 13 #if defined(_WIN32) |
14 // Undef conflicting defines. | 14 // Undef conflicting defines. |
15 #undef PARITY_EVEN | 15 #undef PARITY_EVEN |
16 #undef PARITY_ODD | 16 #undef PARITY_ODD |
17 #undef near | 17 #undef near |
18 #endif | 18 #endif |
19 | 19 |
20 // The following #defines are invalidated. | 20 // The following #defines are invalidated. |
21 #undef OVERFLOW // From math.h conflicts in constants_ia32.h | 21 #undef OVERFLOW // From math.h conflicts in constants_ia32.h |
22 | 22 |
23 namespace dart { | 23 namespace dart { |
24 // Smi value range is from -(2^N) to (2^N)-1. | 24 // Smi value range is from -(2^N) to (2^N)-1. |
25 // N=30 (32-bit build) or N=62 (64-bit build). | 25 // N=30 (32-bit build) or N=62 (64-bit build). |
26 const intptr_t kSmiBits = kBitsPerWord - 2; | 26 const intptr_t kSmiBits = kBitsPerWord - 2; |
27 const intptr_t kSmiMax = (static_cast<intptr_t>(1) << kSmiBits) - 1; | 27 const intptr_t kSmiMax = (static_cast<intptr_t>(1) << kSmiBits) - 1; |
28 const intptr_t kSmiMin = -(static_cast<intptr_t>(1) << kSmiBits); | 28 const intptr_t kSmiMin = -(static_cast<intptr_t>(1) << kSmiBits); |
29 | 29 |
30 const intptr_t kSmi64Bits = 62; | |
31 const int64_t kSmi64Max = (static_cast<int64_t>(1) << kSmi64Bits) - 1; | |
32 const int64_t kSmi64Min = -(static_cast<int64_t>(1) << kSmi64Bits); | |
33 | |
siva
2014/09/09 16:47:24
I don't see kSMi64Bits being used anywhere?
zra
2014/09/09 17:42:38
Removed.
| |
34 const intptr_t kSmi32Bits = 30; | |
35 const int64_t kSmi32Max = (static_cast<int32_t>(1) << kSmi32Bits) - 1; | |
36 const int64_t kSmi32Min = -(static_cast<int32_t>(1) << kSmi32Bits); | |
37 | |
30 // The expression ARRAY_SIZE(array) is a compile-time constant of type | 38 // The expression ARRAY_SIZE(array) is a compile-time constant of type |
31 // size_t which represents the number of elements of the given | 39 // size_t which represents the number of elements of the given |
32 // array. You should only use ARRAY_SIZE on statically allocated | 40 // array. You should only use ARRAY_SIZE on statically allocated |
33 // arrays. | 41 // arrays. |
34 #define ARRAY_SIZE(array) \ | 42 #define ARRAY_SIZE(array) \ |
35 ((sizeof(array) / sizeof(*(array))) / \ | 43 ((sizeof(array) / sizeof(*(array))) / \ |
36 static_cast<intptr_t>(!(sizeof(array) % sizeof(*(array))))) | 44 static_cast<intptr_t>(!(sizeof(array) % sizeof(*(array))))) |
37 | 45 |
38 | 46 |
39 // The expression OFFSET_OF(type, field) computes the byte-offset of | 47 // The expression OFFSET_OF(type, field) computes the byte-offset of |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
74 #if defined(ARCH_IS_32_BIT) | 82 #if defined(ARCH_IS_32_BIT) |
75 static const uword kZapUninitializedWord = 0xabababab; | 83 static const uword kZapUninitializedWord = 0xabababab; |
76 #else | 84 #else |
77 static const uword kZapUninitializedWord = 0xabababababababab; | 85 static const uword kZapUninitializedWord = 0xabababababababab; |
78 #endif | 86 #endif |
79 | 87 |
80 | 88 |
81 } // namespace dart | 89 } // namespace dart |
82 | 90 |
83 #endif // VM_GLOBALS_H_ | 91 #endif // VM_GLOBALS_H_ |
OLD | NEW |