Chromium Code Reviews| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 43 | 43 |
| 44 #if !defined(UNICODE) | 44 #if !defined(UNICODE) |
| 45 #define _UNICODE | 45 #define _UNICODE |
| 46 #define UNICODE | 46 #define UNICODE |
| 47 #endif | 47 #endif |
| 48 | 48 |
| 49 #include <windows.h> | 49 #include <windows.h> |
| 50 #include <winsock2.h> | 50 #include <winsock2.h> |
| 51 #include <Rpc.h> | 51 #include <Rpc.h> |
| 52 #include <shellapi.h> | 52 #include <shellapi.h> |
| 53 #endif | 53 #endif // defined(_WIN32) |
| 54 | 54 |
| 55 #if !defined(_WIN32) | 55 #if !defined(_WIN32) |
| 56 #include <arpa/inet.h> | 56 #include <arpa/inet.h> |
| 57 #include <inttypes.h> | 57 #include <inttypes.h> |
| 58 #include <stdint.h> | 58 #include <stdint.h> |
| 59 #include <unistd.h> | 59 #include <unistd.h> |
| 60 #endif | 60 #endif |
| 61 | 61 |
| 62 #include <float.h> | 62 #include <float.h> |
| 63 #include <limits.h> | 63 #include <limits.h> |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 82 | 82 |
| 83 // Target OS detection. | 83 // Target OS detection. |
| 84 // for more information on predefined macros: | 84 // for more information on predefined macros: |
| 85 // - http://msdn.microsoft.com/en-us/library/b0084kay.aspx | 85 // - http://msdn.microsoft.com/en-us/library/b0084kay.aspx |
| 86 // - with gcc, run: "echo | gcc -E -dM -" | 86 // - with gcc, run: "echo | gcc -E -dM -" |
| 87 #if defined(__ANDROID__) | 87 #if defined(__ANDROID__) |
| 88 #define TARGET_OS_ANDROID 1 | 88 #define TARGET_OS_ANDROID 1 |
| 89 #elif defined(__linux__) || defined(__FreeBSD__) | 89 #elif defined(__linux__) || defined(__FreeBSD__) |
| 90 #define TARGET_OS_LINUX 1 | 90 #define TARGET_OS_LINUX 1 |
| 91 #elif defined(__APPLE__) | 91 #elif defined(__APPLE__) |
| 92 // Define the flavor of Mac OS we are running on. | |
| 93 #include <TargetConditionals.h> | |
| 94 // TODO(iposva): Rename TARGET_OS_MACOS to TARGET_OS_MAC to inherit | |
| 95 // the value defined in TargetConditionals.h | |
| 92 #define TARGET_OS_MACOS 1 | 96 #define TARGET_OS_MACOS 1 |
| 93 #elif defined(_WIN32) | 97 #elif defined(_WIN32) |
| 94 #define TARGET_OS_WINDOWS 1 | 98 #define TARGET_OS_WINDOWS 1 |
| 95 #else | 99 #else |
| 96 #error Automatic target os detection failed. | 100 #error Automatic target os detection failed. |
| 97 #endif | 101 #endif |
| 98 | 102 |
| 99 namespace dart { | 103 namespace dart { |
| 100 | 104 |
| 101 struct simd128_value_t { | 105 struct simd128_value_t { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 164 #define kFpuRegisterSize 8 | 168 #define kFpuRegisterSize 8 |
| 165 typedef double fpu_register_t; | 169 typedef double fpu_register_t; |
| 166 #else | 170 #else |
| 167 #define kFpuRegisterSize 16 | 171 #define kFpuRegisterSize 16 |
| 168 typedef simd128_value_t fpu_register_t; | 172 typedef simd128_value_t fpu_register_t; |
| 169 #endif | 173 #endif |
| 170 #elif defined(__ARMEL__) | 174 #elif defined(__ARMEL__) |
| 171 #define HOST_ARCH_ARM 1 | 175 #define HOST_ARCH_ARM 1 |
| 172 #define ARCH_IS_32_BIT 1 | 176 #define ARCH_IS_32_BIT 1 |
| 173 #define kFpuRegisterSize 16 | 177 #define kFpuRegisterSize 16 |
| 178 // Mark the fact that we have defined simd_value_t. | |
| 179 #define SIMD_VALUE_T_ | |
| 174 typedef struct { | 180 typedef struct { |
| 175 union { | 181 union { |
| 176 uint32_t u; | 182 uint32_t u; |
| 177 float f; | 183 float f; |
| 178 } data_[4]; | 184 } data_[4]; |
| 179 } simd_value_t; | 185 } simd_value_t; |
| 180 typedef simd_value_t fpu_register_t; | 186 typedef simd_value_t fpu_register_t; |
| 181 #define simd_value_safe_load(addr) \ | 187 #define simd_value_safe_load(addr) \ |
| 182 (*reinterpret_cast<simd_value_t *>(addr)) | 188 (*reinterpret_cast<simd_value_t *>(addr)) |
| 183 #define simd_value_safe_store(addr, value) \ | 189 #define simd_value_safe_store(addr, value) \ |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 256 #error Mismatched Host/Target architectures. | 262 #error Mismatched Host/Target architectures. |
| 257 #endif | 263 #endif |
| 258 #elif defined(TARGET_ARCH_IA32) || \ | 264 #elif defined(TARGET_ARCH_IA32) || \ |
| 259 defined(TARGET_ARCH_ARM) || \ | 265 defined(TARGET_ARCH_ARM) || \ |
| 260 defined(TARGET_ARCH_MIPS) | 266 defined(TARGET_ARCH_MIPS) |
| 261 #if !defined(ARCH_IS_32_BIT) | 267 #if !defined(ARCH_IS_32_BIT) |
| 262 #error Mismatched Host/Target architectures. | 268 #error Mismatched Host/Target architectures. |
| 263 #endif | 269 #endif |
| 264 #endif | 270 #endif |
| 265 | 271 |
| 272 // Determine whether we will be using the simulator. | |
| 273 #if defined(TARGET_ARCH_IA32) | |
| 274 // No simulator used. | |
| 275 #elif defined(TARGET_ARCH_X64) | |
| 276 // No simulator used. | |
| 277 #elif defined(TARGET_ARCH_ARM) | |
| 278 #if !defined(HOST_ARCH_ARM) || TARGET_OS_IPHONE | |
|
srdjan
2015/05/29 16:58:56
|| defined(TARGET_OS_IPHONE) ? (also below)
Ivan Posva
2015/05/29 17:25:36
Unfortunately the definition is always there, exce
| |
| 279 #define USING_SIMULATOR 1 | |
| 280 #endif | |
| 281 | |
| 282 #elif defined(TARGET_ARCH_ARM64) | |
| 283 #if !defined(HOST_ARCH_ARM64) || TARGET_OS_IPHONE | |
| 284 #define USING_SIMULATOR 1 | |
| 285 #endif | |
| 286 | |
| 287 #elif defined(TARGET_ARCH_MIPS) | |
| 288 #if !defined(HOST_ARCH_MIPS) || TARGET_OS_IPHONE | |
| 289 #define USING_SIMULATOR 1 | |
| 290 #endif | |
| 291 | |
| 292 #else | |
| 293 #error Unknown architecture. | |
| 294 #endif | |
| 295 | |
| 266 | 296 |
| 267 // Short form printf format specifiers | 297 // Short form printf format specifiers |
| 268 #define Pd PRIdPTR | 298 #define Pd PRIdPTR |
| 269 #define Pu PRIuPTR | 299 #define Pu PRIuPTR |
| 270 #define Px PRIxPTR | 300 #define Px PRIxPTR |
| 271 #define Pd64 PRId64 | 301 #define Pd64 PRId64 |
| 272 #define Pu64 PRIu64 | 302 #define Pu64 PRIu64 |
| 273 #define Px64 PRIx64 | 303 #define Px64 PRIx64 |
| 274 | 304 |
| 275 | 305 |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 544 // should be counted from two, not one." | 574 // should be counted from two, not one." |
| 545 #define PRINTF_ATTRIBUTE(string_index, first_to_check) \ | 575 #define PRINTF_ATTRIBUTE(string_index, first_to_check) \ |
| 546 __attribute__((__format__(__printf__, string_index, first_to_check))) | 576 __attribute__((__format__(__printf__, string_index, first_to_check))) |
| 547 #else | 577 #else |
| 548 #define PRINTF_ATTRIBUTE(string_index, first_to_check) | 578 #define PRINTF_ATTRIBUTE(string_index, first_to_check) |
| 549 #endif | 579 #endif |
| 550 | 580 |
| 551 } // namespace dart | 581 } // namespace dart |
| 552 | 582 |
| 553 #endif // PLATFORM_GLOBALS_H_ | 583 #endif // PLATFORM_GLOBALS_H_ |
| OLD | NEW |