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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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.HasNext()) { |
229 RawPcDescriptors::PcDescriptorRec rec; | 229 const uword current_pc = iter.NextPc(); |
230 iter.NextRec(&rec); | 230 const intptr_t current_try_index = iter.current_try_index(); |
231 if ((rec.pc() == pc()) && (rec.try_index() != -1)) { | 231 if ((current_pc == pc()) && (current_try_index != -1)) { |
232 RawExceptionHandlers::HandlerInfo handler_info; | 232 RawExceptionHandlers::HandlerInfo handler_info; |
233 handlers.GetHandlerInfo(rec.try_index(), &handler_info); | 233 handlers.GetHandlerInfo(current_try_index, &handler_info); |
234 *handler_pc = handler_info.handler_pc; | 234 *handler_pc = handler_info.handler_pc; |
235 *needs_stacktrace = handler_info.needs_stacktrace; | 235 *needs_stacktrace = handler_info.needs_stacktrace; |
236 *has_catch_all = handler_info.has_catch_all; | 236 *has_catch_all = handler_info.has_catch_all; |
237 return true; | 237 return true; |
238 } | 238 } |
239 } | 239 } |
240 return false; | 240 return false; |
241 } | 241 } |
242 | 242 |
243 | 243 |
244 intptr_t StackFrame::GetTokenPos() const { | 244 intptr_t StackFrame::GetTokenPos() const { |
245 const Code& code = Code::Handle(LookupDartCode()); | 245 const Code& code = Code::Handle(LookupDartCode()); |
246 if (code.IsNull()) { | 246 if (code.IsNull()) { |
247 return -1; // Stub frames do not have token_pos. | 247 return -1; // Stub frames do not have token_pos. |
248 } | 248 } |
249 const PcDescriptors& descriptors = | 249 const PcDescriptors& descriptors = |
250 PcDescriptors::Handle(code.pc_descriptors()); | 250 PcDescriptors::Handle(code.pc_descriptors()); |
251 ASSERT(!descriptors.IsNull()); | 251 ASSERT(!descriptors.IsNull()); |
252 PcDescriptors::Iterator iter(descriptors, RawPcDescriptors::kAnyKind); | 252 PcDescriptors::Iterator iter(descriptors, RawPcDescriptors::kAnyKind); |
253 while (iter.HasNext()) { | 253 while (iter.HasNext()) { |
254 RawPcDescriptors::PcDescriptorRec rec; | 254 const uword current_pc = iter.NextPc(); |
255 iter.NextRec(&rec); | 255 if (current_pc == pc()) { |
256 if (rec.pc() == pc()) { | 256 return iter.current_token_pos(); |
257 return rec.token_pos(); | |
258 } | 257 } |
259 } | 258 } |
260 return -1; | 259 return -1; |
261 } | 260 } |
262 | 261 |
263 | 262 |
264 | 263 |
265 bool StackFrame::IsValid() const { | 264 bool StackFrame::IsValid() const { |
266 if (IsEntryFrame() || IsExitFrame() || IsStubFrame()) { | 265 if (IsEntryFrame() || IsExitFrame() || IsStubFrame()) { |
267 return true; | 266 return true; |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 if (deopt_instr->kind() == DeoptInstr::kCallerFp) { | 484 if (deopt_instr->kind() == DeoptInstr::kCallerFp) { |
486 return (index - num_materializations_); | 485 return (index - num_materializations_); |
487 } | 486 } |
488 } | 487 } |
489 UNREACHABLE(); | 488 UNREACHABLE(); |
490 return 0; | 489 return 0; |
491 } | 490 } |
492 | 491 |
493 | 492 |
494 } // namespace dart | 493 } // namespace dart |
OLD | NEW |