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 "platform/memory_sanitizer.h" | 7 #include "platform/memory_sanitizer.h" |
8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
9 #include "vm/deopt_instructions.h" | 9 #include "vm/deopt_instructions.h" |
10 #include "vm/isolate.h" | 10 #include "vm/isolate.h" |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 dest_frame_size_(0), | 504 dest_frame_size_(0), |
505 code_(Code::Handle(code.raw())), | 505 code_(Code::Handle(code.raw())), |
506 deopt_info_(TypedData::Handle()), | 506 deopt_info_(TypedData::Handle()), |
507 function_(Function::Handle()), | 507 function_(Function::Handle()), |
508 pc_(pc), | 508 pc_(pc), |
509 deopt_instructions_(), | 509 deopt_instructions_(), |
510 object_table_(ObjectPool::Handle()) { | 510 object_table_(ObjectPool::Handle()) { |
511 ASSERT(code_.is_optimized()); | 511 ASSERT(code_.is_optimized()); |
512 ASSERT(pc_ != 0); | 512 ASSERT(pc_ != 0); |
513 ASSERT(code.ContainsInstructionAt(pc)); | 513 ASSERT(code.ContainsInstructionAt(pc)); |
| 514 #if defined(DART_PRECOMPILED_RUNTIME) |
| 515 ASSERT(deopt_info_.IsNull()); |
| 516 function_ = code_.function(); |
| 517 #else |
514 ICData::DeoptReasonId deopt_reason = ICData::kDeoptUnknown; | 518 ICData::DeoptReasonId deopt_reason = ICData::kDeoptUnknown; |
515 uint32_t deopt_flags = 0; | 519 uint32_t deopt_flags = 0; |
516 deopt_info_ = code_.GetDeoptInfoAtPc(pc, &deopt_reason, &deopt_flags); | 520 deopt_info_ = code_.GetDeoptInfoAtPc(pc, &deopt_reason, &deopt_flags); |
517 if (deopt_info_.IsNull()) { | 521 if (deopt_info_.IsNull()) { |
518 // This is the case when a call without deopt info in optimized code | 522 // This is the case when a call without deopt info in optimized code |
519 // throws an exception. (e.g. in the parameter copying prologue). | 523 // throws an exception. (e.g. in the parameter copying prologue). |
520 // In that case there won't be any inlined frames. | 524 // In that case there won't be any inlined frames. |
521 function_ = code_.function(); | 525 function_ = code_.function(); |
522 } else { | 526 } else { |
523 // Unpack deopt info into instructions (translate away suffixes). | 527 // Unpack deopt info into instructions (translate away suffixes). |
524 const Array& deopt_table = Array::Handle(code_.deopt_info_array()); | 528 const Array& deopt_table = Array::Handle(code_.deopt_info_array()); |
525 ASSERT(!deopt_table.IsNull()); | 529 ASSERT(!deopt_table.IsNull()); |
526 DeoptInfo::Unpack(deopt_table, deopt_info_, &deopt_instructions_); | 530 DeoptInfo::Unpack(deopt_table, deopt_info_, &deopt_instructions_); |
527 num_materializations_ = DeoptInfo::NumMaterializations(deopt_instructions_); | 531 num_materializations_ = DeoptInfo::NumMaterializations(deopt_instructions_); |
528 dest_frame_size_ = DeoptInfo::FrameSize(deopt_info_); | 532 dest_frame_size_ = DeoptInfo::FrameSize(deopt_info_); |
529 object_table_ = code_.GetObjectPool(); | 533 object_table_ = code_.GetObjectPool(); |
530 Advance(); | 534 Advance(); |
531 } | 535 } |
| 536 #endif // defined(DART_PRECOMPILED_RUNTIME) |
532 } | 537 } |
533 | 538 |
534 | 539 |
535 void InlinedFunctionsIterator::Advance() { | 540 void InlinedFunctionsIterator::Advance() { |
536 // Iterate over the deopt instructions and determine the inlined | 541 // Iterate over the deopt instructions and determine the inlined |
537 // functions if any and iterate over them. | 542 // functions if any and iterate over them. |
538 ASSERT(!Done()); | 543 ASSERT(!Done()); |
539 | 544 |
| 545 #if defined(DART_PRECOMPILED_RUNTIME) |
| 546 ASSERT(deopt_info_.IsNull()); |
| 547 SetDone(); |
| 548 return; |
| 549 #else |
540 if (deopt_info_.IsNull()) { | 550 if (deopt_info_.IsNull()) { |
541 SetDone(); | 551 SetDone(); |
542 return; | 552 return; |
543 } | 553 } |
544 | 554 |
545 ASSERT(deopt_instructions_.length() != 0); | 555 ASSERT(deopt_instructions_.length() != 0); |
546 while (index_ < deopt_instructions_.length()) { | 556 while (index_ < deopt_instructions_.length()) { |
547 DeoptInstr* deopt_instr = deopt_instructions_[index_++]; | 557 DeoptInstr* deopt_instr = deopt_instructions_[index_++]; |
548 if (deopt_instr->kind() == DeoptInstr::kRetAddress) { | 558 if (deopt_instr->kind() == DeoptInstr::kRetAddress) { |
549 pc_ = DeoptInstr::GetRetAddress(deopt_instr, object_table_, &code_); | 559 pc_ = DeoptInstr::GetRetAddress(deopt_instr, object_table_, &code_); |
550 function_ = code_.function(); | 560 function_ = code_.function(); |
551 return; | 561 return; |
552 } | 562 } |
553 } | 563 } |
554 SetDone(); | 564 SetDone(); |
| 565 #endif // defined(DART_PRECOMPILED_RUNTIME) |
555 } | 566 } |
556 | 567 |
557 | 568 |
558 // Finds the potential offset for the current function's FP if the | 569 // Finds the potential offset for the current function's FP if the |
559 // current frame were to be deoptimized. | 570 // current frame were to be deoptimized. |
560 intptr_t InlinedFunctionsIterator::GetDeoptFpOffset() const { | 571 intptr_t InlinedFunctionsIterator::GetDeoptFpOffset() const { |
561 ASSERT(deopt_instructions_.length() != 0); | 572 ASSERT(deopt_instructions_.length() != 0); |
562 for (intptr_t index = index_; index < deopt_instructions_.length(); index++) { | 573 for (intptr_t index = index_; index < deopt_instructions_.length(); index++) { |
563 DeoptInstr* deopt_instr = deopt_instructions_[index]; | 574 DeoptInstr* deopt_instr = deopt_instructions_[index]; |
564 if (deopt_instr->kind() == DeoptInstr::kCallerFp) { | 575 if (deopt_instr->kind() == DeoptInstr::kCallerFp) { |
(...skipping 19 matching lines...) Expand all Loading... |
584 StackFrameIterator::kNoCrossThreadIteration); | 595 StackFrameIterator::kNoCrossThreadIteration); |
585 StackFrame* frame = frames.NextFrame(); | 596 StackFrame* frame = frames.NextFrame(); |
586 while (frame != NULL) { | 597 while (frame != NULL) { |
587 frame = frames.NextFrame(); | 598 frame = frames.NextFrame(); |
588 } | 599 } |
589 } | 600 } |
590 #endif | 601 #endif |
591 | 602 |
592 | 603 |
593 } // namespace dart | 604 } // namespace dart |
OLD | NEW |