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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 77 |
78 intptr_t OS::CommitPageSize() { | 78 intptr_t OS::CommitPageSize() { |
79 static intptr_t page_size = getpagesize(); | 79 static intptr_t page_size = getpagesize(); |
80 return page_size; | 80 return page_size; |
81 } | 81 } |
82 | 82 |
83 | 83 |
84 #ifndef __CYGWIN__ | 84 #ifndef __CYGWIN__ |
85 // Get rid of writable permission on code allocations. | 85 // Get rid of writable permission on code allocations. |
86 void OS::ProtectCode(void* address, const size_t size) { | 86 void OS::ProtectCode(void* address, const size_t size) { |
| 87 #if defined(__native_client__) |
| 88 // The Native Client port of V8 uses an interpreter, so |
| 89 // code pages don't need PROT_EXEC. |
| 90 mprotect(address, size, PROT_READ); |
| 91 #else |
87 mprotect(address, size, PROT_READ | PROT_EXEC); | 92 mprotect(address, size, PROT_READ | PROT_EXEC); |
| 93 #endif |
88 } | 94 } |
89 | 95 |
90 | 96 |
91 // Create guard pages. | 97 // Create guard pages. |
92 void OS::Guard(void* address, const size_t size) { | 98 void OS::Guard(void* address, const size_t size) { |
93 mprotect(address, size, PROT_NONE); | 99 mprotect(address, size, PROT_NONE); |
94 } | 100 } |
95 #endif // __CYGWIN__ | 101 #endif // __CYGWIN__ |
96 | 102 |
97 | 103 |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 return ntohl(value); | 649 return ntohl(value); |
644 } | 650 } |
645 | 651 |
646 | 652 |
647 Socket* OS::CreateSocket() { | 653 Socket* OS::CreateSocket() { |
648 return new POSIXSocket(); | 654 return new POSIXSocket(); |
649 } | 655 } |
650 | 656 |
651 | 657 |
652 } } // namespace v8::internal | 658 } } // namespace v8::internal |
OLD | NEW |