OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/stack_frame.h" | 5 #include "vm/stack_frame.h" |
6 | 6 |
7 #include "vm/assembler.h" | 7 #include "vm/assembler.h" |
8 #include "vm/deopt_instructions.h" | 8 #include "vm/deopt_instructions.h" |
9 #include "vm/isolate.h" | 9 #include "vm/isolate.h" |
10 #include "vm/object.h" | 10 #include "vm/object.h" |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 handlers = code.exception_handlers(); | 218 handlers = code.exception_handlers(); |
219 if (handlers.Length() == 0) { | 219 if (handlers.Length() == 0) { |
220 return false; | 220 return false; |
221 } | 221 } |
222 | 222 |
223 // Find pc descriptor for the current pc. | 223 // Find pc descriptor for the current pc. |
224 REUSABLE_PC_DESCRIPTORS_HANDLESCOPE(isolate); | 224 REUSABLE_PC_DESCRIPTORS_HANDLESCOPE(isolate); |
225 PcDescriptors& descriptors = reused_pc_descriptors_handle.Handle(); | 225 PcDescriptors& descriptors = reused_pc_descriptors_handle.Handle(); |
226 descriptors = code.pc_descriptors(); | 226 descriptors = code.pc_descriptors(); |
227 PcDescriptors::Iterator iter(descriptors, RawPcDescriptors::kAnyKind); | 227 PcDescriptors::Iterator iter(descriptors, RawPcDescriptors::kAnyKind); |
228 while (iter.HasNext()) { | 228 while (iter.MoveNext()) { |
229 RawPcDescriptors::PcDescriptorRec rec; | 229 const intptr_t current_try_index = iter.TryIndex(); |
230 iter.NextRec(&rec); | 230 if ((iter.Pc() == pc()) && (current_try_index != -1)) { |
231 if ((rec.pc() == pc()) && (rec.try_index() != -1)) { | |
232 RawExceptionHandlers::HandlerInfo handler_info; | 231 RawExceptionHandlers::HandlerInfo handler_info; |
233 handlers.GetHandlerInfo(rec.try_index(), &handler_info); | 232 handlers.GetHandlerInfo(current_try_index, &handler_info); |
234 *handler_pc = handler_info.handler_pc; | 233 *handler_pc = handler_info.handler_pc; |
235 *needs_stacktrace = handler_info.needs_stacktrace; | 234 *needs_stacktrace = handler_info.needs_stacktrace; |
236 *has_catch_all = handler_info.has_catch_all; | 235 *has_catch_all = handler_info.has_catch_all; |
237 return true; | 236 return true; |
238 } | 237 } |
239 } | 238 } |
240 return false; | 239 return false; |
241 } | 240 } |
242 | 241 |
243 | 242 |
244 intptr_t StackFrame::GetTokenPos() const { | 243 intptr_t StackFrame::GetTokenPos() const { |
245 const Code& code = Code::Handle(LookupDartCode()); | 244 const Code& code = Code::Handle(LookupDartCode()); |
246 if (code.IsNull()) { | 245 if (code.IsNull()) { |
247 return -1; // Stub frames do not have token_pos. | 246 return -1; // Stub frames do not have token_pos. |
248 } | 247 } |
249 const PcDescriptors& descriptors = | 248 const PcDescriptors& descriptors = |
250 PcDescriptors::Handle(code.pc_descriptors()); | 249 PcDescriptors::Handle(code.pc_descriptors()); |
251 ASSERT(!descriptors.IsNull()); | 250 ASSERT(!descriptors.IsNull()); |
252 PcDescriptors::Iterator iter(descriptors, RawPcDescriptors::kAnyKind); | 251 PcDescriptors::Iterator iter(descriptors, RawPcDescriptors::kAnyKind); |
253 while (iter.HasNext()) { | 252 while (iter.MoveNext()) { |
254 RawPcDescriptors::PcDescriptorRec rec; | 253 if (iter.Pc() == pc()) { |
255 iter.NextRec(&rec); | 254 return iter.TokenPos(); |
256 if (rec.pc() == pc()) { | |
257 return rec.token_pos(); | |
258 } | 255 } |
259 } | 256 } |
260 return -1; | 257 return -1; |
261 } | 258 } |
262 | 259 |
263 | 260 |
264 | 261 |
265 bool StackFrame::IsValid() const { | 262 bool StackFrame::IsValid() const { |
266 if (IsEntryFrame() || IsExitFrame() || IsStubFrame()) { | 263 if (IsEntryFrame() || IsExitFrame() || IsStubFrame()) { |
267 return true; | 264 return true; |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 if (deopt_instr->kind() == DeoptInstr::kCallerFp) { | 482 if (deopt_instr->kind() == DeoptInstr::kCallerFp) { |
486 return (index - num_materializations_); | 483 return (index - num_materializations_); |
487 } | 484 } |
488 } | 485 } |
489 UNREACHABLE(); | 486 UNREACHABLE(); |
490 return 0; | 487 return 0; |
491 } | 488 } |
492 | 489 |
493 | 490 |
494 } // namespace dart | 491 } // namespace dart |
OLD | NEW |