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 14 matching lines...) Expand all Loading... | |
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> | 31 #include <ucontext.h> |
32 #include <unistd.h> | 32 #include <unistd.h> |
33 #include <sys/mman.h> | 33 #include <sys/mman.h> |
34 #include <mach/mach_init.h> | 34 #include <mach/mach_init.h> |
35 #include <mach-o/dyld.h> | |
36 #include <mach-o/getsect.h> | |
35 | 37 |
36 #include <AvailabilityMacros.h> | 38 #include <AvailabilityMacros.h> |
37 | 39 |
38 #include <pthread.h> | 40 #include <pthread.h> |
39 #include <semaphore.h> | 41 #include <semaphore.h> |
40 #include <signal.h> | 42 #include <signal.h> |
41 #include <mach/mach.h> | 43 #include <mach/mach.h> |
42 #include <mach/semaphore.h> | 44 #include <mach/semaphore.h> |
43 #include <mach/task.h> | 45 #include <mach/task.h> |
44 #include <sys/time.h> | 46 #include <sys/time.h> |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
198 } | 200 } |
199 | 201 |
200 | 202 |
201 PosixMemoryMappedFile::~PosixMemoryMappedFile() { | 203 PosixMemoryMappedFile::~PosixMemoryMappedFile() { |
202 if (memory_) munmap(memory_, size_); | 204 if (memory_) munmap(memory_, size_); |
203 fclose(file_); | 205 fclose(file_); |
204 } | 206 } |
205 | 207 |
206 | 208 |
207 void OS::LogSharedLibraryAddresses() { | 209 void OS::LogSharedLibraryAddresses() { |
208 // TODO(1233579): Implement. | 210 unsigned int images_count = _dyld_image_count(); |
211 for (unsigned int i = 0; i < images_count; ++i) { | |
212 const mach_header *header = _dyld_get_image_header(i); | |
iposva
2009/07/13 20:18:21
The correct style is "mach_header* header".
Mikhail Naganov
2009/07/14 05:00:42
Done.
| |
213 if (header == NULL) continue; | |
214 unsigned int size; | |
215 char *code_ptr; | |
iposva
2009/07/13 20:18:21
The correct style is "char* code_ptr".
I also ass
Mikhail Naganov
2009/07/14 05:00:42
No, it's just a lack of attention. Fixed, thanks!
| |
216 code_ptr = getsectdatafromheader(header, SEG_TEXT, SECT_TEXT, &size); | |
217 if (code_ptr == NULL) continue; | |
218 const uintptr_t slide = _dyld_get_image_vmaddr_slide(i); | |
219 const uintptr_t start = reinterpret_cast<uintptr_t>(code_ptr) + slide; | |
220 LOG(SharedLibraryEvent(_dyld_get_image_name(i), start, start + size)); | |
221 } | |
209 } | 222 } |
210 | 223 |
211 | 224 |
212 double OS::nan_value() { | 225 double OS::nan_value() { |
213 return NAN; | 226 return NAN; |
214 } | 227 } |
215 | 228 |
216 | 229 |
217 int OS::ActivationFrameAlignment() { | 230 int OS::ActivationFrameAlignment() { |
218 // 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... | |
605 | 618 |
606 // Deallocate Mach port for thread. | 619 // Deallocate Mach port for thread. |
607 if (IsProfiling()) { | 620 if (IsProfiling()) { |
608 mach_port_deallocate(data_->task_self_, data_->profiled_thread_); | 621 mach_port_deallocate(data_->task_self_, data_->profiled_thread_); |
609 } | 622 } |
610 } | 623 } |
611 | 624 |
612 #endif // ENABLE_LOGGING_AND_PROFILING | 625 #endif // ENABLE_LOGGING_AND_PROFILING |
613 | 626 |
614 } } // namespace v8::internal | 627 } } // namespace v8::internal |
OLD | NEW |