| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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_FUCHSIA) | 6 #if defined(TARGET_OS_FUCHSIA) |
| 7 | 7 |
| 8 #include "vm/os.h" | 8 #include "vm/os.h" |
| 9 | 9 |
| 10 #include <errno.h> | 10 #include <errno.h> |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 return ticks / kNanosecondsPerMicrosecond; | 77 return ticks / kNanosecondsPerMicrosecond; |
| 78 } | 78 } |
| 79 | 79 |
| 80 | 80 |
| 81 int64_t OS::GetCurrentThreadCPUMicros() { | 81 int64_t OS::GetCurrentThreadCPUMicros() { |
| 82 UNIMPLEMENTED(); | 82 UNIMPLEMENTED(); |
| 83 return 0; | 83 return 0; |
| 84 } | 84 } |
| 85 | 85 |
| 86 | 86 |
| 87 void* OS::AlignedAllocate(intptr_t size, intptr_t alignment) { | |
| 88 const int kMinimumAlignment = 16; | |
| 89 ASSERT(Utils::IsPowerOfTwo(alignment)); | |
| 90 ASSERT(alignment >= kMinimumAlignment); | |
| 91 void* p = memalign(alignment, size); | |
| 92 if (p == NULL) { | |
| 93 UNREACHABLE(); | |
| 94 } | |
| 95 return p; | |
| 96 } | |
| 97 | |
| 98 | |
| 99 void OS::AlignedFree(void* ptr) { | |
| 100 free(ptr); | |
| 101 } | |
| 102 | |
| 103 | |
| 104 // TODO(5411554): May need to hoist these architecture dependent code | 87 // TODO(5411554): May need to hoist these architecture dependent code |
| 105 // into a architecture specific file e.g: os_ia32_fuchsia.cc | 88 // into a architecture specific file e.g: os_ia32_fuchsia.cc |
| 106 intptr_t OS::ActivationFrameAlignment() { | 89 intptr_t OS::ActivationFrameAlignment() { |
| 107 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) || \ | 90 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) || \ |
| 108 defined(TARGET_ARCH_ARM64) | 91 defined(TARGET_ARCH_ARM64) |
| 109 const int kMinimumAlignment = 16; | 92 const int kMinimumAlignment = 16; |
| 110 #elif defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_DBC) | 93 #elif defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_DBC) |
| 111 const int kMinimumAlignment = 8; | 94 const int kMinimumAlignment = 8; |
| 112 #else | 95 #else |
| 113 #error Unsupported architecture. | 96 #error Unsupported architecture. |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 } | 291 } |
| 309 | 292 |
| 310 | 293 |
| 311 void OS::Exit(int code) { | 294 void OS::Exit(int code) { |
| 312 UNIMPLEMENTED(); | 295 UNIMPLEMENTED(); |
| 313 } | 296 } |
| 314 | 297 |
| 315 } // namespace dart | 298 } // namespace dart |
| 316 | 299 |
| 317 #endif // defined(TARGET_OS_FUCHSIA) | 300 #endif // defined(TARGET_OS_FUCHSIA) |
| OLD | NEW |