OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 return getpagesize(); | 212 return getpagesize(); |
213 } | 213 } |
214 | 214 |
215 | 215 |
216 void OS::Sleep(int milliseconds) { | 216 void OS::Sleep(int milliseconds) { |
217 useconds_t ms = static_cast<useconds_t>(milliseconds); | 217 useconds_t ms = static_cast<useconds_t>(milliseconds); |
218 usleep(1000 * ms); | 218 usleep(1000 * ms); |
219 } | 219 } |
220 | 220 |
221 | 221 |
222 int OS::NumberOfCores() { | |
223 return sysconf(_SC_NPROCESSORS_ONLN); | |
224 } | |
225 | |
226 | |
227 void OS::Abort() { | 222 void OS::Abort() { |
228 // Redirect to std abort to signal abnormal program termination. | 223 // Redirect to std abort to signal abnormal program termination. |
229 if (FLAG_break_on_abort) { | 224 if (FLAG_break_on_abort) { |
230 DebugBreak(); | 225 DebugBreak(); |
231 } | 226 } |
232 abort(); | 227 abort(); |
233 } | 228 } |
234 | 229 |
235 | 230 |
236 void OS::DebugBreak() { | 231 void OS::DebugBreak() { |
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
990 return ntohl(value); | 985 return ntohl(value); |
991 } | 986 } |
992 | 987 |
993 | 988 |
994 Socket* OS::CreateSocket() { | 989 Socket* OS::CreateSocket() { |
995 return new POSIXSocket(); | 990 return new POSIXSocket(); |
996 } | 991 } |
997 | 992 |
998 | 993 |
999 } } // namespace v8::internal | 994 } } // namespace v8::internal |
OLD | NEW |