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 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1040 // Thus we need to manually record a pointer. | 1040 // Thus we need to manually record a pointer. |
1041 if (phi->representation().IsTagged()) { | 1041 if (phi->representation().IsTagged()) { |
1042 LInstruction* branch = | 1042 LInstruction* branch = |
1043 InstructionAt(cur_block->last_instruction_index()); | 1043 InstructionAt(cur_block->last_instruction_index()); |
1044 if (branch->HasPointerMap()) { | 1044 if (branch->HasPointerMap()) { |
1045 branch->pointer_map()->RecordPointer(phi_operand); | 1045 branch->pointer_map()->RecordPointer(phi_operand); |
1046 } | 1046 } |
1047 } | 1047 } |
1048 } | 1048 } |
1049 | 1049 |
1050 // Insert spill-move in the first section of the first gap. | |
1051 LiveRange* live_range = LiveRangeFor(phi->id()); | 1050 LiveRange* live_range = LiveRangeFor(phi->id()); |
1052 LGap* gap = chunk_->GetFirstGap(phi->block()); | 1051 LLabel* label = chunk_->GetLabel(phi->block()->block_id()); |
1053 gap->GetOrCreateParallelMove(LGap::BEFORE)-> | 1052 label->GetOrCreateParallelMove(LGap::START)-> |
1054 AddMove(phi_operand, live_range->GetSpillOperand()); | 1053 AddMove(phi_operand, live_range->GetSpillOperand()); |
1055 live_range->SetSpillStartIndex(phi->block()->first_instruction_index()); | 1054 live_range->SetSpillStartIndex(phi->block()->first_instruction_index()); |
1056 } | 1055 } |
1057 } | 1056 } |
1058 | 1057 |
1059 | 1058 |
1060 void LAllocator::Allocate(LChunk* chunk) { | 1059 void LAllocator::Allocate(LChunk* chunk) { |
1061 ASSERT(chunk_ == NULL); | 1060 ASSERT(chunk_ == NULL); |
1062 chunk_ = chunk; | 1061 chunk_ = chunk; |
1063 MeetRegisterConstraints(); | 1062 MeetRegisterConstraints(); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1116 } | 1115 } |
1117 cur_range = cur_range->next(); | 1116 cur_range = cur_range->next(); |
1118 } | 1117 } |
1119 | 1118 |
1120 if (cur_cover->IsSpilled()) return; | 1119 if (cur_cover->IsSpilled()) return; |
1121 ASSERT(pred_cover != NULL && cur_cover != NULL); | 1120 ASSERT(pred_cover != NULL && cur_cover != NULL); |
1122 if (pred_cover != cur_cover) { | 1121 if (pred_cover != cur_cover) { |
1123 LOperand* pred_op = pred_cover->CreateAssignedOperand(); | 1122 LOperand* pred_op = pred_cover->CreateAssignedOperand(); |
1124 LOperand* cur_op = cur_cover->CreateAssignedOperand(); | 1123 LOperand* cur_op = cur_cover->CreateAssignedOperand(); |
1125 if (!pred_op->Equals(cur_op)) { | 1124 if (!pred_op->Equals(cur_op)) { |
| 1125 LGap* gap = NULL; |
1126 if (block->predecessors()->length() == 1) { | 1126 if (block->predecessors()->length() == 1) { |
1127 LGap* gap = chunk_->GetFirstGap(block); | 1127 gap = GapAt(block->first_instruction_index()); |
1128 gap->GetOrCreateParallelMove(LGap::BEFORE)->AddMove(pred_op, cur_op); | |
1129 } else { | 1128 } else { |
1130 ASSERT(pred->end()->SecondSuccessor() == NULL); | 1129 ASSERT(pred->end()->SecondSuccessor() == NULL); |
1131 LGap* gap = GetLastGap(pred); | 1130 gap = GetLastGap(pred); |
1132 | 1131 |
1133 // We are going to insert a move before the branch instruction. | 1132 // We are going to insert a move before the branch instruction. |
1134 // Some branch instructions (e.g. loops' back edges) | 1133 // Some branch instructions (e.g. loops' back edges) |
1135 // can potentially cause a GC so they have a pointer map. | 1134 // can potentially cause a GC so they have a pointer map. |
1136 // By inserting a move we essentially create a copy of a | 1135 // By inserting a move we essentially create a copy of a |
1137 // value which is invisible to PopulatePointerMaps(), because we store | 1136 // value which is invisible to PopulatePointerMaps(), because we store |
1138 // it into a location different from the operand of a live range | 1137 // it into a location different from the operand of a live range |
1139 // covering a branch instruction. | 1138 // covering a branch instruction. |
1140 // Thus we need to manually record a pointer. | 1139 // Thus we need to manually record a pointer. |
1141 if (HasTaggedValue(range->id())) { | 1140 if (HasTaggedValue(range->id())) { |
1142 LInstruction* branch = InstructionAt(pred->last_instruction_index()); | 1141 LInstruction* branch = InstructionAt(pred->last_instruction_index()); |
1143 if (branch->HasPointerMap()) { | 1142 if (branch->HasPointerMap()) { |
1144 branch->pointer_map()->RecordPointer(cur_op); | 1143 branch->pointer_map()->RecordPointer(cur_op); |
1145 } | 1144 } |
1146 } | 1145 } |
1147 gap->GetOrCreateParallelMove(LGap::START)->AddMove(pred_op, cur_op); | |
1148 } | 1146 } |
| 1147 gap->GetOrCreateParallelMove(LGap::START)->AddMove(pred_op, cur_op); |
1149 } | 1148 } |
1150 } | 1149 } |
1151 } | 1150 } |
1152 | 1151 |
1153 | 1152 |
1154 LParallelMove* LAllocator::GetConnectingParallelMove(LifetimePosition pos) { | 1153 LParallelMove* LAllocator::GetConnectingParallelMove(LifetimePosition pos) { |
1155 int index = pos.InstructionIndex(); | 1154 int index = pos.InstructionIndex(); |
1156 if (IsGapAt(index)) { | 1155 if (IsGapAt(index)) { |
1157 LGap* gap = GapAt(index); | 1156 LGap* gap = GapAt(index); |
1158 return gap->GetOrCreateParallelMove( | 1157 return gap->GetOrCreateParallelMove( |
(...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2113 LiveRange* current = live_ranges()->at(i); | 2112 LiveRange* current = live_ranges()->at(i); |
2114 if (current != NULL) current->Verify(); | 2113 if (current != NULL) current->Verify(); |
2115 } | 2114 } |
2116 } | 2115 } |
2117 | 2116 |
2118 | 2117 |
2119 #endif | 2118 #endif |
2120 | 2119 |
2121 | 2120 |
2122 } } // namespace v8::internal | 2121 } } // namespace v8::internal |
OLD | NEW |