| OLD | NEW |
| 1 // Copyright 2006-2011 the V8 project authors. All rights reserved. | 1 // Copyright 2006-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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 mprotect(address, size, PROT_READ); | 173 mprotect(address, size, PROT_READ); |
| 174 } | 174 } |
| 175 | 175 |
| 176 | 176 |
| 177 void OS::Unprotect(void* address, size_t size, bool is_executable) { | 177 void OS::Unprotect(void* address, size_t size, bool is_executable) { |
| 178 // TODO(1240712): mprotect has a return value which is ignored here. | 178 // TODO(1240712): mprotect has a return value which is ignored here. |
| 179 int prot = PROT_READ | PROT_WRITE | (is_executable ? PROT_EXEC : 0); | 179 int prot = PROT_READ | PROT_WRITE | (is_executable ? PROT_EXEC : 0); |
| 180 mprotect(address, size, prot); | 180 mprotect(address, size, prot); |
| 181 } | 181 } |
| 182 | 182 |
| 183 #endif | 183 void OS::Guard(void* address, const size_t size) { |
| 184 mprotect(address, size, PROT_NONE); |
| 185 } |
| 186 |
| 187 #endif // ENABLE_HEAP_PROTECTION |
| 184 | 188 |
| 185 | 189 |
| 186 void OS::Sleep(int milliseconds) { | 190 void OS::Sleep(int milliseconds) { |
| 187 unsigned int ms = static_cast<unsigned int>(milliseconds); | 191 unsigned int ms = static_cast<unsigned int>(milliseconds); |
| 188 usleep(1000 * ms); | 192 usleep(1000 * ms); |
| 189 } | 193 } |
| 190 | 194 |
| 191 | 195 |
| 192 void OS::Abort() { | 196 void OS::Abort() { |
| 193 // Redirect to std abort to signal abnormal program termination. | 197 // Redirect to std abort to signal abnormal program termination. |
| (...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 766 void Sampler::Stop() { | 770 void Sampler::Stop() { |
| 767 ASSERT(IsActive()); | 771 ASSERT(IsActive()); |
| 768 SamplerThread::RemoveActiveSampler(this); | 772 SamplerThread::RemoveActiveSampler(this); |
| 769 SetActive(false); | 773 SetActive(false); |
| 770 } | 774 } |
| 771 | 775 |
| 772 #endif // ENABLE_LOGGING_AND_PROFILING | 776 #endif // ENABLE_LOGGING_AND_PROFILING |
| 773 | 777 |
| 774 } } // namespace v8::internal | 778 } } // namespace v8::internal |
| 775 | 779 |
| OLD | NEW |