| 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_ANDROID) | 6 #if defined(TARGET_OS_ANDROID) |
| 7 | 7 |
| 8 #include "vm/os.h" | 8 #include "vm/os.h" |
| 9 | 9 |
| 10 #include <android/log.h> // NOLINT | 10 #include <android/log.h> // NOLINT |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 UNREACHABLE(); | 174 UNREACHABLE(); |
| 175 return -1; | 175 return -1; |
| 176 } | 176 } |
| 177 int64_t result = ts.tv_sec; | 177 int64_t result = ts.tv_sec; |
| 178 result *= kMicrosecondsPerSecond; | 178 result *= kMicrosecondsPerSecond; |
| 179 result += (ts.tv_nsec / kNanosecondsPerMicrosecond); | 179 result += (ts.tv_nsec / kNanosecondsPerMicrosecond); |
| 180 return result; | 180 return result; |
| 181 } | 181 } |
| 182 | 182 |
| 183 | 183 |
| 184 void* OS::AlignedAllocate(intptr_t size, intptr_t alignment) { | |
| 185 const int kMinimumAlignment = 16; | |
| 186 ASSERT(Utils::IsPowerOfTwo(alignment)); | |
| 187 ASSERT(alignment >= kMinimumAlignment); | |
| 188 void* p = memalign(alignment, size); | |
| 189 if (p == NULL) { | |
| 190 UNREACHABLE(); | |
| 191 } | |
| 192 return p; | |
| 193 } | |
| 194 | |
| 195 | |
| 196 void OS::AlignedFree(void* ptr) { | |
| 197 free(ptr); | |
| 198 } | |
| 199 | |
| 200 | |
| 201 // TODO(5411554): May need to hoist these architecture dependent code | 184 // TODO(5411554): May need to hoist these architecture dependent code |
| 202 // into a architecture specific file e.g: os_ia32_linux.cc | 185 // into a architecture specific file e.g: os_ia32_linux.cc |
| 203 intptr_t OS::ActivationFrameAlignment() { | 186 intptr_t OS::ActivationFrameAlignment() { |
| 204 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) || \ | 187 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) || \ |
| 205 defined(TARGET_ARCH_ARM64) | 188 defined(TARGET_ARCH_ARM64) |
| 206 const int kMinimumAlignment = 16; | 189 const int kMinimumAlignment = 16; |
| 207 #elif defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_DBC) | 190 #elif defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_DBC) |
| 208 const int kMinimumAlignment = 8; | 191 const int kMinimumAlignment = 8; |
| 209 #else | 192 #else |
| 210 #error Unsupported architecture. | 193 #error Unsupported architecture. |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 } | 439 } |
| 457 | 440 |
| 458 | 441 |
| 459 void OS::Exit(int code) { | 442 void OS::Exit(int code) { |
| 460 exit(code); | 443 exit(code); |
| 461 } | 444 } |
| 462 | 445 |
| 463 } // namespace dart | 446 } // namespace dart |
| 464 | 447 |
| 465 #endif // defined(TARGET_OS_ANDROID) | 448 #endif // defined(TARGET_OS_ANDROID) |
| OLD | NEW |