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 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 case ARGUMENTS_ADAPTOR: | 756 case ARGUMENTS_ADAPTOR: |
757 translation->BeginArgumentsAdaptorFrame(closure_id, translation_size); | 757 translation->BeginArgumentsAdaptorFrame(closure_id, translation_size); |
758 break; | 758 break; |
759 case STUB: | 759 case STUB: |
760 translation->BeginCompiledStubFrame(); | 760 translation->BeginCompiledStubFrame(); |
761 break; | 761 break; |
762 default: | 762 default: |
763 UNREACHABLE(); | 763 UNREACHABLE(); |
764 } | 764 } |
765 | 765 |
| 766 int object_index = 0; |
| 767 int dematerialized_index = 0; |
766 for (int i = 0; i < translation_size; ++i) { | 768 for (int i = 0; i < translation_size; ++i) { |
767 LOperand* value = environment->values()->at(i); | 769 LOperand* value = environment->values()->at(i); |
768 | 770 AddToTranslation(environment, |
769 // TODO(mstarzinger): Introduce marker operands to indicate that this value | 771 translation, |
770 // is not present and must be reconstructed from the deoptimizer. Currently | |
771 // this is only used for the arguments object. | |
772 if (value == NULL) { | |
773 int arguments_count = environment->values()->length() - translation_size; | |
774 translation->BeginArgumentsObject(arguments_count); | |
775 for (int i = 0; i < arguments_count; ++i) { | |
776 LOperand* value = environment->values()->at(translation_size + i); | |
777 AddToTranslation(translation, | |
778 value, | |
779 environment->HasTaggedValueAt(translation_size + i), | |
780 environment->HasUint32ValueAt(translation_size + i)); | |
781 } | |
782 continue; | |
783 } | |
784 | |
785 AddToTranslation(translation, | |
786 value, | 772 value, |
787 environment->HasTaggedValueAt(i), | 773 environment->HasTaggedValueAt(i), |
788 environment->HasUint32ValueAt(i)); | 774 environment->HasUint32ValueAt(i), |
| 775 &object_index, |
| 776 &dematerialized_index); |
789 } | 777 } |
790 } | 778 } |
791 | 779 |
792 | 780 |
793 void LCodeGen::AddToTranslation(Translation* translation, | 781 void LCodeGen::AddToTranslation(LEnvironment* environment, |
| 782 Translation* translation, |
794 LOperand* op, | 783 LOperand* op, |
795 bool is_tagged, | 784 bool is_tagged, |
796 bool is_uint32) { | 785 bool is_uint32, |
| 786 int* object_index_pointer, |
| 787 int* dematerialized_index_pointer) { |
| 788 if (op == LEnvironment::materialization_marker()) { |
| 789 int object_index = (*object_index_pointer)++; |
| 790 if (environment->ObjectIsDuplicateAt(object_index)) { |
| 791 int dupe_of = environment->ObjectDuplicateOfAt(object_index); |
| 792 translation->DuplicateObject(dupe_of); |
| 793 return; |
| 794 } |
| 795 int object_length = environment->ObjectLengthAt(object_index); |
| 796 if (environment->ObjectIsArgumentsAt(object_index)) { |
| 797 translation->BeginArgumentsObject(object_length); |
| 798 } else { |
| 799 translation->BeginCapturedObject(object_length); |
| 800 } |
| 801 int dematerialized_index = *dematerialized_index_pointer; |
| 802 int env_offset = environment->translation_size() + dematerialized_index; |
| 803 *dematerialized_index_pointer += object_length; |
| 804 for (int i = 0; i < object_length; ++i) { |
| 805 LOperand* value = environment->values()->at(env_offset + i); |
| 806 AddToTranslation(environment, |
| 807 translation, |
| 808 value, |
| 809 environment->HasTaggedValueAt(env_offset + i), |
| 810 environment->HasUint32ValueAt(env_offset + i), |
| 811 object_index_pointer, |
| 812 dematerialized_index_pointer); |
| 813 } |
| 814 return; |
| 815 } |
| 816 |
797 if (op->IsStackSlot()) { | 817 if (op->IsStackSlot()) { |
798 if (is_tagged) { | 818 if (is_tagged) { |
799 translation->StoreStackSlot(op->index()); | 819 translation->StoreStackSlot(op->index()); |
800 } else if (is_uint32) { | 820 } else if (is_uint32) { |
801 translation->StoreUint32StackSlot(op->index()); | 821 translation->StoreUint32StackSlot(op->index()); |
802 } else { | 822 } else { |
803 translation->StoreInt32StackSlot(op->index()); | 823 translation->StoreInt32StackSlot(op->index()); |
804 } | 824 } |
805 } else if (op->IsDoubleStackSlot()) { | 825 } else if (op->IsDoubleStackSlot()) { |
806 translation->StoreDoubleStackSlot(op->index()); | 826 translation->StoreDoubleStackSlot(op->index()); |
(...skipping 5723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6530 FixedArray::kHeaderSize - kPointerSize)); | 6550 FixedArray::kHeaderSize - kPointerSize)); |
6531 __ bind(&done); | 6551 __ bind(&done); |
6532 } | 6552 } |
6533 | 6553 |
6534 | 6554 |
6535 #undef __ | 6555 #undef __ |
6536 | 6556 |
6537 } } // namespace v8::internal | 6557 } } // namespace v8::internal |
6538 | 6558 |
6539 #endif // V8_TARGET_ARCH_IA32 | 6559 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |