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