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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 free(ptr); | 184 free(ptr); |
185 } | 185 } |
186 | 186 |
187 | 187 |
188 // TODO(5411554): May need to hoist these architecture dependent code | 188 // TODO(5411554): May need to hoist these architecture dependent code |
189 // into a architecture specific file e.g: os_ia32_linux.cc | 189 // into a architecture specific file e.g: os_ia32_linux.cc |
190 intptr_t OS::ActivationFrameAlignment() { | 190 intptr_t OS::ActivationFrameAlignment() { |
191 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) || \ | 191 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) || \ |
192 defined(TARGET_ARCH_ARM64) | 192 defined(TARGET_ARCH_ARM64) |
193 const int kMinimumAlignment = 16; | 193 const int kMinimumAlignment = 16; |
194 #elif defined(TARGET_ARCH_ARM) | 194 #elif defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_DBC) |
195 const int kMinimumAlignment = 8; | 195 const int kMinimumAlignment = 8; |
196 #else | 196 #else |
197 #error Unsupported architecture. | 197 #error Unsupported architecture. |
198 #endif | 198 #endif |
199 intptr_t alignment = kMinimumAlignment; | 199 intptr_t alignment = kMinimumAlignment; |
200 // TODO(5411554): Allow overriding default stack alignment for | 200 // TODO(5411554): Allow overriding default stack alignment for |
201 // testing purposes. | 201 // testing purposes. |
202 // Flags::DebugIsInt("stackalign", &alignment); | 202 // Flags::DebugIsInt("stackalign", &alignment); |
203 ASSERT(Utils::IsPowerOfTwo(alignment)); | 203 ASSERT(Utils::IsPowerOfTwo(alignment)); |
204 ASSERT(alignment >= kMinimumAlignment); | 204 ASSERT(alignment >= kMinimumAlignment); |
205 return alignment; | 205 return alignment; |
206 } | 206 } |
207 | 207 |
208 | 208 |
209 intptr_t OS::PreferredCodeAlignment() { | 209 intptr_t OS::PreferredCodeAlignment() { |
210 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) || \ | 210 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) || \ |
211 defined(TARGET_ARCH_ARM64) | 211 defined(TARGET_ARCH_ARM64) |
212 const int kMinimumAlignment = 16; | 212 const int kMinimumAlignment = 16; |
213 #elif defined(TARGET_ARCH_ARM) | 213 #elif defined(TARGET_ARCH_ARM) |
214 const int kMinimumAlignment = 16; | 214 const int kMinimumAlignment = 16; |
| 215 #elif defined(TARGET_ARCH_DBC) |
| 216 const int kMinimumAlignment = 16; |
215 #else | 217 #else |
216 #error Unsupported architecture. | 218 #error Unsupported architecture. |
217 #endif | 219 #endif |
218 intptr_t alignment = kMinimumAlignment; | 220 intptr_t alignment = kMinimumAlignment; |
219 // TODO(5411554): Allow overriding default code alignment for | 221 // TODO(5411554): Allow overriding default code alignment for |
220 // testing purposes. | 222 // testing purposes. |
221 // Flags::DebugIsInt("codealign", &alignment); | 223 // Flags::DebugIsInt("codealign", &alignment); |
222 ASSERT(Utils::IsPowerOfTwo(alignment)); | 224 ASSERT(Utils::IsPowerOfTwo(alignment)); |
223 ASSERT(alignment >= kMinimumAlignment); | 225 ASSERT(alignment >= kMinimumAlignment); |
224 ASSERT(alignment <= OS::kMaxPreferredCodeAlignment); | 226 ASSERT(alignment <= OS::kMaxPreferredCodeAlignment); |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 } | 429 } |
428 | 430 |
429 | 431 |
430 void OS::Exit(int code) { | 432 void OS::Exit(int code) { |
431 exit(code); | 433 exit(code); |
432 } | 434 } |
433 | 435 |
434 } // namespace dart | 436 } // namespace dart |
435 | 437 |
436 #endif // defined(TARGET_OS_ANDROID) | 438 #endif // defined(TARGET_OS_ANDROID) |
OLD | NEW |