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_macros.h" | 7 #include "vm/assembler_macros.h" |
| 8 #include "vm/deopt_instructions.h" |
8 #include "vm/isolate.h" | 9 #include "vm/isolate.h" |
9 #include "vm/object.h" | 10 #include "vm/object.h" |
10 #include "vm/object_store.h" | 11 #include "vm/object_store.h" |
11 #include "vm/os.h" | 12 #include "vm/os.h" |
12 #include "vm/parser.h" | 13 #include "vm/parser.h" |
13 #include "vm/raw_object.h" | 14 #include "vm/raw_object.h" |
14 #include "vm/stub_code.h" | 15 #include "vm/stub_code.h" |
15 #include "vm/visitor.h" | 16 #include "vm/visitor.h" |
16 | 17 |
17 namespace dart { | 18 namespace dart { |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 | 282 |
282 EntryFrame* StackFrameIterator::NextEntryFrame() { | 283 EntryFrame* StackFrameIterator::NextEntryFrame() { |
283 ASSERT(!frames_.HasNext()); | 284 ASSERT(!frames_.HasNext()); |
284 entry_.sp_ = frames_.sp_; | 285 entry_.sp_ = frames_.sp_; |
285 entry_.fp_ = frames_.fp_; | 286 entry_.fp_ = frames_.fp_; |
286 SetupNextExitFrameData(); // Setup data for next exit frame in chain. | 287 SetupNextExitFrameData(); // Setup data for next exit frame in chain. |
287 ASSERT(entry_.IsValid()); | 288 ASSERT(entry_.IsValid()); |
288 return &entry_; | 289 return &entry_; |
289 } | 290 } |
290 | 291 |
| 292 |
| 293 InlinedFunctionsInDartFrameIterator::InlinedFunctionsInDartFrameIterator( |
| 294 StackFrame* frame) : index_(0), |
| 295 frame_(frame), |
| 296 func_(Function::Handle()), |
| 297 deopt_info_(DeoptInfo::Handle()), |
| 298 object_table_(Array::Handle()) { |
| 299 ASSERT(frame_ != NULL); |
| 300 const Code& code = Code::Handle(frame_->LookupDartCode()); |
| 301 ASSERT(code.is_optimized()); |
| 302 func_ = code.function(); |
| 303 intptr_t deopt_reason = kDeoptUnknown; |
| 304 deopt_info_ = code.GetDeoptInfoAtPc(frame_->pc(), &deopt_reason); |
| 305 object_table_ = code.object_table(); |
| 306 } |
| 307 |
| 308 |
| 309 RawFunction* InlinedFunctionsInDartFrameIterator::GetNextFunction(uword* pc) { |
| 310 if (index_ == -1) { |
| 311 return Function::null(); |
| 312 } |
| 313 if (deopt_info_.IsNull()) { |
| 314 // We are at a PC that has no deoptimization info so there are no |
| 315 // inlined functions to iterate over, we return the function. |
| 316 index_ = -1; // No more functions. |
| 317 *pc = frame_->pc(); |
| 318 return func_.raw(); |
| 319 } |
| 320 // Iterate over the deopt instructions and determine the inlined |
| 321 // functions if any and iterate over them. |
| 322 ASSERT(deopt_info_.Length() != 0); |
| 323 while (index_ < deopt_info_.Length()) { |
| 324 intptr_t cur_index = index_; |
| 325 index_ += 1; |
| 326 intptr_t deopt_instr = deopt_info_.Instruction(cur_index); |
| 327 ASSERT(deopt_instr != DeoptInstr::kRetBeforeAddress); |
| 328 if ((deopt_instr == DeoptInstr::kRetAfterAddress)) { |
| 329 intptr_t deopt_from_index = deopt_info_.FromIndex(cur_index); |
| 330 *pc = DeoptInstr::GetRetAfterAddress(deopt_from_index, |
| 331 object_table_, |
| 332 &func_); |
| 333 return func_.raw(); |
| 334 } |
| 335 } |
| 336 index_ = -1; |
| 337 return Function::null(); |
| 338 } |
| 339 |
291 } // namespace dart | 340 } // namespace dart |
OLD | NEW |