| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 |
| 11 // with the distribution. | 11 // with the distribution. |
| (...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 793 } | 793 } |
| 794 } | 794 } |
| 795 } | 795 } |
| 796 | 796 |
| 797 | 797 |
| 798 void LAllocator::MeetConstraintsBetween(LInstruction* first, | 798 void LAllocator::MeetConstraintsBetween(LInstruction* first, |
| 799 LInstruction* second, | 799 LInstruction* second, |
| 800 int gap_index) { | 800 int gap_index) { |
| 801 // Handle fixed temporaries. | 801 // Handle fixed temporaries. |
| 802 if (first != NULL) { | 802 if (first != NULL) { |
| 803 for (TempIterator it(first); it.HasNext(); it.Advance()) { | 803 for (TempIterator it(first); !it.Done(); it.Advance()) { |
| 804 LUnallocated* temp = LUnallocated::cast(it.Next()); | 804 LUnallocated* temp = LUnallocated::cast(it.Current()); |
| 805 if (temp->HasFixedPolicy()) { | 805 if (temp->HasFixedPolicy()) { |
| 806 AllocateFixed(temp, gap_index - 1, false); | 806 AllocateFixed(temp, gap_index - 1, false); |
| 807 } | 807 } |
| 808 } | 808 } |
| 809 } | 809 } |
| 810 | 810 |
| 811 // Handle fixed output operand. | 811 // Handle fixed output operand. |
| 812 if (first != NULL && first->Output() != NULL) { | 812 if (first != NULL && first->Output() != NULL) { |
| 813 LUnallocated* first_output = LUnallocated::cast(first->Output()); | 813 LUnallocated* first_output = LUnallocated::cast(first->Output()); |
| 814 LiveRange* range = LiveRangeFor(first_output->VirtualRegister()); | 814 LiveRange* range = LiveRangeFor(first_output->VirtualRegister()); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 835 // Thus it should be inserted to a lifetime position corresponding to | 835 // Thus it should be inserted to a lifetime position corresponding to |
| 836 // the instruction end. | 836 // the instruction end. |
| 837 LGap* gap = GapAt(gap_index); | 837 LGap* gap = GapAt(gap_index); |
| 838 LParallelMove* move = gap->GetOrCreateParallelMove(LGap::BEFORE); | 838 LParallelMove* move = gap->GetOrCreateParallelMove(LGap::BEFORE); |
| 839 move->AddMove(first_output, range->GetSpillOperand()); | 839 move->AddMove(first_output, range->GetSpillOperand()); |
| 840 } | 840 } |
| 841 } | 841 } |
| 842 | 842 |
| 843 // Handle fixed input operands of second instruction. | 843 // Handle fixed input operands of second instruction. |
| 844 if (second != NULL) { | 844 if (second != NULL) { |
| 845 for (UseIterator it(second); it.HasNext(); it.Advance()) { | 845 for (UseIterator it(second); !it.Done(); it.Advance()) { |
| 846 LUnallocated* cur_input = LUnallocated::cast(it.Next()); | 846 LUnallocated* cur_input = LUnallocated::cast(it.Current()); |
| 847 if (cur_input->HasFixedPolicy()) { | 847 if (cur_input->HasFixedPolicy()) { |
| 848 LUnallocated* input_copy = cur_input->CopyUnconstrained(); | 848 LUnallocated* input_copy = cur_input->CopyUnconstrained(); |
| 849 bool is_tagged = HasTaggedValue(cur_input->VirtualRegister()); | 849 bool is_tagged = HasTaggedValue(cur_input->VirtualRegister()); |
| 850 AllocateFixed(cur_input, gap_index + 1, is_tagged); | 850 AllocateFixed(cur_input, gap_index + 1, is_tagged); |
| 851 AddConstraintsGapMove(gap_index, input_copy, cur_input); | 851 AddConstraintsGapMove(gap_index, input_copy, cur_input); |
| 852 } else if (cur_input->policy() == LUnallocated::WRITABLE_REGISTER) { | 852 } else if (cur_input->policy() == LUnallocated::WRITABLE_REGISTER) { |
| 853 // The live range of writable input registers always goes until the end | 853 // The live range of writable input registers always goes until the end |
| 854 // of the instruction. | 854 // of the instruction. |
| 855 ASSERT(!cur_input->IsUsedAtStart()); | 855 ASSERT(!cur_input->IsUsedAtStart()); |
| 856 | 856 |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 971 for (int i = 0; i < DoubleRegister::kNumAllocatableRegisters; ++i) { | 971 for (int i = 0; i < DoubleRegister::kNumAllocatableRegisters; ++i) { |
| 972 if (output == NULL || !output->IsDoubleRegister() || | 972 if (output == NULL || !output->IsDoubleRegister() || |
| 973 output->index() != i) { | 973 output->index() != i) { |
| 974 LiveRange* range = FixedDoubleLiveRangeFor(i); | 974 LiveRange* range = FixedDoubleLiveRangeFor(i); |
| 975 range->AddUseInterval(curr_position, | 975 range->AddUseInterval(curr_position, |
| 976 curr_position.InstructionEnd()); | 976 curr_position.InstructionEnd()); |
| 977 } | 977 } |
| 978 } | 978 } |
| 979 } | 979 } |
| 980 | 980 |
| 981 for (UseIterator it(instr); it.HasNext(); it.Advance()) { | 981 for (UseIterator it(instr); !it.Done(); it.Advance()) { |
| 982 LOperand* input = it.Next(); | 982 LOperand* input = it.Current(); |
| 983 | 983 |
| 984 LifetimePosition use_pos; | 984 LifetimePosition use_pos; |
| 985 if (input->IsUnallocated() && | 985 if (input->IsUnallocated() && |
| 986 LUnallocated::cast(input)->IsUsedAtStart()) { | 986 LUnallocated::cast(input)->IsUsedAtStart()) { |
| 987 use_pos = curr_position; | 987 use_pos = curr_position; |
| 988 } else { | 988 } else { |
| 989 use_pos = curr_position.InstructionEnd(); | 989 use_pos = curr_position.InstructionEnd(); |
| 990 } | 990 } |
| 991 | 991 |
| 992 Use(block_start_position, use_pos, input, NULL); | 992 Use(block_start_position, use_pos, input, NULL); |
| 993 if (input->IsUnallocated()) live->Add(input->VirtualRegister()); | 993 if (input->IsUnallocated()) live->Add(input->VirtualRegister()); |
| 994 } | 994 } |
| 995 | 995 |
| 996 for (TempIterator it(instr); it.HasNext(); it.Advance()) { | 996 for (TempIterator it(instr); !it.Done(); it.Advance()) { |
| 997 LOperand* temp = it.Next(); | 997 LOperand* temp = it.Current(); |
| 998 if (instr->IsMarkedAsCall()) { | 998 if (instr->IsMarkedAsCall()) { |
| 999 if (temp->IsRegister()) continue; | 999 if (temp->IsRegister()) continue; |
| 1000 if (temp->IsUnallocated()) { | 1000 if (temp->IsUnallocated()) { |
| 1001 LUnallocated* temp_unalloc = LUnallocated::cast(temp); | 1001 LUnallocated* temp_unalloc = LUnallocated::cast(temp); |
| 1002 if (temp_unalloc->HasFixedPolicy()) { | 1002 if (temp_unalloc->HasFixedPolicy()) { |
| 1003 continue; | 1003 continue; |
| 1004 } | 1004 } |
| 1005 } | 1005 } |
| 1006 } | 1006 } |
| 1007 Use(block_start_position, curr_position.InstructionEnd(), temp, NULL); | 1007 Use(block_start_position, curr_position.InstructionEnd(), temp, NULL); |
| (...skipping 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2124 LiveRange* current = live_ranges()->at(i); | 2124 LiveRange* current = live_ranges()->at(i); |
| 2125 if (current != NULL) current->Verify(); | 2125 if (current != NULL) current->Verify(); |
| 2126 } | 2126 } |
| 2127 } | 2127 } |
| 2128 | 2128 |
| 2129 | 2129 |
| 2130 #endif | 2130 #endif |
| 2131 | 2131 |
| 2132 | 2132 |
| 2133 } } // namespace v8::internal | 2133 } } // namespace v8::internal |
| OLD | NEW |