OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 unsigned bailout_id, | 347 unsigned bailout_id, |
348 Address from, | 348 Address from, |
349 int fp_to_sp_delta, | 349 int fp_to_sp_delta, |
350 Code* optimized_code) | 350 Code* optimized_code) |
351 : isolate_(isolate), | 351 : isolate_(isolate), |
352 function_(function), | 352 function_(function), |
353 bailout_id_(bailout_id), | 353 bailout_id_(bailout_id), |
354 bailout_type_(type), | 354 bailout_type_(type), |
355 from_(from), | 355 from_(from), |
356 fp_to_sp_delta_(fp_to_sp_delta), | 356 fp_to_sp_delta_(fp_to_sp_delta), |
| 357 has_alignment_padding_(0), |
357 input_(NULL), | 358 input_(NULL), |
358 output_count_(0), | 359 output_count_(0), |
359 jsframe_count_(0), | 360 jsframe_count_(0), |
360 output_(NULL), | 361 output_(NULL), |
361 deferred_heap_numbers_(0) { | 362 deferred_heap_numbers_(0) { |
362 if (FLAG_trace_deopt && type != OSR) { | 363 if (FLAG_trace_deopt && type != OSR) { |
363 if (type == DEBUGGER) { | 364 if (type == DEBUGGER) { |
364 PrintF("**** DEOPT FOR DEBUGGER: "); | 365 PrintF("**** DEOPT FOR DEBUGGER: "); |
365 } else { | 366 } else { |
366 PrintF("**** DEOPT: "); | 367 PrintF("**** DEOPT: "); |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 } | 587 } |
587 | 588 |
588 // Print some helpful diagnostic information. | 589 // Print some helpful diagnostic information. |
589 if (FLAG_trace_deopt) { | 590 if (FLAG_trace_deopt) { |
590 double ms = static_cast<double>(OS::Ticks() - start) / 1000; | 591 double ms = static_cast<double>(OS::Ticks() - start) / 1000; |
591 int index = output_count_ - 1; // Index of the topmost frame. | 592 int index = output_count_ - 1; // Index of the topmost frame. |
592 JSFunction* function = output_[index]->GetFunction(); | 593 JSFunction* function = output_[index]->GetFunction(); |
593 PrintF("[deoptimizing: end 0x%08" V8PRIxPTR " ", | 594 PrintF("[deoptimizing: end 0x%08" V8PRIxPTR " ", |
594 reinterpret_cast<intptr_t>(function)); | 595 reinterpret_cast<intptr_t>(function)); |
595 function->PrintName(); | 596 function->PrintName(); |
596 PrintF(" => node=%u, pc=0x%08" V8PRIxPTR ", state=%s, took %0.3f ms]\n", | 597 PrintF(" => node=%u, pc=0x%08" V8PRIxPTR ", state=%s, alignment=%s," |
| 598 " took %0.3f ms]\n", |
597 node_id, | 599 node_id, |
598 output_[index]->GetPc(), | 600 output_[index]->GetPc(), |
599 FullCodeGenerator::State2String( | 601 FullCodeGenerator::State2String( |
600 static_cast<FullCodeGenerator::State>( | 602 static_cast<FullCodeGenerator::State>( |
601 output_[index]->GetState()->value())), | 603 output_[index]->GetState()->value())), |
| 604 has_alignment_padding_ ? "with padding" : "no padding", |
602 ms); | 605 ms); |
603 } | 606 } |
604 } | 607 } |
605 | 608 |
606 | 609 |
607 void Deoptimizer::MaterializeHeapNumbers() { | 610 void Deoptimizer::MaterializeHeapNumbers() { |
608 ASSERT_NE(DEBUGGER, bailout_type_); | 611 ASSERT_NE(DEBUGGER, bailout_type_); |
609 for (int i = 0; i < deferred_heap_numbers_.length(); i++) { | 612 for (int i = 0; i < deferred_heap_numbers_.length(); i++) { |
610 HeapNumberMaterializationDescriptor d = deferred_heap_numbers_[i]; | 613 HeapNumberMaterializationDescriptor d = deferred_heap_numbers_[i]; |
611 Handle<Object> num = isolate_->factory()->NewNumber(d.value()); | 614 Handle<Object> num = isolate_->factory()->NewNumber(d.value()); |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
762 } | 765 } |
763 | 766 |
764 case Translation::STACK_SLOT: { | 767 case Translation::STACK_SLOT: { |
765 int input_slot_index = iterator->Next(); | 768 int input_slot_index = iterator->Next(); |
766 unsigned input_offset = | 769 unsigned input_offset = |
767 input_->GetOffsetFromSlotIndex(input_slot_index); | 770 input_->GetOffsetFromSlotIndex(input_slot_index); |
768 intptr_t input_value = input_->GetFrameSlot(input_offset); | 771 intptr_t input_value = input_->GetFrameSlot(input_offset); |
769 if (FLAG_trace_deopt) { | 772 if (FLAG_trace_deopt) { |
770 PrintF(" 0x%08" V8PRIxPTR ": ", | 773 PrintF(" 0x%08" V8PRIxPTR ": ", |
771 output_[frame_index]->GetTop() + output_offset); | 774 output_[frame_index]->GetTop() + output_offset); |
772 PrintF("[top + %d] <- 0x%08" V8PRIxPTR " ; [esp + %d] ", | 775 PrintF("[top + %d] <- 0x%08" V8PRIxPTR " ; [sp + %d] ", |
773 output_offset, | 776 output_offset, |
774 input_value, | 777 input_value, |
775 input_offset); | 778 input_offset); |
776 reinterpret_cast<Object*>(input_value)->ShortPrint(); | 779 reinterpret_cast<Object*>(input_value)->ShortPrint(); |
777 PrintF("\n"); | 780 PrintF("\n"); |
778 } | 781 } |
779 output_[frame_index]->SetFrameSlot(output_offset, input_value); | 782 output_[frame_index]->SetFrameSlot(output_offset, input_value); |
780 return; | 783 return; |
781 } | 784 } |
782 | 785 |
783 case Translation::INT32_STACK_SLOT: { | 786 case Translation::INT32_STACK_SLOT: { |
784 int input_slot_index = iterator->Next(); | 787 int input_slot_index = iterator->Next(); |
785 unsigned input_offset = | 788 unsigned input_offset = |
786 input_->GetOffsetFromSlotIndex(input_slot_index); | 789 input_->GetOffsetFromSlotIndex(input_slot_index); |
787 intptr_t value = input_->GetFrameSlot(input_offset); | 790 intptr_t value = input_->GetFrameSlot(input_offset); |
788 bool is_smi = Smi::IsValid(value); | 791 bool is_smi = Smi::IsValid(value); |
789 if (FLAG_trace_deopt) { | 792 if (FLAG_trace_deopt) { |
790 PrintF(" 0x%08" V8PRIxPTR ": ", | 793 PrintF(" 0x%08" V8PRIxPTR ": ", |
791 output_[frame_index]->GetTop() + output_offset); | 794 output_[frame_index]->GetTop() + output_offset); |
792 PrintF("[top + %d] <- %" V8PRIdPTR " ; [esp + %d] (%s)\n", | 795 PrintF("[top + %d] <- %" V8PRIdPTR " ; [sp + %d] (%s)\n", |
793 output_offset, | 796 output_offset, |
794 value, | 797 value, |
795 input_offset, | 798 input_offset, |
796 is_smi ? "smi" : "heap number"); | 799 is_smi ? "smi" : "heap number"); |
797 } | 800 } |
798 if (is_smi) { | 801 if (is_smi) { |
799 intptr_t tagged_value = | 802 intptr_t tagged_value = |
800 reinterpret_cast<intptr_t>(Smi::FromInt(static_cast<int>(value))); | 803 reinterpret_cast<intptr_t>(Smi::FromInt(static_cast<int>(value))); |
801 output_[frame_index]->SetFrameSlot(output_offset, tagged_value); | 804 output_[frame_index]->SetFrameSlot(output_offset, tagged_value); |
802 } else { | 805 } else { |
803 // We save the untagged value on the side and store a GC-safe | 806 // We save the untagged value on the side and store a GC-safe |
804 // temporary placeholder in the frame. | 807 // temporary placeholder in the frame. |
805 AddDoubleValue(output_[frame_index]->GetTop() + output_offset, | 808 AddDoubleValue(output_[frame_index]->GetTop() + output_offset, |
806 static_cast<double>(static_cast<int32_t>(value))); | 809 static_cast<double>(static_cast<int32_t>(value))); |
807 output_[frame_index]->SetFrameSlot(output_offset, kPlaceholder); | 810 output_[frame_index]->SetFrameSlot(output_offset, kPlaceholder); |
808 } | 811 } |
809 return; | 812 return; |
810 } | 813 } |
811 | 814 |
812 case Translation::DOUBLE_STACK_SLOT: { | 815 case Translation::DOUBLE_STACK_SLOT: { |
813 int input_slot_index = iterator->Next(); | 816 int input_slot_index = iterator->Next(); |
814 unsigned input_offset = | 817 unsigned input_offset = |
815 input_->GetOffsetFromSlotIndex(input_slot_index); | 818 input_->GetOffsetFromSlotIndex(input_slot_index); |
816 double value = input_->GetDoubleFrameSlot(input_offset); | 819 double value = input_->GetDoubleFrameSlot(input_offset); |
817 if (FLAG_trace_deopt) { | 820 if (FLAG_trace_deopt) { |
818 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- %e ; [esp + %d]\n", | 821 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- %e ; [sp + %d]\n", |
819 output_[frame_index]->GetTop() + output_offset, | 822 output_[frame_index]->GetTop() + output_offset, |
820 output_offset, | 823 output_offset, |
821 value, | 824 value, |
822 input_offset); | 825 input_offset); |
823 } | 826 } |
824 // We save the untagged value on the side and store a GC-safe | 827 // We save the untagged value on the side and store a GC-safe |
825 // temporary placeholder in the frame. | 828 // temporary placeholder in the frame. |
826 AddDoubleValue(output_[frame_index]->GetTop() + output_offset, value); | 829 AddDoubleValue(output_[frame_index]->GetTop() + output_offset, value); |
827 output_[frame_index]->SetFrameSlot(output_offset, kPlaceholder); | 830 output_[frame_index]->SetFrameSlot(output_offset, kPlaceholder); |
828 return; | 831 return; |
(...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1659 | 1662 |
1660 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { | 1663 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { |
1661 v->VisitPointer(BitCast<Object**>(&function_)); | 1664 v->VisitPointer(BitCast<Object**>(&function_)); |
1662 v->VisitPointers(parameters_, parameters_ + parameters_count_); | 1665 v->VisitPointers(parameters_, parameters_ + parameters_count_); |
1663 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); | 1666 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); |
1664 } | 1667 } |
1665 | 1668 |
1666 #endif // ENABLE_DEBUGGER_SUPPORT | 1669 #endif // ENABLE_DEBUGGER_SUPPORT |
1667 | 1670 |
1668 } } // namespace v8::internal | 1671 } } // namespace v8::internal |
OLD | NEW |