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 OptimizedDartFrameIterator::OptimizedDartFrameIterator(StackFrame* frame) | |
294 : index_(-1), | |
srdjan
2013/01/10 21:53:57
set to 0
siva
2013/01/12 00:20:54
Done.
| |
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 index_ = 0; | |
srdjan
2013/01/10 21:53:57
remove
siva
2013/01/12 00:20:54
Done.
| |
307 } | |
308 | |
309 | |
310 RawFunction* OptimizedDartFrameIterator::GetNextFunction(uword* pc) { | |
311 if (index_ == -1) { | |
312 return Function::null(); | |
313 } | |
314 if (deopt_info_.IsNull()) { | |
315 // We are at a PC that has no deoptimization info so there are no | |
316 // inlined functions to iterate over, we return the function. | |
317 index_ = -1; // No more functions. | |
318 *pc = frame_->pc(); | |
319 return func_.raw(); | |
320 } | |
321 // Iterate over the deopt instructions and determine the inlined | |
322 // functions if any and iterate over them. | |
323 ASSERT(deopt_info_.Length() != 0); | |
324 while (index_ < deopt_info_.Length()) { | |
325 intptr_t cur_index = index_; | |
326 index_ += 1; | |
327 intptr_t deopt_instr = deopt_info_.Instruction(cur_index); | |
328 ASSERT(deopt_instr != DeoptInstr::kRetBeforeAddress); | |
329 if ((deopt_instr == DeoptInstr::kRetAfterAddress)) { | |
330 intptr_t deopt_from_index = deopt_info_.FromIndex(cur_index); | |
331 *pc = DeoptInstr::GetReturnAddress(deopt_instr, | |
332 deopt_from_index, | |
333 object_table_, | |
334 &func_); | |
335 return func_.raw(); | |
336 } | |
337 } | |
338 index_ = -1; | |
339 return Function::null(); | |
340 } | |
341 | |
291 } // namespace dart | 342 } // namespace dart |
OLD | NEW |