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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
202 PosixMemoryMappedFile::~PosixMemoryMappedFile() { | 202 PosixMemoryMappedFile::~PosixMemoryMappedFile() { |
203 if (memory_) munmap(memory_, size_); | 203 if (memory_) munmap(memory_, size_); |
204 fclose(file_); | 204 fclose(file_); |
205 } | 205 } |
206 | 206 |
207 | 207 |
208 void OS::LogSharedLibraryAddresses() { | 208 void OS::LogSharedLibraryAddresses() { |
209 #ifdef ENABLE_LOGGING_AND_PROFILING | 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); |
William Hesse
2009/09/02 10:44:39
Could you move this variable into the #ifdef inste
| |
213 if (header == NULL) continue; | 213 if (header == NULL) continue; |
214 #if V8_HOST_ARCH_X64 | 214 #if V8_HOST_ARCH_X64 |
215 uint64_t size; | 215 uint64_t size; |
216 char* code_ptr = getsectdatafromheader_64( | 216 char* code_ptr = getsectdatafromheader_64( |
217 (mach_header_64*)header, SEG_TEXT, SECT_TEXT, &size); | 217 reinterpret_cast<const mach_header_64*>(header), |
218 SEG_TEXT, | |
219 SECT_TEXT, | |
220 &size); | |
218 #else | 221 #else |
219 unsigned int size; | 222 unsigned int size; |
220 char* code_ptr = getsectdatafromheader(header, SEG_TEXT, SECT_TEXT, &size); | 223 char* code_ptr = getsectdatafromheader(header, SEG_TEXT, SECT_TEXT, &size); |
221 #endif | 224 #endif |
222 if (code_ptr == NULL) continue; | 225 if (code_ptr == NULL) continue; |
223 const uintptr_t slide = _dyld_get_image_vmaddr_slide(i); | 226 const uintptr_t slide = _dyld_get_image_vmaddr_slide(i); |
224 const uintptr_t start = reinterpret_cast<uintptr_t>(code_ptr) + slide; | 227 const uintptr_t start = reinterpret_cast<uintptr_t>(code_ptr) + slide; |
225 LOG(SharedLibraryEvent(_dyld_get_image_name(i), start, start + size)); | 228 LOG(SharedLibraryEvent(_dyld_get_image_name(i), start, start + size)); |
226 } | 229 } |
227 #endif // ENABLE_LOGGING_AND_PROFILING | 230 #endif // ENABLE_LOGGING_AND_PROFILING |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
618 | 621 |
619 // Deallocate Mach port for thread. | 622 // Deallocate Mach port for thread. |
620 if (IsProfiling()) { | 623 if (IsProfiling()) { |
621 mach_port_deallocate(data_->task_self_, data_->profiled_thread_); | 624 mach_port_deallocate(data_->task_self_, data_->profiled_thread_); |
622 } | 625 } |
623 } | 626 } |
624 | 627 |
625 #endif // ENABLE_LOGGING_AND_PROFILING | 628 #endif // ENABLE_LOGGING_AND_PROFILING |
626 | 629 |
627 } } // namespace v8::internal | 630 } } // namespace v8::internal |
OLD | NEW |