OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 namespace v8 { | 54 namespace v8 { |
55 namespace internal { | 55 namespace internal { |
56 | 56 |
57 // ---------------------------------------------------------------------------- | 57 // ---------------------------------------------------------------------------- |
58 // Math functions | 58 // Math functions |
59 | 59 |
60 double modulo(double x, double y) { | 60 double modulo(double x, double y) { |
61 return fmod(x, y); | 61 return fmod(x, y); |
62 } | 62 } |
63 | 63 |
| 64 |
| 65 double OS::nan_value() { |
| 66 // NAN from math.h is defined in C99 and not in POSIX. |
| 67 return NAN; |
| 68 } |
| 69 |
| 70 |
64 // ---------------------------------------------------------------------------- | 71 // ---------------------------------------------------------------------------- |
65 // POSIX date/time support. | 72 // POSIX date/time support. |
66 // | 73 // |
67 | 74 |
68 int OS::GetUserTime(uint32_t* secs, uint32_t* usecs) { | 75 int OS::GetUserTime(uint32_t* secs, uint32_t* usecs) { |
69 struct rusage usage; | 76 struct rusage usage; |
70 | 77 |
71 if (getrusage(RUSAGE_SELF, &usage) < 0) return -1; | 78 if (getrusage(RUSAGE_SELF, &usage) < 0) return -1; |
72 *secs = usage.ru_utime.tv_sec; | 79 *secs = usage.ru_utime.tv_sec; |
73 *usecs = usage.ru_utime.tv_usec; | 80 *usecs = usage.ru_utime.tv_usec; |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 return ntohl(value); | 371 return ntohl(value); |
365 } | 372 } |
366 | 373 |
367 | 374 |
368 Socket* OS::CreateSocket() { | 375 Socket* OS::CreateSocket() { |
369 return new POSIXSocket(); | 376 return new POSIXSocket(); |
370 } | 377 } |
371 | 378 |
372 | 379 |
373 } } // namespace v8::internal | 380 } } // namespace v8::internal |
OLD | NEW |