| 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 UNREACHABLE(); | 181 UNREACHABLE(); |
| 182 return -1; | 182 return -1; |
| 183 } | 183 } |
| 184 int64_t result = ts.tv_sec; | 184 int64_t result = ts.tv_sec; |
| 185 result *= kMicrosecondsPerSecond; | 185 result *= kMicrosecondsPerSecond; |
| 186 result += (ts.tv_nsec / kNanosecondsPerMicrosecond); | 186 result += (ts.tv_nsec / kNanosecondsPerMicrosecond); |
| 187 return result; | 187 return result; |
| 188 } | 188 } |
| 189 | 189 |
| 190 | 190 |
| 191 void* OS::AlignedAllocate(intptr_t size, intptr_t alignment) { | |
| 192 const int kMinimumAlignment = 16; | |
| 193 ASSERT(Utils::IsPowerOfTwo(alignment)); | |
| 194 ASSERT(alignment >= kMinimumAlignment); | |
| 195 void* p = memalign(alignment, size); | |
| 196 if (p == NULL) { | |
| 197 UNREACHABLE(); | |
| 198 } | |
| 199 return p; | |
| 200 } | |
| 201 | |
| 202 | |
| 203 void OS::AlignedFree(void* ptr) { | |
| 204 free(ptr); | |
| 205 } | |
| 206 | |
| 207 | |
| 208 // TODO(5411554): May need to hoist these architecture dependent code | 191 // TODO(5411554): May need to hoist these architecture dependent code |
| 209 // into a architecture specific file e.g: os_ia32_linux.cc | 192 // into a architecture specific file e.g: os_ia32_linux.cc |
| 210 intptr_t OS::ActivationFrameAlignment() { | 193 intptr_t OS::ActivationFrameAlignment() { |
| 211 #if defined(TARGET_ARCH_IA32) || \ | 194 #if defined(TARGET_ARCH_IA32) || \ |
| 212 defined(TARGET_ARCH_X64) || \ | 195 defined(TARGET_ARCH_X64) || \ |
| 213 defined(TARGET_ARCH_ARM64) || \ | 196 defined(TARGET_ARCH_ARM64) || \ |
| 214 defined(TARGET_ARCH_DBC) | 197 defined(TARGET_ARCH_DBC) |
| 215 const int kMinimumAlignment = 16; | 198 const int kMinimumAlignment = 16; |
| 216 #elif defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_MIPS) | 199 #elif defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_MIPS) |
| 217 const int kMinimumAlignment = 8; | 200 const int kMinimumAlignment = 8; |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 } | 417 } |
| 435 | 418 |
| 436 | 419 |
| 437 void OS::Exit(int code) { | 420 void OS::Exit(int code) { |
| 438 exit(code); | 421 exit(code); |
| 439 } | 422 } |
| 440 | 423 |
| 441 } // namespace dart | 424 } // namespace dart |
| 442 | 425 |
| 443 #endif // defined(TARGET_OS_LINUX) | 426 #endif // defined(TARGET_OS_LINUX) |
| OLD | NEW |