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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 | 185 |
186 | 186 |
187 void OS::Free(void* address, const size_t size) { | 187 void OS::Free(void* address, const size_t size) { |
188 // TODO(1240712): munmap has a return value which is ignored here. | 188 // TODO(1240712): munmap has a return value which is ignored here. |
189 int result = munmap(address, size); | 189 int result = munmap(address, size); |
190 USE(result); | 190 USE(result); |
191 ASSERT(result == 0); | 191 ASSERT(result == 0); |
192 } | 192 } |
193 | 193 |
194 | 194 |
195 #ifdef ENABLE_HEAP_PROTECTION | |
196 | |
197 void OS::Protect(void* address, size_t size) { | |
198 // TODO(1240712): mprotect has a return value which is ignored here. | |
199 mprotect(address, size, PROT_READ); | |
200 } | |
201 | |
202 | |
203 void OS::Unprotect(void* address, size_t size, bool is_executable) { | |
204 // TODO(1240712): mprotect has a return value which is ignored here. | |
205 int prot = PROT_READ | PROT_WRITE | (is_executable ? PROT_EXEC : 0); | |
206 mprotect(address, size, prot); | |
207 } | |
208 | |
209 #endif | |
210 | |
211 | |
212 void OS::Sleep(int milliseconds) { | 195 void OS::Sleep(int milliseconds) { |
213 useconds_t ms = static_cast<useconds_t>(milliseconds); | 196 useconds_t ms = static_cast<useconds_t>(milliseconds); |
214 usleep(1000 * ms); | 197 usleep(1000 * ms); |
215 } | 198 } |
216 | 199 |
217 | 200 |
218 void OS::Abort() { | 201 void OS::Abort() { |
219 // Redirect to std abort to signal abnormal program termination. | 202 // Redirect to std abort to signal abnormal program termination. |
220 abort(); | 203 abort(); |
221 } | 204 } |
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 | 796 |
814 void Sampler::Stop() { | 797 void Sampler::Stop() { |
815 ASSERT(IsActive()); | 798 ASSERT(IsActive()); |
816 SignalSender::RemoveActiveSampler(this); | 799 SignalSender::RemoveActiveSampler(this); |
817 SetActive(false); | 800 SetActive(false); |
818 } | 801 } |
819 | 802 |
820 #endif // ENABLE_LOGGING_AND_PROFILING | 803 #endif // ENABLE_LOGGING_AND_PROFILING |
821 | 804 |
822 } } // namespace v8::internal | 805 } } // namespace v8::internal |
OLD | NEW |