OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 10 matching lines...) Expand all Loading... |
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 // Platform specific code for MacOS goes here. For the POSIX comaptible parts | 28 // Platform specific code for MacOS goes here. For the POSIX comaptible parts |
29 // the implementation is in platform-posix.cc. | 29 // the implementation is in platform-posix.cc. |
30 | 30 |
31 #include <ucontext.h> | |
32 #include <unistd.h> | 31 #include <unistd.h> |
33 #include <sys/mman.h> | 32 #include <sys/mman.h> |
34 #include <mach/mach_init.h> | 33 #include <mach/mach_init.h> |
35 #include <mach-o/dyld.h> | 34 #include <mach-o/dyld.h> |
36 #include <mach-o/getsect.h> | 35 #include <mach-o/getsect.h> |
37 | 36 |
38 #include <AvailabilityMacros.h> | 37 #include <AvailabilityMacros.h> |
39 | 38 |
40 #include <pthread.h> | 39 #include <pthread.h> |
41 #include <semaphore.h> | 40 #include <semaphore.h> |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 } | 199 } |
201 | 200 |
202 | 201 |
203 PosixMemoryMappedFile::~PosixMemoryMappedFile() { | 202 PosixMemoryMappedFile::~PosixMemoryMappedFile() { |
204 if (memory_) munmap(memory_, size_); | 203 if (memory_) munmap(memory_, size_); |
205 fclose(file_); | 204 fclose(file_); |
206 } | 205 } |
207 | 206 |
208 | 207 |
209 void OS::LogSharedLibraryAddresses() { | 208 void OS::LogSharedLibraryAddresses() { |
| 209 #ifdef ENABLE_LOGGING_AND_PROFILING |
210 unsigned int images_count = _dyld_image_count(); | 210 unsigned int images_count = _dyld_image_count(); |
211 for (unsigned int i = 0; i < images_count; ++i) { | 211 for (unsigned int i = 0; i < images_count; ++i) { |
212 const mach_header* header = _dyld_get_image_header(i); | 212 const mach_header* header = _dyld_get_image_header(i); |
213 if (header == NULL) continue; | 213 if (header == NULL) continue; |
214 unsigned int size; | 214 unsigned int size; |
215 char* code_ptr = getsectdatafromheader(header, SEG_TEXT, SECT_TEXT, &size); | 215 char* code_ptr = getsectdatafromheader(header, SEG_TEXT, SECT_TEXT, &size); |
216 if (code_ptr == NULL) continue; | 216 if (code_ptr == NULL) continue; |
217 const uintptr_t slide = _dyld_get_image_vmaddr_slide(i); | 217 const uintptr_t slide = _dyld_get_image_vmaddr_slide(i); |
218 const uintptr_t start = reinterpret_cast<uintptr_t>(code_ptr) + slide; | 218 const uintptr_t start = reinterpret_cast<uintptr_t>(code_ptr) + slide; |
219 LOG(SharedLibraryEvent(_dyld_get_image_name(i), start, start + size)); | 219 LOG(SharedLibraryEvent(_dyld_get_image_name(i), start, start + size)); |
220 } | 220 } |
| 221 #endif // ENABLE_LOGGING_AND_PROFILING |
221 } | 222 } |
222 | 223 |
223 | 224 |
224 double OS::nan_value() { | 225 double OS::nan_value() { |
225 return NAN; | 226 return NAN; |
226 } | 227 } |
227 | 228 |
228 | 229 |
229 int OS::ActivationFrameAlignment() { | 230 int OS::ActivationFrameAlignment() { |
230 // OS X activation frames must be 16 byte-aligned; see "Mac OS X ABI | 231 // OS X activation frames must be 16 byte-aligned; see "Mac OS X ABI |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
617 | 618 |
618 // Deallocate Mach port for thread. | 619 // Deallocate Mach port for thread. |
619 if (IsProfiling()) { | 620 if (IsProfiling()) { |
620 mach_port_deallocate(data_->task_self_, data_->profiled_thread_); | 621 mach_port_deallocate(data_->task_self_, data_->profiled_thread_); |
621 } | 622 } |
622 } | 623 } |
623 | 624 |
624 #endif // ENABLE_LOGGING_AND_PROFILING | 625 #endif // ENABLE_LOGGING_AND_PROFILING |
625 | 626 |
626 } } // namespace v8::internal | 627 } } // namespace v8::internal |
OLD | NEW |