Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(755)

Side by Side Diff: src/lithium-allocator.cc

Issue 6263005: Change the algorithm and generated code for parallel moves on IA32. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge/build/ia32
Patch Set: Fix compilation on all platforms. Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 727 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 738
739 void LAllocator::AddConstraintsGapMove(int index, 739 void LAllocator::AddConstraintsGapMove(int index,
740 LOperand* from, 740 LOperand* from,
741 LOperand* to) { 741 LOperand* to) {
742 LGap* gap = chunk_->GetGapAt(index); 742 LGap* gap = chunk_->GetGapAt(index);
743 LParallelMove* move = gap->GetOrCreateParallelMove(LGap::START); 743 LParallelMove* move = gap->GetOrCreateParallelMove(LGap::START);
744 if (from->IsUnallocated()) { 744 if (from->IsUnallocated()) {
745 const ZoneList<LMoveOperands>* move_operands = move->move_operands(); 745 const ZoneList<LMoveOperands>* move_operands = move->move_operands();
746 for (int i = 0; i < move_operands->length(); ++i) { 746 for (int i = 0; i < move_operands->length(); ++i) {
747 LMoveOperands cur = move_operands->at(i); 747 LMoveOperands cur = move_operands->at(i);
748 LOperand* cur_to = cur.to(); 748 LOperand* cur_to = cur.destination();
749 if (cur_to->IsUnallocated()) { 749 if (cur_to->IsUnallocated()) {
750 if (cur_to->VirtualRegister() == from->VirtualRegister()) { 750 if (cur_to->VirtualRegister() == from->VirtualRegister()) {
751 move->AddMove(cur.from(), to); 751 move->AddMove(cur.source(), to);
752 return; 752 return;
753 } 753 }
754 } 754 }
755 } 755 }
756 } 756 }
757 move->AddMove(from, to); 757 move->AddMove(from, to);
758 } 758 }
759 759
760 760
761 void LAllocator::MeetRegisterConstraints(HBasicBlock* block) { 761 void LAllocator::MeetRegisterConstraints(HBasicBlock* block) {
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 LifetimePosition::FromInstructionIndex(index); 886 LifetimePosition::FromInstructionIndex(index);
887 887
888 if (chunk_->IsGapAt(index)) { 888 if (chunk_->IsGapAt(index)) {
889 // We have a gap at this position. 889 // We have a gap at this position.
890 LGap* gap = chunk_->GetGapAt(index); 890 LGap* gap = chunk_->GetGapAt(index);
891 LParallelMove* move = gap->GetOrCreateParallelMove(LGap::START); 891 LParallelMove* move = gap->GetOrCreateParallelMove(LGap::START);
892 const ZoneList<LMoveOperands>* move_operands = move->move_operands(); 892 const ZoneList<LMoveOperands>* move_operands = move->move_operands();
893 for (int i = 0; i < move_operands->length(); ++i) { 893 for (int i = 0; i < move_operands->length(); ++i) {
894 LMoveOperands* cur = &move_operands->at(i); 894 LMoveOperands* cur = &move_operands->at(i);
895 if (cur->IsIgnored()) continue; 895 if (cur->IsIgnored()) continue;
896 LOperand* from = cur->from(); 896 LOperand* from = cur->source();
897 LOperand* to = cur->to(); 897 LOperand* to = cur->destination();
898 HPhi* phi = LookupPhi(to); 898 HPhi* phi = LookupPhi(to);
899 LOperand* hint = to; 899 LOperand* hint = to;
900 if (phi != NULL) { 900 if (phi != NULL) {
901 // This is a phi resolving move. 901 // This is a phi resolving move.
902 if (!phi->block()->IsLoopHeader()) { 902 if (!phi->block()->IsLoopHeader()) {
903 hint = LiveRangeFor(phi->id())->FirstHint(); 903 hint = LiveRangeFor(phi->id())->FirstHint();
904 } 904 }
905 } else { 905 } else {
906 if (to->IsUnallocated()) { 906 if (to->IsUnallocated()) {
907 if (live->Contains(to->VirtualRegister())) { 907 if (live->Contains(to->VirtualRegister())) {
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
1207 // The live range interval already ends at the first instruction of the 1207 // The live range interval already ends at the first instruction of the
1208 // block. 1208 // block.
1209 HPhi* phi = phis->at(i); 1209 HPhi* phi = phis->at(i);
1210 live->Remove(phi->id()); 1210 live->Remove(phi->id());
1211 1211
1212 LOperand* hint = NULL; 1212 LOperand* hint = NULL;
1213 LOperand* phi_operand = NULL; 1213 LOperand* phi_operand = NULL;
1214 LGap* gap = GetLastGap(phi->block()->predecessors()->at(0)); 1214 LGap* gap = GetLastGap(phi->block()->predecessors()->at(0));
1215 LParallelMove* move = gap->GetOrCreateParallelMove(LGap::START); 1215 LParallelMove* move = gap->GetOrCreateParallelMove(LGap::START);
1216 for (int j = 0; j < move->move_operands()->length(); ++j) { 1216 for (int j = 0; j < move->move_operands()->length(); ++j) {
1217 LOperand* to = move->move_operands()->at(j).to(); 1217 LOperand* to = move->move_operands()->at(j).destination();
1218 if (to->IsUnallocated() && to->VirtualRegister() == phi->id()) { 1218 if (to->IsUnallocated() && to->VirtualRegister() == phi->id()) {
1219 hint = move->move_operands()->at(j).from(); 1219 hint = move->move_operands()->at(j).source();
1220 phi_operand = to; 1220 phi_operand = to;
1221 break; 1221 break;
1222 } 1222 }
1223 } 1223 }
1224 ASSERT(hint != NULL); 1224 ASSERT(hint != NULL);
1225 1225
1226 LifetimePosition block_start = LifetimePosition::FromInstructionIndex( 1226 LifetimePosition block_start = LifetimePosition::FromInstructionIndex(
1227 block->first_instruction_index()); 1227 block->first_instruction_index());
1228 Define(block_start, phi_operand, hint); 1228 Define(block_start, phi_operand, hint);
1229 } 1229 }
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after
2145 LiveRange* current = live_ranges()->at(i); 2145 LiveRange* current = live_ranges()->at(i);
2146 if (current != NULL) current->Verify(); 2146 if (current != NULL) current->Verify();
2147 } 2147 }
2148 } 2148 }
2149 2149
2150 2150
2151 #endif 2151 #endif
2152 2152
2153 2153
2154 } } // namespace v8::internal 2154 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698