| 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 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 CHECK(result == -1 && errno == EINTR); // Signal caused spurious wakeup. | 565 CHECK(result == -1 && errno == EINTR); // Signal caused spurious wakeup. |
| 583 } | 566 } |
| 584 } | 567 } |
| 585 | 568 |
| 586 | 569 |
| 587 Semaphore* OS::CreateSemaphore(int count) { | 570 Semaphore* OS::CreateSemaphore(int count) { |
| 588 return new SolarisSemaphore(count); | 571 return new SolarisSemaphore(count); |
| 589 } | 572 } |
| 590 | 573 |
| 591 | 574 |
| 592 #ifdef ENABLE_LOGGING_AND_PROFILING | |
| 593 | |
| 594 static pthread_t GetThreadID() { | 575 static pthread_t GetThreadID() { |
| 595 return pthread_self(); | 576 return pthread_self(); |
| 596 } | 577 } |
| 597 | 578 |
| 598 static void ProfilerSignalHandler(int signal, siginfo_t* info, void* context) { | 579 static void ProfilerSignalHandler(int signal, siginfo_t* info, void* context) { |
| 599 USE(info); | 580 USE(info); |
| 600 if (signal != SIGPROF) return; | 581 if (signal != SIGPROF) return; |
| 601 Isolate* isolate = Isolate::UncheckedCurrent(); | 582 Isolate* isolate = Isolate::UncheckedCurrent(); |
| 602 if (isolate == NULL || !isolate->IsInitialized() || !isolate->IsInUse()) { | 583 if (isolate == NULL || !isolate->IsInitialized() || !isolate->IsInUse()) { |
| 603 // We require a fully initialized and entered isolate. | 584 // We require a fully initialized and entered isolate. |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 810 SignalSender::AddActiveSampler(this); | 791 SignalSender::AddActiveSampler(this); |
| 811 } | 792 } |
| 812 | 793 |
| 813 | 794 |
| 814 void Sampler::Stop() { | 795 void Sampler::Stop() { |
| 815 ASSERT(IsActive()); | 796 ASSERT(IsActive()); |
| 816 SignalSender::RemoveActiveSampler(this); | 797 SignalSender::RemoveActiveSampler(this); |
| 817 SetActive(false); | 798 SetActive(false); |
| 818 } | 799 } |
| 819 | 800 |
| 820 #endif // ENABLE_LOGGING_AND_PROFILING | |
| 821 | |
| 822 } } // namespace v8::internal | 801 } } // namespace v8::internal |
| OLD | NEW |