| OLD | NEW |
| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 #include "../include/v8stdint.h" | 60 #include "../include/v8stdint.h" |
| 61 | 61 |
| 62 namespace v8 { | 62 namespace v8 { |
| 63 namespace internal { | 63 namespace internal { |
| 64 | 64 |
| 65 // Processor architecture detection. For more info on what's defined, see: | 65 // Processor architecture detection. For more info on what's defined, see: |
| 66 // http://msdn.microsoft.com/en-us/library/b0084kay.aspx | 66 // http://msdn.microsoft.com/en-us/library/b0084kay.aspx |
| 67 // http://www.agner.org/optimize/calling_conventions.pdf | 67 // http://www.agner.org/optimize/calling_conventions.pdf |
| 68 // or with gcc, run: "echo | gcc -E -dM -" | 68 // or with gcc, run: "echo | gcc -E -dM -" |
| 69 #if defined(_M_X64) || defined(__x86_64__) | 69 #if defined(_M_X64) || defined(__x86_64__) |
| 70 #if defined(__native_client__) |
| 71 // For Native Client builds of V8, use V8_TARGET_ARCH_ARM, so that V8 |
| 72 // generates ARM machine code, together a portable ARM simulator |
| 73 // compiled for the host architecture in question. |
| 74 // |
| 75 // Since Native Client is ILP-32 on all architectures we use |
| 76 // V8_HOST_ARCH_IA32 on both 32- and 64-bit x86. |
| 77 #define V8_HOST_ARCH_IA32 1 |
| 78 #define V8_HOST_ARCH_32_BIT 1 |
| 79 #define V8_HOST_CAN_READ_UNALIGNED 1 |
| 80 #else |
| 70 #define V8_HOST_ARCH_X64 1 | 81 #define V8_HOST_ARCH_X64 1 |
| 71 #define V8_HOST_ARCH_64_BIT 1 | 82 #define V8_HOST_ARCH_64_BIT 1 |
| 72 #define V8_HOST_CAN_READ_UNALIGNED 1 | 83 #define V8_HOST_CAN_READ_UNALIGNED 1 |
| 84 #endif // __native_client__ |
| 73 #elif defined(_M_IX86) || defined(__i386__) | 85 #elif defined(_M_IX86) || defined(__i386__) |
| 74 #define V8_HOST_ARCH_IA32 1 | 86 #define V8_HOST_ARCH_IA32 1 |
| 75 #define V8_HOST_ARCH_32_BIT 1 | 87 #define V8_HOST_ARCH_32_BIT 1 |
| 76 #define V8_HOST_CAN_READ_UNALIGNED 1 | 88 #define V8_HOST_CAN_READ_UNALIGNED 1 |
| 77 #elif defined(__ARMEL__) | 89 #elif defined(__ARMEL__) |
| 78 #define V8_HOST_ARCH_ARM 1 | 90 #define V8_HOST_ARCH_ARM 1 |
| 79 #define V8_HOST_ARCH_32_BIT 1 | 91 #define V8_HOST_ARCH_32_BIT 1 |
| 80 // Some CPU-OS combinations allow unaligned access on ARM. We assume | 92 // Some CPU-OS combinations allow unaligned access on ARM. We assume |
| 81 // that unaligned accesses are not allowed unless the build system | 93 // that unaligned accesses are not allowed unless the build system |
| 82 // defines the CAN_USE_UNALIGNED_ACCESSES macro to be non-zero. | 94 // defines the CAN_USE_UNALIGNED_ACCESSES macro to be non-zero. |
| 83 #if CAN_USE_UNALIGNED_ACCESSES | 95 #if CAN_USE_UNALIGNED_ACCESSES |
| 84 #define V8_HOST_CAN_READ_UNALIGNED 1 | 96 #define V8_HOST_CAN_READ_UNALIGNED 1 |
| 85 #endif | 97 #endif |
| 86 #elif defined(__MIPSEL__) | 98 #elif defined(__MIPSEL__) |
| 87 #define V8_HOST_ARCH_MIPS 1 | 99 #define V8_HOST_ARCH_MIPS 1 |
| 88 #define V8_HOST_ARCH_32_BIT 1 | 100 #define V8_HOST_ARCH_32_BIT 1 |
| 89 #else | 101 #else |
| 90 #error Host architecture was not detected as supported by v8 | 102 #error Host architecture was not detected as supported by v8 |
| 91 #endif | 103 #endif |
| 92 | 104 |
| 93 // Target architecture detection. This may be set externally. If not, detect | 105 // Target architecture detection. This may be set externally. If not, detect |
| 94 // in the same way as the host architecture, that is, target the native | 106 // in the same way as the host architecture, that is, target the native |
| 95 // environment as presented by the compiler. | 107 // environment as presented by the compiler. |
| 96 #if !defined(V8_TARGET_ARCH_X64) && !defined(V8_TARGET_ARCH_IA32) && \ | 108 #if !defined(V8_TARGET_ARCH_X64) && !defined(V8_TARGET_ARCH_IA32) && \ |
| 97 !defined(V8_TARGET_ARCH_ARM) && !defined(V8_TARGET_ARCH_MIPS) | 109 !defined(V8_TARGET_ARCH_ARM) && !defined(V8_TARGET_ARCH_MIPS) |
| 98 #if defined(_M_X64) || defined(__x86_64__) | 110 #if defined(__native_client__) |
| 111 // use ARM JIT with interpreter to bootstrap NaCl port |
| 112 #define V8_TARGET_ARCH_ARM 1 |
| 113 #elif defined(_M_X64) || defined(__x86_64__) |
| 99 #define V8_TARGET_ARCH_X64 1 | 114 #define V8_TARGET_ARCH_X64 1 |
| 100 #elif defined(_M_IX86) || defined(__i386__) | 115 #elif defined(_M_IX86) || defined(__i386__) |
| 101 #define V8_TARGET_ARCH_IA32 1 | 116 #define V8_TARGET_ARCH_IA32 1 |
| 102 #elif defined(__ARMEL__) | 117 #elif defined(__ARMEL__) |
| 103 #define V8_TARGET_ARCH_ARM 1 | 118 #define V8_TARGET_ARCH_ARM 1 |
| 104 #elif defined(__MIPSEL__) | 119 #elif defined(__MIPSEL__) |
| 105 #define V8_TARGET_ARCH_MIPS 1 | 120 #define V8_TARGET_ARCH_MIPS 1 |
| 106 #else | 121 #else |
| 107 #error Target architecture was not detected as supported by v8 | 122 #error Target architecture was not detected as supported by v8 |
| 108 #endif | 123 #endif |
| (...skipping 19 matching lines...) Expand all Loading... |
| 128 // Setting USE_SIMULATOR explicitly from the build script will force | 143 // Setting USE_SIMULATOR explicitly from the build script will force |
| 129 // the use of a simulated environment. | 144 // the use of a simulated environment. |
| 130 #if !defined(USE_SIMULATOR) | 145 #if !defined(USE_SIMULATOR) |
| 131 #if (defined(V8_TARGET_ARCH_ARM) && !defined(V8_HOST_ARCH_ARM)) | 146 #if (defined(V8_TARGET_ARCH_ARM) && !defined(V8_HOST_ARCH_ARM)) |
| 132 #define USE_SIMULATOR 1 | 147 #define USE_SIMULATOR 1 |
| 133 #endif | 148 #endif |
| 134 #if (defined(V8_TARGET_ARCH_MIPS) && !defined(V8_HOST_ARCH_MIPS)) | 149 #if (defined(V8_TARGET_ARCH_MIPS) && !defined(V8_HOST_ARCH_MIPS)) |
| 135 #define USE_SIMULATOR 1 | 150 #define USE_SIMULATOR 1 |
| 136 #endif | 151 #endif |
| 137 #endif | 152 #endif |
| 153 // V8_ARM_ON_X86_64 is used to conditionally compile code for |
| 154 // using ARM code generation together with an ARM simulator on |
| 155 // x86_64 hosts. |
| 156 #if defined(__x86_64__) |
| 157 #if defined(V8_TARGET_ARCH_ARM) && defined(USE_SIMULATOR) |
| 158 #define V8_ARM_ON_X86_64 1 |
| 159 #endif |
| 160 #endif |
| 138 | 161 |
| 139 // Support for alternative bool type. This is only enabled if the code is | 162 // Support for alternative bool type. This is only enabled if the code is |
| 140 // compiled with USE_MYBOOL defined. This catches some nasty type bugs. | 163 // compiled with USE_MYBOOL defined. This catches some nasty type bugs. |
| 141 // For instance, 'bool b = "false";' results in b == true! This is a hidden | 164 // For instance, 'bool b = "false";' results in b == true! This is a hidden |
| 142 // source of bugs. | 165 // source of bugs. |
| 143 // However, redefining the bool type does have some negative impact on some | 166 // However, redefining the bool type does have some negative impact on some |
| 144 // platforms. It gives rise to compiler warnings (i.e. with | 167 // platforms. It gives rise to compiler warnings (i.e. with |
| 145 // MSVC) in the API header files when mixing code that uses the standard | 168 // MSVC) in the API header files when mixing code that uses the standard |
| 146 // bool with code that uses the redefined version. | 169 // bool with code that uses the redefined version. |
| 147 // This does not actually belong in the platform code, but needs to be | 170 // This does not actually belong in the platform code, but needs to be |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 // the backend, so both modes are represented by the kStrictMode value. | 417 // the backend, so both modes are represented by the kStrictMode value. |
| 395 enum StrictModeFlag { | 418 enum StrictModeFlag { |
| 396 kNonStrictMode, | 419 kNonStrictMode, |
| 397 kStrictMode | 420 kStrictMode |
| 398 }; | 421 }; |
| 399 | 422 |
| 400 | 423 |
| 401 } } // namespace v8::internal | 424 } } // namespace v8::internal |
| 402 | 425 |
| 403 #endif // V8_GLOBALS_H_ | 426 #endif // V8_GLOBALS_H_ |
| OLD | NEW |