OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Platform-specific code for Solaris 10 goes here. For the POSIX-compatible | 5 // Platform-specific code for Solaris 10 goes here. For the POSIX-compatible |
6 // parts, the implementation is in platform-posix.cc. | 6 // parts, the implementation is in platform-posix.cc. |
7 | 7 |
8 #ifdef __sparc | 8 #ifdef __sparc |
9 # error "V8 does not support the SPARC CPU architecture." | 9 # error "V8 does not support the SPARC CPU architecture." |
10 #endif | 10 #endif |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 | 133 |
134 std::vector<OS::SharedLibraryAddress> OS::GetSharedLibraryAddresses() { | 134 std::vector<OS::SharedLibraryAddress> OS::GetSharedLibraryAddresses() { |
135 return std::vector<SharedLibraryAddress>(); | 135 return std::vector<SharedLibraryAddress>(); |
136 } | 136 } |
137 | 137 |
138 | 138 |
139 void OS::SignalCodeMovingGC() { | 139 void OS::SignalCodeMovingGC() { |
140 } | 140 } |
141 | 141 |
142 | 142 |
143 struct StackWalker { | |
144 Vector<OS::StackFrame>& frames; | |
145 int index; | |
146 }; | |
147 | |
148 | |
149 static int StackWalkCallback(uintptr_t pc, int signo, void* data) { | |
150 struct StackWalker* walker = static_cast<struct StackWalker*>(data); | |
151 Dl_info info; | |
152 | |
153 int i = walker->index; | |
154 | |
155 walker->frames[i].address = reinterpret_cast<void*>(pc); | |
156 | |
157 // Make sure line termination is in place. | |
158 walker->frames[i].text[OS::kStackWalkMaxTextLen - 1] = '\0'; | |
159 | |
160 Vector<char> text = MutableCStrVector(walker->frames[i].text, | |
161 OS::kStackWalkMaxTextLen); | |
162 | |
163 if (dladdr(reinterpret_cast<void*>(pc), &info) == 0) { | |
164 OS::SNPrintF(text, "[0x%p]", pc); | |
165 } else if ((info.dli_fname != NULL && info.dli_sname != NULL)) { | |
166 // We have symbol info. | |
167 OS::SNPrintF(text, "%s'%s+0x%x", info.dli_fname, info.dli_sname, pc); | |
168 } else { | |
169 // No local symbol info. | |
170 OS::SNPrintF(text, | |
171 "%s'0x%p [0x%p]", | |
172 info.dli_fname, | |
173 pc - reinterpret_cast<uintptr_t>(info.dli_fbase), | |
174 pc); | |
175 } | |
176 walker->index++; | |
177 return 0; | |
178 } | |
179 | |
180 | |
181 // Constants used for mmap. | 143 // Constants used for mmap. |
182 static const int kMmapFd = -1; | 144 static const int kMmapFd = -1; |
183 static const int kMmapFdOffset = 0; | 145 static const int kMmapFdOffset = 0; |
184 | 146 |
185 | 147 |
186 VirtualMemory::VirtualMemory() : address_(NULL), size_(0) { } | 148 VirtualMemory::VirtualMemory() : address_(NULL), size_(0) { } |
187 | 149 |
188 | 150 |
189 VirtualMemory::VirtualMemory(size_t size) | 151 VirtualMemory::VirtualMemory(size_t size) |
190 : address_(ReserveRegion(size)), size_(size) { } | 152 : address_(ReserveRegion(size)), size_(size) { } |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 return munmap(base, size) == 0; | 270 return munmap(base, size) == 0; |
309 } | 271 } |
310 | 272 |
311 | 273 |
312 bool VirtualMemory::HasLazyCommits() { | 274 bool VirtualMemory::HasLazyCommits() { |
313 // TODO(alph): implement for the platform. | 275 // TODO(alph): implement for the platform. |
314 return false; | 276 return false; |
315 } | 277 } |
316 | 278 |
317 } } // namespace v8::internal | 279 } } // namespace v8::internal |
OLD | NEW |