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/os.h" | 5 #include "vm/os.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <limits.h> | 8 #include <limits.h> |
9 #include <malloc.h> | 9 #include <malloc.h> |
10 #include <time.h> | 10 #include <time.h> |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 void OS::AlignedFree(void* ptr) { | 243 void OS::AlignedFree(void* ptr) { |
244 free(ptr); | 244 free(ptr); |
245 } | 245 } |
246 | 246 |
247 | 247 |
248 // TODO(5411554): May need to hoist these architecture dependent code | 248 // TODO(5411554): May need to hoist these architecture dependent code |
249 // into a architecture specific file e.g: os_ia32_linux.cc | 249 // into a architecture specific file e.g: os_ia32_linux.cc |
250 word OS::ActivationFrameAlignment() { | 250 word OS::ActivationFrameAlignment() { |
251 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) | 251 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) |
252 const int kMinimumAlignment = 16; | 252 const int kMinimumAlignment = 16; |
253 #elif defined(TARGET_ARCH_ARM) | 253 #elif defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_MIPS) |
| 254 // TODO(regis): Verify alignment constraints on MIPS. |
254 const int kMinimumAlignment = 8; | 255 const int kMinimumAlignment = 8; |
255 #else | 256 #else |
256 #error Unsupported architecture. | 257 #error Unsupported architecture. |
257 #endif | 258 #endif |
258 word alignment = kMinimumAlignment; | 259 word alignment = kMinimumAlignment; |
259 // TODO(5411554): Allow overriding default stack alignment for | 260 // TODO(5411554): Allow overriding default stack alignment for |
260 // testing purposes. | 261 // testing purposes. |
261 // Flags::DebugIsInt("stackalign", &alignment); | 262 // Flags::DebugIsInt("stackalign", &alignment); |
262 ASSERT(Utils::IsPowerOfTwo(alignment)); | 263 ASSERT(Utils::IsPowerOfTwo(alignment)); |
263 ASSERT(alignment >= kMinimumAlignment); | 264 ASSERT(alignment >= kMinimumAlignment); |
264 return alignment; | 265 return alignment; |
265 } | 266 } |
266 | 267 |
267 | 268 |
268 word OS::PreferredCodeAlignment() { | 269 word OS::PreferredCodeAlignment() { |
269 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) | 270 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) |
270 const int kMinimumAlignment = 16; | 271 const int kMinimumAlignment = 16; |
271 #elif defined(TARGET_ARCH_ARM) | 272 #elif defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_MIPS) |
| 273 // TODO(regis): Verify alignment constraints on MIPS. |
272 const int kMinimumAlignment = 16; | 274 const int kMinimumAlignment = 16; |
273 #else | 275 #else |
274 #error Unsupported architecture. | 276 #error Unsupported architecture. |
275 #endif | 277 #endif |
276 word alignment = kMinimumAlignment; | 278 word alignment = kMinimumAlignment; |
277 // TODO(5411554): Allow overriding default code alignment for | 279 // TODO(5411554): Allow overriding default code alignment for |
278 // testing purposes. | 280 // testing purposes. |
279 // Flags::DebugIsInt("codealign", &alignment); | 281 // Flags::DebugIsInt("codealign", &alignment); |
280 ASSERT(Utils::IsPowerOfTwo(alignment)); | 282 ASSERT(Utils::IsPowerOfTwo(alignment)); |
281 ASSERT(alignment >= kMinimumAlignment); | 283 ASSERT(alignment >= kMinimumAlignment); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 void OS::Abort() { | 402 void OS::Abort() { |
401 abort(); | 403 abort(); |
402 } | 404 } |
403 | 405 |
404 | 406 |
405 void OS::Exit(int code) { | 407 void OS::Exit(int code) { |
406 exit(code); | 408 exit(code); |
407 } | 409 } |
408 | 410 |
409 } // namespace dart | 411 } // namespace dart |
OLD | NEW |