| 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_LINUX) | 6 #if defined(TARGET_OS_LINUX) |
| 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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 free(ptr); | 339 free(ptr); |
| 340 } | 340 } |
| 341 | 341 |
| 342 | 342 |
| 343 // TODO(5411554): May need to hoist these architecture dependent code | 343 // TODO(5411554): May need to hoist these architecture dependent code |
| 344 // into a architecture specific file e.g: os_ia32_linux.cc | 344 // into a architecture specific file e.g: os_ia32_linux.cc |
| 345 word OS::ActivationFrameAlignment() { | 345 word OS::ActivationFrameAlignment() { |
| 346 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) | 346 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) |
| 347 const int kMinimumAlignment = 16; | 347 const int kMinimumAlignment = 16; |
| 348 #elif defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_MIPS) | 348 #elif defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_MIPS) |
| 349 // TODO(regis): Verify alignment constraints on MIPS. | |
| 350 const int kMinimumAlignment = 8; | 349 const int kMinimumAlignment = 8; |
| 351 #else | 350 #else |
| 352 #error Unsupported architecture. | 351 #error Unsupported architecture. |
| 353 #endif | 352 #endif |
| 354 word alignment = kMinimumAlignment; | 353 word alignment = kMinimumAlignment; |
| 355 // TODO(5411554): Allow overriding default stack alignment for | 354 // TODO(5411554): Allow overriding default stack alignment for |
| 356 // testing purposes. | 355 // testing purposes. |
| 357 // Flags::DebugIsInt("stackalign", &alignment); | 356 // Flags::DebugIsInt("stackalign", &alignment); |
| 358 ASSERT(Utils::IsPowerOfTwo(alignment)); | 357 ASSERT(Utils::IsPowerOfTwo(alignment)); |
| 359 ASSERT(alignment >= kMinimumAlignment); | 358 ASSERT(alignment >= kMinimumAlignment); |
| 360 return alignment; | 359 return alignment; |
| 361 } | 360 } |
| 362 | 361 |
| 363 | 362 |
| 364 word OS::PreferredCodeAlignment() { | 363 word OS::PreferredCodeAlignment() { |
| 365 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) | 364 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) |
| 366 const int kMinimumAlignment = 32; | 365 const int kMinimumAlignment = 32; |
| 367 #elif defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_MIPS) | 366 #elif defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_MIPS) |
| 368 // TODO(regis): Verify alignment constraints on MIPS. | |
| 369 const int kMinimumAlignment = 16; | 367 const int kMinimumAlignment = 16; |
| 370 #else | 368 #else |
| 371 #error Unsupported architecture. | 369 #error Unsupported architecture. |
| 372 #endif | 370 #endif |
| 373 word alignment = kMinimumAlignment; | 371 word alignment = kMinimumAlignment; |
| 374 // TODO(5411554): Allow overriding default code alignment for | 372 // TODO(5411554): Allow overriding default code alignment for |
| 375 // testing purposes. | 373 // testing purposes. |
| 376 // Flags::DebugIsInt("codealign", &alignment); | 374 // Flags::DebugIsInt("codealign", &alignment); |
| 377 ASSERT(Utils::IsPowerOfTwo(alignment)); | 375 ASSERT(Utils::IsPowerOfTwo(alignment)); |
| 378 ASSERT(alignment >= kMinimumAlignment); | 376 ASSERT(alignment >= kMinimumAlignment); |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 } | 518 } |
| 521 | 519 |
| 522 | 520 |
| 523 void OS::Exit(int code) { | 521 void OS::Exit(int code) { |
| 524 exit(code); | 522 exit(code); |
| 525 } | 523 } |
| 526 | 524 |
| 527 } // namespace dart | 525 } // namespace dart |
| 528 | 526 |
| 529 #endif // defined(TARGET_OS_LINUX) | 527 #endif // defined(TARGET_OS_LINUX) |
| OLD | NEW |