OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 #include <utils/Log.h> // LOG_PRI_VA | 47 #include <utils/Log.h> // LOG_PRI_VA |
48 #endif | 48 #endif |
49 | 49 |
50 #include "v8.h" | 50 #include "v8.h" |
51 | 51 |
52 #include "platform.h" | 52 #include "platform.h" |
53 | 53 |
54 namespace v8 { | 54 namespace v8 { |
55 namespace internal { | 55 namespace internal { |
56 | 56 |
| 57 |
| 58 // Maximum size of the virtual memory. 0 means there is no artificial |
| 59 // limit. |
| 60 |
| 61 intptr_t OS::MaxVirtualMemory() { |
| 62 struct rlimit limit; |
| 63 int result = getrlimit(RLIMIT_DATA, &limit); |
| 64 if (result != 0) return 0; |
| 65 return limit.rlim_cur; |
| 66 } |
| 67 |
| 68 |
57 // ---------------------------------------------------------------------------- | 69 // ---------------------------------------------------------------------------- |
58 // Math functions | 70 // Math functions |
59 | 71 |
60 double modulo(double x, double y) { | 72 double modulo(double x, double y) { |
61 return fmod(x, y); | 73 return fmod(x, y); |
62 } | 74 } |
63 | 75 |
64 | 76 |
65 double OS::nan_value() { | 77 double OS::nan_value() { |
66 // NAN from math.h is defined in C99 and not in POSIX. | 78 // NAN from math.h is defined in C99 and not in POSIX. |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 return ntohl(value); | 427 return ntohl(value); |
416 } | 428 } |
417 | 429 |
418 | 430 |
419 Socket* OS::CreateSocket() { | 431 Socket* OS::CreateSocket() { |
420 return new POSIXSocket(); | 432 return new POSIXSocket(); |
421 } | 433 } |
422 | 434 |
423 | 435 |
424 } } // namespace v8::internal | 436 } } // namespace v8::internal |
OLD | NEW |