| 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 PLATFORM_GLOBALS_H_ | 5 #ifndef PLATFORM_GLOBALS_H_ |
| 6 #define PLATFORM_GLOBALS_H_ | 6 #define PLATFORM_GLOBALS_H_ |
| 7 | 7 |
| 8 // __STDC_FORMAT_MACROS has to be defined before including <inttypes.h> to | 8 // __STDC_FORMAT_MACROS has to be defined before including <inttypes.h> to |
| 9 // enable platform independent printf format specifiers. | 9 // enable platform independent printf format specifiers. |
| 10 #ifndef __STDC_FORMAT_MACROS | 10 #ifndef __STDC_FORMAT_MACROS |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 #error Automatic target os detection failed. | 72 #error Automatic target os detection failed. |
| 73 #endif | 73 #endif |
| 74 | 74 |
| 75 // Processor architecture detection. For more info on what's defined, see: | 75 // Processor architecture detection. For more info on what's defined, see: |
| 76 // http://msdn.microsoft.com/en-us/library/b0084kay.aspx | 76 // http://msdn.microsoft.com/en-us/library/b0084kay.aspx |
| 77 // http://www.agner.org/optimize/calling_conventions.pdf | 77 // http://www.agner.org/optimize/calling_conventions.pdf |
| 78 // or with gcc, run: "echo | gcc -E -dM -" | 78 // or with gcc, run: "echo | gcc -E -dM -" |
| 79 #if defined(_M_X64) || defined(__x86_64__) | 79 #if defined(_M_X64) || defined(__x86_64__) |
| 80 #define HOST_ARCH_X64 1 | 80 #define HOST_ARCH_X64 1 |
| 81 #define ARCH_IS_64_BIT 1 | 81 #define ARCH_IS_64_BIT 1 |
| 82 #include <xmmintrin.h> // NOLINT |
| 83 #define kFpuRegisterSize 16 |
| 84 typedef __m128 fpu_register_t; |
| 85 typedef __m128 simd_value_t; |
| 86 // Unaligned load. |
| 87 #define simd_value_safe_load(addr) \ |
| 88 _mm_loadu_ps(reinterpret_cast<const float*>(addr)) |
| 89 // Unaligned store. |
| 90 #define simd_value_safe_store(addr, value) \ |
| 91 _mm_storeu_ps(reinterpret_cast<float*>(addr), value) |
| 82 #elif defined(_M_IX86) || defined(__i386__) | 92 #elif defined(_M_IX86) || defined(__i386__) |
| 83 #define HOST_ARCH_IA32 1 | 93 #define HOST_ARCH_IA32 1 |
| 84 #define ARCH_IS_32_BIT 1 | 94 #define ARCH_IS_32_BIT 1 |
| 95 #include <xmmintrin.h> // NOLINT |
| 96 #define kFpuRegisterSize 16 |
| 97 typedef __m128 fpu_register_t; |
| 98 typedef __m128 simd_value_t; |
| 99 // Unaligned load. |
| 100 #define simd_value_safe_load(addr) \ |
| 101 _mm_loadu_ps(reinterpret_cast<const float*>(addr)) |
| 102 // Unaligned store. |
| 103 #define simd_value_safe_store(addr, value) \ |
| 104 _mm_storeu_ps(reinterpret_cast<float*>(addr), value) |
| 85 #elif defined(__ARMEL__) | 105 #elif defined(__ARMEL__) |
| 86 #define HOST_ARCH_ARM 1 | 106 #define HOST_ARCH_ARM 1 |
| 87 #define ARCH_IS_32_BIT 1 | 107 #define ARCH_IS_32_BIT 1 |
| 108 #define kFpuRegisterSize 8 |
| 109 typedef double fpu_register_t; |
| 110 // TODO(johnmccutchan): ARM simd type. |
| 111 typedef struct { |
| 112 uint32_t data_[4]; |
| 113 } simd_value_t; |
| 88 #elif defined(__MIPSEL__) | 114 #elif defined(__MIPSEL__) |
| 89 #define HOST_ARCH_MIPS 1 | 115 #define HOST_ARCH_MIPS 1 |
| 90 #define ARCH_IS_32_BIT 1 | 116 #define ARCH_IS_32_BIT 1 |
| 117 #define kFpuRegisterSize 8 |
| 118 typedef double fpu_register_t; |
| 119 // TODO(johnmccutchan): MIPS simd type. |
| 120 typedef struct { |
| 121 uint32_t data_[4]; |
| 122 } simd_value_t; |
| 91 #else | 123 #else |
| 92 #error Architecture was not detected as supported by Dart. | 124 #error Architecture was not detected as supported by Dart. |
| 93 #endif | 125 #endif |
| 94 | 126 |
| 95 #if !defined(TARGET_ARCH_MIPS) | 127 #if !defined(TARGET_ARCH_MIPS) |
| 96 #if !defined(TARGET_ARCH_ARM) | 128 #if !defined(TARGET_ARCH_ARM) |
| 97 #if !defined(TARGET_ARCH_X64) | 129 #if !defined(TARGET_ARCH_X64) |
| 98 #if !defined(TARGET_ARCH_IA32) | 130 #if !defined(TARGET_ARCH_IA32) |
| 99 // No target architecture specified pick the one matching the host architecture. | 131 // No target architecture specified pick the one matching the host architecture. |
| 100 #if defined(HOST_ARCH_MIPS) | 132 #if defined(HOST_ARCH_MIPS) |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 const uint64_t kMaxUint64 = DART_2PART_UINT64_C(0xFFFFFFFF, FFFFFFFF); | 194 const uint64_t kMaxUint64 = DART_2PART_UINT64_C(0xFFFFFFFF, FFFFFFFF); |
| 163 | 195 |
| 164 // Types for native machine words. Guaranteed to be able to hold pointers and | 196 // Types for native machine words. Guaranteed to be able to hold pointers and |
| 165 // integers. | 197 // integers. |
| 166 typedef intptr_t word; | 198 typedef intptr_t word; |
| 167 typedef uintptr_t uword; | 199 typedef uintptr_t uword; |
| 168 | 200 |
| 169 // Byte sizes. | 201 // Byte sizes. |
| 170 const int kWordSize = sizeof(word); | 202 const int kWordSize = sizeof(word); |
| 171 const int kDoubleSize = sizeof(double); // NOLINT | 203 const int kDoubleSize = sizeof(double); // NOLINT |
| 172 const int kFloatSize = sizeof(float); // NOLINT | 204 const int kFloatSize = sizeof(float); // NOLINT |
| 205 const int kSimd128Size = 16; |
| 173 #ifdef ARCH_IS_32_BIT | 206 #ifdef ARCH_IS_32_BIT |
| 174 const int kWordSizeLog2 = 2; | 207 const int kWordSizeLog2 = 2; |
| 175 const uword kUwordMax = kMaxUint32; | 208 const uword kUwordMax = kMaxUint32; |
| 176 #else | 209 #else |
| 177 const int kWordSizeLog2 = 3; | 210 const int kWordSizeLog2 = 3; |
| 178 const uword kUwordMax = kMaxUint64; | 211 const uword kUwordMax = kMaxUint64; |
| 179 #endif | 212 #endif |
| 180 | 213 |
| 181 // Bit sizes. | 214 // Bit sizes. |
| 182 const int kBitsPerByte = 8; | 215 const int kBitsPerByte = 8; |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 // have an implicit 'this' argument, the arguments of such methods | 415 // have an implicit 'this' argument, the arguments of such methods |
| 383 // should be counted from two, not one." | 416 // should be counted from two, not one." |
| 384 // | 417 // |
| 385 #define PRINTF_ATTRIBUTE(string_index, first_to_check) \ | 418 #define PRINTF_ATTRIBUTE(string_index, first_to_check) \ |
| 386 __attribute__((__format__(__printf__, string_index, first_to_check))) | 419 __attribute__((__format__(__printf__, string_index, first_to_check))) |
| 387 #else | 420 #else |
| 388 #define PRINTF_ATTRIBUTE(string_index, first_to_check) | 421 #define PRINTF_ATTRIBUTE(string_index, first_to_check) |
| 389 #endif | 422 #endif |
| 390 | 423 |
| 391 #endif // PLATFORM_GLOBALS_H_ | 424 #endif // PLATFORM_GLOBALS_H_ |
| OLD | NEW |