| 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/os.h" | 5 #include "vm/os.h" |
| 6 | 6 |
| 7 #include <malloc.h> | 7 #include <malloc.h> |
| 8 #include <time.h> | 8 #include <time.h> |
| 9 | 9 |
| 10 #include "platform/utils.h" | 10 #include "platform/utils.h" |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 GetSystemInfo(&info); | 151 GetSystemInfo(&info); |
| 152 return info.dwNumberOfProcessors; | 152 return info.dwNumberOfProcessors; |
| 153 } | 153 } |
| 154 | 154 |
| 155 | 155 |
| 156 void OS::Sleep(int64_t millis) { | 156 void OS::Sleep(int64_t millis) { |
| 157 ::Sleep(millis); | 157 ::Sleep(millis); |
| 158 } | 158 } |
| 159 | 159 |
| 160 | 160 |
| 161 void OS::DebugBreak() { |
| 162 #if defined(_MSC_VER) |
| 163 // Microsoft Visual C/C++ or drop-in replacement. |
| 164 __debugbreak(); |
| 165 #elif defined(__GCC__) |
| 166 // MinGW? |
| 167 asm("int $3"); |
| 168 #else |
| 169 // Microsoft style assembly. |
| 170 __asm { |
| 171 int 3 |
| 172 } |
| 173 #endif |
| 174 } |
| 175 |
| 176 |
| 161 void OS::Print(const char* format, ...) { | 177 void OS::Print(const char* format, ...) { |
| 162 va_list args; | 178 va_list args; |
| 163 va_start(args, format); | 179 va_start(args, format); |
| 164 VFPrint(stdout, format, args); | 180 VFPrint(stdout, format, args); |
| 165 va_end(args); | 181 va_end(args); |
| 166 } | 182 } |
| 167 | 183 |
| 168 | 184 |
| 169 void OS::VFPrint(FILE* stream, const char* format, va_list args) { | 185 void OS::VFPrint(FILE* stream, const char* format, va_list args) { |
| 170 vfprintf(stream, format, args); | 186 vfprintf(stream, format, args); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 void OS::Abort() { | 283 void OS::Abort() { |
| 268 abort(); | 284 abort(); |
| 269 } | 285 } |
| 270 | 286 |
| 271 | 287 |
| 272 void OS::Exit(int code) { | 288 void OS::Exit(int code) { |
| 273 exit(code); | 289 exit(code); |
| 274 } | 290 } |
| 275 | 291 |
| 276 } // namespace dart | 292 } // namespace dart |
| OLD | NEW |