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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 | 159 |
160 | 160 |
161 void OS::Free(void* address, const size_t size) { | 161 void OS::Free(void* address, const size_t size) { |
162 // TODO(1240712): munmap has a return value which is ignored here. | 162 // TODO(1240712): munmap has a return value which is ignored here. |
163 int result = munmap(address, size); | 163 int result = munmap(address, size); |
164 USE(result); | 164 USE(result); |
165 ASSERT(result == 0); | 165 ASSERT(result == 0); |
166 } | 166 } |
167 | 167 |
168 | 168 |
| 169 void OS::ProtectCode(void* address, const size_t size) { |
| 170 DWORD old_protect; |
| 171 VirtualProtect(address, size, PAGE_EXECUTE_READ, &old_protect); |
| 172 } |
| 173 |
| 174 |
| 175 void OS::Guard(void* address, const size_t size) { |
| 176 DWORD oldprotect; |
| 177 VirtualProtect(address, size, PAGE_READONLY | PAGE_GUARD, &oldprotect); |
| 178 } |
| 179 |
| 180 |
169 void OS::Sleep(int milliseconds) { | 181 void OS::Sleep(int milliseconds) { |
170 unsigned int ms = static_cast<unsigned int>(milliseconds); | 182 unsigned int ms = static_cast<unsigned int>(milliseconds); |
171 usleep(1000 * ms); | 183 usleep(1000 * ms); |
172 } | 184 } |
173 | 185 |
174 | 186 |
175 void OS::Abort() { | 187 void OS::Abort() { |
176 // Redirect to std abort to signal abnormal program termination. | 188 // Redirect to std abort to signal abnormal program termination. |
177 abort(); | 189 abort(); |
178 } | 190 } |
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 | 755 |
744 | 756 |
745 void Sampler::Stop() { | 757 void Sampler::Stop() { |
746 ASSERT(IsActive()); | 758 ASSERT(IsActive()); |
747 SamplerThread::RemoveActiveSampler(this); | 759 SamplerThread::RemoveActiveSampler(this); |
748 SetActive(false); | 760 SetActive(false); |
749 } | 761 } |
750 | 762 |
751 | 763 |
752 } } // namespace v8::internal | 764 } } // namespace v8::internal |
OLD | NEW |