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 UNIMPLEMENTED(); | |
Ivan Posva
2013/01/24 18:25:57
http://msdn.microsoft.com/en-us/library/windows/de
regis
2013/01/24 21:47:48
I had already checked this one:
http://msdn.micros
| |
163 } | |
164 | |
165 | |
161 void OS::Print(const char* format, ...) { | 166 void OS::Print(const char* format, ...) { |
162 va_list args; | 167 va_list args; |
163 va_start(args, format); | 168 va_start(args, format); |
164 VFPrint(stdout, format, args); | 169 VFPrint(stdout, format, args); |
165 va_end(args); | 170 va_end(args); |
166 } | 171 } |
167 | 172 |
168 | 173 |
169 void OS::VFPrint(FILE* stream, const char* format, va_list args) { | 174 void OS::VFPrint(FILE* stream, const char* format, va_list args) { |
170 vfprintf(stream, format, args); | 175 vfprintf(stream, format, args); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
241 | 246 |
242 | 247 |
243 void OS::PrintErr(const char* format, ...) { | 248 void OS::PrintErr(const char* format, ...) { |
244 va_list args; | 249 va_list args; |
245 va_start(args, format); | 250 va_start(args, format); |
246 VFPrint(stderr, format, args); | 251 VFPrint(stderr, format, args); |
247 va_end(args); | 252 va_end(args); |
248 } | 253 } |
249 | 254 |
250 | 255 |
256 // Cache the null page size. | |
257 uword OS::null_page_size_ = 0; | |
258 | |
259 | |
251 void OS::InitOnce() { | 260 void OS::InitOnce() { |
252 // TODO(5411554): For now we check that initonce is called only once, | 261 // TODO(5411554): For now we check that initonce is called only once, |
253 // Once there is more formal mechanism to call InitOnce we can move | 262 // Once there is more formal mechanism to call InitOnce we can move |
254 // this check there. | 263 // this check there. |
255 static bool init_once_called = false; | 264 static bool init_once_called = false; |
256 ASSERT(init_once_called == false); | 265 ASSERT(init_once_called == false); |
257 init_once_called = true; | 266 init_once_called = true; |
258 // Do not pop up a message box when abort is called. | 267 // Do not pop up a message box when abort is called. |
259 _set_abort_behavior(0, _WRITE_ABORT_MSG); | 268 _set_abort_behavior(0, _WRITE_ABORT_MSG); |
269 | |
270 // Initialize the null page size. | |
271 null_page_size_ = 4096; // TODO(regis): Retrieve the actual value. | |
260 } | 272 } |
261 | 273 |
262 | 274 |
263 void OS::Shutdown() { | 275 void OS::Shutdown() { |
264 } | 276 } |
265 | 277 |
266 | 278 |
267 void OS::Abort() { | 279 void OS::Abort() { |
268 abort(); | 280 abort(); |
269 } | 281 } |
270 | 282 |
271 | 283 |
272 void OS::Exit(int code) { | 284 void OS::Exit(int code) { |
273 exit(code); | 285 exit(code); |
274 } | 286 } |
275 | 287 |
276 } // namespace dart | 288 } // namespace dart |
OLD | NEW |