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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 const RawPcDescriptors::PcDescriptorRec& rec = iter.Next(); | 229 const RawPcDescriptors::PcDescriptorRec& rec = iter.Next(); |
230 if ((rec.pc == pc()) && (rec.try_index != -1)) { | 230 if ((rec.pc() == pc()) && (rec.try_index() != -1)) { |
231 const intptr_t try_index = rec.try_index; | |
232 RawExceptionHandlers::HandlerInfo handler_info; | 231 RawExceptionHandlers::HandlerInfo handler_info; |
233 handlers.GetHandlerInfo(try_index, &handler_info); | 232 handlers.GetHandlerInfo(rec.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.HasNext()) { |
254 const RawPcDescriptors::PcDescriptorRec& rec = iter.Next(); | 253 const RawPcDescriptors::PcDescriptorRec& rec = iter.Next(); |
255 if (rec.pc == pc()) { | 254 if (rec.pc() == pc()) { |
256 return rec.token_pos; | 255 return rec.token_pos(); |
257 } | 256 } |
258 } | 257 } |
259 return -1; | 258 return -1; |
260 } | 259 } |
261 | 260 |
262 | 261 |
263 | 262 |
264 bool StackFrame::IsValid() const { | 263 bool StackFrame::IsValid() const { |
265 if (IsEntryFrame() || IsExitFrame() || IsStubFrame()) { | 264 if (IsEntryFrame() || IsExitFrame() || IsStubFrame()) { |
266 return true; | 265 return true; |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 if (deopt_instr->kind() == DeoptInstr::kCallerFp) { | 483 if (deopt_instr->kind() == DeoptInstr::kCallerFp) { |
485 return (index - num_materializations_); | 484 return (index - num_materializations_); |
486 } | 485 } |
487 } | 486 } |
488 UNREACHABLE(); | 487 UNREACHABLE(); |
489 return 0; | 488 return 0; |
490 } | 489 } |
491 | 490 |
492 | 491 |
493 } // namespace dart | 492 } // namespace dart |
OLD | NEW |