| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 switch (opcode) { | 666 switch (opcode) { |
| 667 case Translation::BEGIN: | 667 case Translation::BEGIN: |
| 668 case Translation::FRAME: | 668 case Translation::FRAME: |
| 669 case Translation::DUPLICATE: | 669 case Translation::DUPLICATE: |
| 670 UNREACHABLE(); // Malformed input. | 670 UNREACHABLE(); // Malformed input. |
| 671 return false; | 671 return false; |
| 672 | 672 |
| 673 case Translation::REGISTER: { | 673 case Translation::REGISTER: { |
| 674 int output_reg = iterator->Next(); | 674 int output_reg = iterator->Next(); |
| 675 if (FLAG_trace_osr) { | 675 if (FLAG_trace_osr) { |
| 676 PrintF(" %s <- 0x%08" V8PRIxPTR " ; [esp + %d]\n", | 676 PrintF(" %s <- 0x%08" V8PRIxPTR " ; [sp + %d]\n", |
| 677 converter.NameOfCPURegister(output_reg), | 677 converter.NameOfCPURegister(output_reg), |
| 678 input_value, | 678 input_value, |
| 679 *input_offset); | 679 *input_offset); |
| 680 } | 680 } |
| 681 output->SetRegister(output_reg, input_value); | 681 output->SetRegister(output_reg, input_value); |
| 682 break; | 682 break; |
| 683 } | 683 } |
| 684 | 684 |
| 685 case Translation::INT32_REGISTER: { | 685 case Translation::INT32_REGISTER: { |
| 686 // Abort OSR if we don't have a number. | 686 // Abort OSR if we don't have a number. |
| 687 if (!input_object->IsNumber()) return false; | 687 if (!input_object->IsNumber()) return false; |
| 688 | 688 |
| 689 int output_reg = iterator->Next(); | 689 int output_reg = iterator->Next(); |
| 690 int int32_value = input_object->IsSmi() | 690 int int32_value = input_object->IsSmi() |
| 691 ? Smi::cast(input_object)->value() | 691 ? Smi::cast(input_object)->value() |
| 692 : FastD2I(input_object->Number()); | 692 : FastD2I(input_object->Number()); |
| 693 // Abort the translation if the conversion lost information. | 693 // Abort the translation if the conversion lost information. |
| 694 if (!input_object->IsSmi() && | 694 if (!input_object->IsSmi() && |
| 695 FastI2D(int32_value) != input_object->Number()) { | 695 FastI2D(int32_value) != input_object->Number()) { |
| 696 if (FLAG_trace_osr) { | 696 if (FLAG_trace_osr) { |
| 697 PrintF("**** %g could not be converted to int32 ****\n", | 697 PrintF("**** %g could not be converted to int32 ****\n", |
| 698 input_object->Number()); | 698 input_object->Number()); |
| 699 } | 699 } |
| 700 return false; | 700 return false; |
| 701 } | 701 } |
| 702 if (FLAG_trace_osr) { | 702 if (FLAG_trace_osr) { |
| 703 PrintF(" %s <- %d (int32) ; [esp + %d]\n", | 703 PrintF(" %s <- %d (int32) ; [sp + %d]\n", |
| 704 converter.NameOfCPURegister(output_reg), | 704 converter.NameOfCPURegister(output_reg), |
| 705 int32_value, | 705 int32_value, |
| 706 *input_offset); | 706 *input_offset); |
| 707 } | 707 } |
| 708 output->SetRegister(output_reg, int32_value); | 708 output->SetRegister(output_reg, int32_value); |
| 709 break; | 709 break; |
| 710 } | 710 } |
| 711 | 711 |
| 712 case Translation::DOUBLE_REGISTER: { | 712 case Translation::DOUBLE_REGISTER: { |
| 713 // Abort OSR if we don't have a number. | 713 // Abort OSR if we don't have a number. |
| 714 if (!input_object->IsNumber()) return false; | 714 if (!input_object->IsNumber()) return false; |
| 715 | 715 |
| 716 int output_reg = iterator->Next(); | 716 int output_reg = iterator->Next(); |
| 717 double double_value = input_object->Number(); | 717 double double_value = input_object->Number(); |
| 718 if (FLAG_trace_osr) { | 718 if (FLAG_trace_osr) { |
| 719 PrintF(" %s <- %g (double) ; [esp + %d]\n", | 719 PrintF(" %s <- %g (double) ; [sp + %d]\n", |
| 720 DoubleRegister::AllocationIndexToString(output_reg), | 720 DoubleRegister::AllocationIndexToString(output_reg), |
| 721 double_value, | 721 double_value, |
| 722 *input_offset); | 722 *input_offset); |
| 723 } | 723 } |
| 724 output->SetDoubleRegister(output_reg, double_value); | 724 output->SetDoubleRegister(output_reg, double_value); |
| 725 break; | 725 break; |
| 726 } | 726 } |
| 727 | 727 |
| 728 case Translation::STACK_SLOT: { | 728 case Translation::STACK_SLOT: { |
| 729 int output_index = iterator->Next(); | 729 int output_index = iterator->Next(); |
| 730 unsigned output_offset = | 730 unsigned output_offset = |
| 731 output->GetOffsetFromSlotIndex(this, output_index); | 731 output->GetOffsetFromSlotIndex(this, output_index); |
| 732 if (FLAG_trace_osr) { | 732 if (FLAG_trace_osr) { |
| 733 PrintF(" [esp + %d] <- 0x%08" V8PRIxPTR " ; [esp + %d]\n", | 733 PrintF(" [sp + %d] <- 0x%08" V8PRIxPTR " ; [sp + %d]\n", |
| 734 output_offset, | 734 output_offset, |
| 735 input_value, | 735 input_value, |
| 736 *input_offset); | 736 *input_offset); |
| 737 } | 737 } |
| 738 output->SetFrameSlot(output_offset, input_value); | 738 output->SetFrameSlot(output_offset, input_value); |
| 739 break; | 739 break; |
| 740 } | 740 } |
| 741 | 741 |
| 742 case Translation::INT32_STACK_SLOT: { | 742 case Translation::INT32_STACK_SLOT: { |
| 743 // Abort OSR if we don't have a number. | 743 // Abort OSR if we don't have a number. |
| 744 if (!input_object->IsNumber()) return false; | 744 if (!input_object->IsNumber()) return false; |
| 745 | 745 |
| 746 int output_index = iterator->Next(); | 746 int output_index = iterator->Next(); |
| 747 unsigned output_offset = | 747 unsigned output_offset = |
| 748 output->GetOffsetFromSlotIndex(this, output_index); | 748 output->GetOffsetFromSlotIndex(this, output_index); |
| 749 int int32_value = input_object->IsSmi() | 749 int int32_value = input_object->IsSmi() |
| 750 ? Smi::cast(input_object)->value() | 750 ? Smi::cast(input_object)->value() |
| 751 : DoubleToInt32(input_object->Number()); | 751 : DoubleToInt32(input_object->Number()); |
| 752 // Abort the translation if the conversion lost information. | 752 // Abort the translation if the conversion lost information. |
| 753 if (!input_object->IsSmi() && | 753 if (!input_object->IsSmi() && |
| 754 FastI2D(int32_value) != input_object->Number()) { | 754 FastI2D(int32_value) != input_object->Number()) { |
| 755 if (FLAG_trace_osr) { | 755 if (FLAG_trace_osr) { |
| 756 PrintF("**** %g could not be converted to int32 ****\n", | 756 PrintF("**** %g could not be converted to int32 ****\n", |
| 757 input_object->Number()); | 757 input_object->Number()); |
| 758 } | 758 } |
| 759 return false; | 759 return false; |
| 760 } | 760 } |
| 761 if (FLAG_trace_osr) { | 761 if (FLAG_trace_osr) { |
| 762 PrintF(" [esp + %d] <- %d (int32) ; [esp + %d]\n", | 762 PrintF(" [sp + %d] <- %d (int32) ; [sp + %d]\n", |
| 763 output_offset, | 763 output_offset, |
| 764 int32_value, | 764 int32_value, |
| 765 *input_offset); | 765 *input_offset); |
| 766 } | 766 } |
| 767 output->SetFrameSlot(output_offset, int32_value); | 767 output->SetFrameSlot(output_offset, int32_value); |
| 768 break; | 768 break; |
| 769 } | 769 } |
| 770 | 770 |
| 771 case Translation::DOUBLE_STACK_SLOT: { | 771 case Translation::DOUBLE_STACK_SLOT: { |
| 772 static const int kLowerOffset = 0 * kPointerSize; | 772 static const int kLowerOffset = 0 * kPointerSize; |
| 773 static const int kUpperOffset = 1 * kPointerSize; | 773 static const int kUpperOffset = 1 * kPointerSize; |
| 774 | 774 |
| 775 // Abort OSR if we don't have a number. | 775 // Abort OSR if we don't have a number. |
| 776 if (!input_object->IsNumber()) return false; | 776 if (!input_object->IsNumber()) return false; |
| 777 | 777 |
| 778 int output_index = iterator->Next(); | 778 int output_index = iterator->Next(); |
| 779 unsigned output_offset = | 779 unsigned output_offset = |
| 780 output->GetOffsetFromSlotIndex(this, output_index); | 780 output->GetOffsetFromSlotIndex(this, output_index); |
| 781 double double_value = input_object->Number(); | 781 double double_value = input_object->Number(); |
| 782 uint64_t int_value = BitCast<uint64_t, double>(double_value); | 782 uint64_t int_value = BitCast<uint64_t, double>(double_value); |
| 783 int32_t lower = static_cast<int32_t>(int_value); | 783 int32_t lower = static_cast<int32_t>(int_value); |
| 784 int32_t upper = static_cast<int32_t>(int_value >> kBitsPerInt); | 784 int32_t upper = static_cast<int32_t>(int_value >> kBitsPerInt); |
| 785 if (FLAG_trace_osr) { | 785 if (FLAG_trace_osr) { |
| 786 PrintF(" [esp + %d] <- 0x%08x (upper bits of %g) ; [esp + %d]\n", | 786 PrintF(" [sp + %d] <- 0x%08x (upper bits of %g) ; [sp + %d]\n", |
| 787 output_offset + kUpperOffset, | 787 output_offset + kUpperOffset, |
| 788 upper, | 788 upper, |
| 789 double_value, | 789 double_value, |
| 790 *input_offset); | 790 *input_offset); |
| 791 PrintF(" [esp + %d] <- 0x%08x (lower bits of %g) ; [esp + %d]\n", | 791 PrintF(" [sp + %d] <- 0x%08x (lower bits of %g) ; [sp + %d]\n", |
| 792 output_offset + kLowerOffset, | 792 output_offset + kLowerOffset, |
| 793 lower, | 793 lower, |
| 794 double_value, | 794 double_value, |
| 795 *input_offset); | 795 *input_offset); |
| 796 } | 796 } |
| 797 output->SetFrameSlot(output_offset + kLowerOffset, lower); | 797 output->SetFrameSlot(output_offset + kLowerOffset, lower); |
| 798 output->SetFrameSlot(output_offset + kUpperOffset, upper); | 798 output->SetFrameSlot(output_offset + kUpperOffset, upper); |
| 799 break; | 799 break; |
| 800 } | 800 } |
| 801 | 801 |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1196 } | 1196 } |
| 1197 | 1197 |
| 1198 | 1198 |
| 1199 DeoptimizingCodeListNode::~DeoptimizingCodeListNode() { | 1199 DeoptimizingCodeListNode::~DeoptimizingCodeListNode() { |
| 1200 GlobalHandles* global_handles = Isolate::Current()->global_handles(); | 1200 GlobalHandles* global_handles = Isolate::Current()->global_handles(); |
| 1201 global_handles->Destroy(reinterpret_cast<Object**>(code_.location())); | 1201 global_handles->Destroy(reinterpret_cast<Object**>(code_.location())); |
| 1202 } | 1202 } |
| 1203 | 1203 |
| 1204 | 1204 |
| 1205 } } // namespace v8::internal | 1205 } } // namespace v8::internal |
| OLD | NEW |