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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 | 153 |
154 // Convert to microseconds. | 154 // Convert to microseconds. |
155 int64_t seconds = ticks / frequency; | 155 int64_t seconds = ticks / frequency; |
156 int64_t leftover_ticks = ticks - (seconds * frequency); | 156 int64_t leftover_ticks = ticks - (seconds * frequency); |
157 int64_t result = seconds * kMicrosecondsPerSecond; | 157 int64_t result = seconds * kMicrosecondsPerSecond; |
158 result += ((leftover_ticks * kMicrosecondsPerSecond) / frequency); | 158 result += ((leftover_ticks * kMicrosecondsPerSecond) / frequency); |
159 return result; | 159 return result; |
160 } | 160 } |
161 | 161 |
162 | 162 |
| 163 int64_t OS::GetCurrentThreadCPUMicros() { |
| 164 // TODO(johnmccutchan): Implement. See base/time_win.cc for details. |
| 165 return -1; |
| 166 } |
| 167 |
| 168 |
163 void* OS::AlignedAllocate(intptr_t size, intptr_t alignment) { | 169 void* OS::AlignedAllocate(intptr_t size, intptr_t alignment) { |
164 const int kMinimumAlignment = 16; | 170 const int kMinimumAlignment = 16; |
165 ASSERT(Utils::IsPowerOfTwo(alignment)); | 171 ASSERT(Utils::IsPowerOfTwo(alignment)); |
166 ASSERT(alignment >= kMinimumAlignment); | 172 ASSERT(alignment >= kMinimumAlignment); |
167 void* p = _aligned_malloc(size, alignment); | 173 void* p = _aligned_malloc(size, alignment); |
168 if (p == NULL) { | 174 if (p == NULL) { |
169 UNREACHABLE(); | 175 UNREACHABLE(); |
170 } | 176 } |
171 return p; | 177 return p; |
172 } | 178 } |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 // TODO(zra): Remove once VM shuts down cleanly. | 419 // TODO(zra): Remove once VM shuts down cleanly. |
414 private_flag_windows_run_tls_destructors = false; | 420 private_flag_windows_run_tls_destructors = false; |
415 // On Windows we use ExitProcess so that threads can't clobber the exit_code. | 421 // On Windows we use ExitProcess so that threads can't clobber the exit_code. |
416 // See: https://code.google.com/p/nativeclient/issues/detail?id=2870 | 422 // See: https://code.google.com/p/nativeclient/issues/detail?id=2870 |
417 ::ExitProcess(code); | 423 ::ExitProcess(code); |
418 } | 424 } |
419 | 425 |
420 } // namespace dart | 426 } // namespace dart |
421 | 427 |
422 #endif // defined(TARGET_OS_WINDOWS) | 428 #endif // defined(TARGET_OS_WINDOWS) |
OLD | NEW |