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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 // limit. | 63 // limit. |
64 | 64 |
65 intptr_t OS::MaxVirtualMemory() { | 65 intptr_t OS::MaxVirtualMemory() { |
66 struct rlimit limit; | 66 struct rlimit limit; |
67 int result = getrlimit(RLIMIT_DATA, &limit); | 67 int result = getrlimit(RLIMIT_DATA, &limit); |
68 if (result != 0) return 0; | 68 if (result != 0) return 0; |
69 return limit.rlim_cur; | 69 return limit.rlim_cur; |
70 } | 70 } |
71 | 71 |
72 | 72 |
| 73 #ifndef __CYGWIN__ |
| 74 // Get rid of writable permission on code allocations. |
| 75 void OS::ProtectCode(void* address, const size_t size) { |
| 76 mprotect(address, size, PROT_READ | PROT_EXEC); |
| 77 } |
| 78 |
| 79 |
73 // Create guard pages. | 80 // Create guard pages. |
74 void OS::Guard(void* address, const size_t size) { | 81 void OS::Guard(void* address, const size_t size) { |
75 mprotect(address, size, PROT_NONE); | 82 mprotect(address, size, PROT_NONE); |
76 } | 83 } |
| 84 #endif // __CYGWIN__ |
77 | 85 |
78 | 86 |
79 // ---------------------------------------------------------------------------- | 87 // ---------------------------------------------------------------------------- |
80 // Math functions | 88 // Math functions |
81 | 89 |
82 double modulo(double x, double y) { | 90 double modulo(double x, double y) { |
83 return fmod(x, y); | 91 return fmod(x, y); |
84 } | 92 } |
85 | 93 |
86 | 94 |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 return ntohl(value); | 457 return ntohl(value); |
450 } | 458 } |
451 | 459 |
452 | 460 |
453 Socket* OS::CreateSocket() { | 461 Socket* OS::CreateSocket() { |
454 return new POSIXSocket(); | 462 return new POSIXSocket(); |
455 } | 463 } |
456 | 464 |
457 | 465 |
458 } } // namespace v8::internal | 466 } } // namespace v8::internal |
OLD | NEW |