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_WINDOWS) | 6 #if defined(TARGET_OS_WINDOWS) |
7 | 7 |
8 #include "vm/os.h" | 8 #include "vm/os.h" |
9 | 9 |
10 #include <malloc.h> // NOLINT | 10 #include <malloc.h> // NOLINT |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 return result; | 183 return result; |
184 } | 184 } |
185 | 185 |
186 | 186 |
187 int64_t OS::GetCurrentThreadCPUMicros() { | 187 int64_t OS::GetCurrentThreadCPUMicros() { |
188 // TODO(johnmccutchan): Implement. See base/time_win.cc for details. | 188 // TODO(johnmccutchan): Implement. See base/time_win.cc for details. |
189 return -1; | 189 return -1; |
190 } | 190 } |
191 | 191 |
192 | 192 |
193 void* OS::AlignedAllocate(intptr_t size, intptr_t alignment) { | |
194 const int kMinimumAlignment = 16; | |
195 ASSERT(Utils::IsPowerOfTwo(alignment)); | |
196 ASSERT(alignment >= kMinimumAlignment); | |
197 void* p = _aligned_malloc(size, alignment); | |
198 if (p == NULL) { | |
199 UNREACHABLE(); | |
200 } | |
201 return p; | |
202 } | |
203 | |
204 | |
205 void OS::AlignedFree(void* ptr) { | |
206 _aligned_free(ptr); | |
207 } | |
208 | |
209 | |
210 intptr_t OS::ActivationFrameAlignment() { | 193 intptr_t OS::ActivationFrameAlignment() { |
211 #ifdef _WIN64 | 194 #ifdef _WIN64 |
212 // Windows 64-bit ABI requires the stack to be 16-byte aligned. | 195 // Windows 64-bit ABI requires the stack to be 16-byte aligned. |
213 return 16; | 196 return 16; |
214 #else | 197 #else |
215 // No requirements on Win32. | 198 // No requirements on Win32. |
216 return 1; | 199 return 1; |
217 #endif | 200 #endif |
218 } | 201 } |
219 | 202 |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 // TODO(zra): Remove once VM shuts down cleanly. | 438 // TODO(zra): Remove once VM shuts down cleanly. |
456 private_flag_windows_run_tls_destructors = false; | 439 private_flag_windows_run_tls_destructors = false; |
457 // On Windows we use ExitProcess so that threads can't clobber the exit_code. | 440 // On Windows we use ExitProcess so that threads can't clobber the exit_code. |
458 // See: https://code.google.com/p/nativeclient/issues/detail?id=2870 | 441 // See: https://code.google.com/p/nativeclient/issues/detail?id=2870 |
459 ::ExitProcess(code); | 442 ::ExitProcess(code); |
460 } | 443 } |
461 | 444 |
462 } // namespace dart | 445 } // namespace dart |
463 | 446 |
464 #endif // defined(TARGET_OS_WINDOWS) | 447 #endif // defined(TARGET_OS_WINDOWS) |
OLD | NEW |