OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 return new PosixMemoryMappedFile(file, memory, size); | 138 return new PosixMemoryMappedFile(file, memory, size); |
139 } | 139 } |
140 | 140 |
141 | 141 |
142 PosixMemoryMappedFile::~PosixMemoryMappedFile() { | 142 PosixMemoryMappedFile::~PosixMemoryMappedFile() { |
143 if (memory_) munmap(memory_, size_); | 143 if (memory_) munmap(memory_, size_); |
144 fclose(file_); | 144 fclose(file_); |
145 } | 145 } |
146 | 146 |
147 | 147 |
148 void OS::LogSharedLibraryAddresses() { | 148 void OS::LogSharedLibraryAddresses(Isolate* isolate) { |
149 unsigned int images_count = _dyld_image_count(); | 149 unsigned int images_count = _dyld_image_count(); |
150 for (unsigned int i = 0; i < images_count; ++i) { | 150 for (unsigned int i = 0; i < images_count; ++i) { |
151 const mach_header* header = _dyld_get_image_header(i); | 151 const mach_header* header = _dyld_get_image_header(i); |
152 if (header == NULL) continue; | 152 if (header == NULL) continue; |
153 #if V8_HOST_ARCH_X64 | 153 #if V8_HOST_ARCH_X64 |
154 uint64_t size; | 154 uint64_t size; |
155 char* code_ptr = getsectdatafromheader_64( | 155 char* code_ptr = getsectdatafromheader_64( |
156 reinterpret_cast<const mach_header_64*>(header), | 156 reinterpret_cast<const mach_header_64*>(header), |
157 SEG_TEXT, | 157 SEG_TEXT, |
158 SECT_TEXT, | 158 SECT_TEXT, |
159 &size); | 159 &size); |
160 #else | 160 #else |
161 unsigned int size; | 161 unsigned int size; |
162 char* code_ptr = getsectdatafromheader(header, SEG_TEXT, SECT_TEXT, &size); | 162 char* code_ptr = getsectdatafromheader(header, SEG_TEXT, SECT_TEXT, &size); |
163 #endif | 163 #endif |
164 if (code_ptr == NULL) continue; | 164 if (code_ptr == NULL) continue; |
165 const uintptr_t slide = _dyld_get_image_vmaddr_slide(i); | 165 const uintptr_t slide = _dyld_get_image_vmaddr_slide(i); |
166 const uintptr_t start = reinterpret_cast<uintptr_t>(code_ptr) + slide; | 166 const uintptr_t start = reinterpret_cast<uintptr_t>(code_ptr) + slide; |
167 LOG(Isolate::Current(), | 167 LOG(isolate, |
168 SharedLibraryEvent(_dyld_get_image_name(i), start, start + size)); | 168 SharedLibraryEvent(_dyld_get_image_name(i), start, start + size)); |
169 } | 169 } |
170 } | 170 } |
171 | 171 |
172 | 172 |
173 void OS::SignalCodeMovingGC() { | 173 void OS::SignalCodeMovingGC() { |
174 } | 174 } |
175 | 175 |
176 | 176 |
177 const char* OS::LocalTimezone(double time) { | 177 const char* OS::LocalTimezone(double time) { |
(...skipping 15 matching lines...) Expand all Loading... |
193 | 193 |
194 | 194 |
195 int OS::StackWalk(Vector<StackFrame> frames) { | 195 int OS::StackWalk(Vector<StackFrame> frames) { |
196 // If weak link to execinfo lib has failed, ie because we are on 10.4, abort. | 196 // If weak link to execinfo lib has failed, ie because we are on 10.4, abort. |
197 if (backtrace == NULL) return 0; | 197 if (backtrace == NULL) return 0; |
198 | 198 |
199 return POSIXBacktraceHelper<backtrace, backtrace_symbols>::StackWalk(frames); | 199 return POSIXBacktraceHelper<backtrace, backtrace_symbols>::StackWalk(frames); |
200 } | 200 } |
201 | 201 |
202 } } // namespace v8::internal | 202 } } // namespace v8::internal |
OLD | NEW |