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 #include "vm/globals.h" | 5 #include "vm/globals.h" |
6 #if defined(TARGET_OS_MACOS) | 6 #if defined(TARGET_OS_MACOS) |
7 | 7 |
8 #include "vm/os.h" | 8 #include "vm/os.h" |
9 | 9 |
10 #include <errno.h> // NOLINT | 10 #include <errno.h> // NOLINT |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 #endif | 197 #endif |
198 #else // TARGET_OS_IOS | 198 #else // TARGET_OS_IOS |
199 // OS X activation frames must be 16 byte-aligned; see "Mac OS X ABI | 199 // OS X activation frames must be 16 byte-aligned; see "Mac OS X ABI |
200 // Function Call Guide". | 200 // Function Call Guide". |
201 return 16; | 201 return 16; |
202 #endif // TARGET_OS_IOS | 202 #endif // TARGET_OS_IOS |
203 } | 203 } |
204 | 204 |
205 | 205 |
206 intptr_t OS::PreferredCodeAlignment() { | 206 intptr_t OS::PreferredCodeAlignment() { |
207 ASSERT(32 <= OS::kMaxPreferredCodeAlignment); | 207 #if defined(TARGET_ARCH_IA32) || \ |
208 return 32; | 208 defined(TARGET_ARCH_X64) || \ |
| 209 defined(TARGET_ARCH_ARM64) || \ |
| 210 defined(TARGET_ARCH_DBC) |
| 211 const int kMinimumAlignment = 32; |
| 212 #elif defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_MIPS) |
| 213 const int kMinimumAlignment = 16; |
| 214 #else |
| 215 #error Unsupported architecture. |
| 216 #endif |
| 217 intptr_t alignment = kMinimumAlignment; |
| 218 // TODO(5411554): Allow overriding default code alignment for |
| 219 // testing purposes. |
| 220 // Flags::DebugIsInt("codealign", &alignment); |
| 221 ASSERT(Utils::IsPowerOfTwo(alignment)); |
| 222 ASSERT(alignment >= kMinimumAlignment); |
| 223 ASSERT(alignment <= OS::kMaxPreferredCodeAlignment); |
| 224 return alignment; |
209 } | 225 } |
210 | 226 |
211 | 227 |
212 bool OS::AllowStackFrameIteratorFromAnotherThread() { | 228 bool OS::AllowStackFrameIteratorFromAnotherThread() { |
213 return false; | 229 return false; |
214 } | 230 } |
215 | 231 |
216 | 232 |
217 int OS::NumberOfAvailableProcessors() { | 233 int OS::NumberOfAvailableProcessors() { |
218 return sysconf(_SC_NPROCESSORS_ONLN); | 234 return sysconf(_SC_NPROCESSORS_ONLN); |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 } | 426 } |
411 | 427 |
412 | 428 |
413 void OS::Exit(int code) { | 429 void OS::Exit(int code) { |
414 exit(code); | 430 exit(code); |
415 } | 431 } |
416 | 432 |
417 } // namespace dart | 433 } // namespace dart |
418 | 434 |
419 #endif // defined(TARGET_OS_MACOS) | 435 #endif // defined(TARGET_OS_MACOS) |
OLD | NEW |