| 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 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 if (use_pos->HasOperand()) { | 476 if (use_pos->HasOperand()) { |
| 477 ASSERT(op->IsRegister() || op->IsDoubleRegister() || | 477 ASSERT(op->IsRegister() || op->IsDoubleRegister() || |
| 478 !use_pos->RequiresRegister()); | 478 !use_pos->RequiresRegister()); |
| 479 use_pos->operand()->ConvertTo(op->kind(), op->index()); | 479 use_pos->operand()->ConvertTo(op->kind(), op->index()); |
| 480 } | 480 } |
| 481 use_pos = use_pos->next(); | 481 use_pos = use_pos->next(); |
| 482 } | 482 } |
| 483 } | 483 } |
| 484 | 484 |
| 485 | 485 |
| 486 UsePosition* LiveRange::AddUsePosition(LifetimePosition pos) { | |
| 487 return AddUsePosition(pos, CreateAssignedOperand()); | |
| 488 } | |
| 489 | |
| 490 | |
| 491 bool LiveRange::CanCover(LifetimePosition position) const { | 486 bool LiveRange::CanCover(LifetimePosition position) const { |
| 492 if (IsEmpty()) return false; | 487 if (IsEmpty()) return false; |
| 493 return Start().Value() <= position.Value() && | 488 return Start().Value() <= position.Value() && |
| 494 position.Value() < End().Value(); | 489 position.Value() < End().Value(); |
| 495 } | 490 } |
| 496 | 491 |
| 497 | 492 |
| 498 bool LiveRange::Covers(LifetimePosition position) { | 493 bool LiveRange::Covers(LifetimePosition position) { |
| 499 if (!CanCover(position)) return false; | 494 if (!CanCover(position)) return false; |
| 500 UseInterval* start_search = FirstSearchIntervalForPosition(position); | 495 UseInterval* start_search = FirstSearchIntervalForPosition(position); |
| (...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1096 if (pred_cover != cur_cover) { | 1091 if (pred_cover != cur_cover) { |
| 1097 LOperand* pred_op = pred_cover->CreateAssignedOperand(); | 1092 LOperand* pred_op = pred_cover->CreateAssignedOperand(); |
| 1098 LOperand* cur_op = cur_cover->CreateAssignedOperand(); | 1093 LOperand* cur_op = cur_cover->CreateAssignedOperand(); |
| 1099 if (!pred_op->Equals(cur_op)) { | 1094 if (!pred_op->Equals(cur_op)) { |
| 1100 LGap* gap = NULL; | 1095 LGap* gap = NULL; |
| 1101 if (block->predecessors()->length() == 1) { | 1096 if (block->predecessors()->length() == 1) { |
| 1102 gap = GapAt(block->first_instruction_index()); | 1097 gap = GapAt(block->first_instruction_index()); |
| 1103 } else { | 1098 } else { |
| 1104 ASSERT(pred->end()->SecondSuccessor() == NULL); | 1099 ASSERT(pred->end()->SecondSuccessor() == NULL); |
| 1105 gap = GetLastGap(pred); | 1100 gap = GetLastGap(pred); |
| 1101 |
| 1102 // We are going to insert a move before the branch instruction. |
| 1103 // Some branch instructions (e.g. loops' back edges) |
| 1104 // can potentially cause a GC so they have a pointer map. |
| 1105 // By insterting a move we essentially create a copy of a |
| 1106 // value which is invisible to PopulatePointerMaps(), because we store |
| 1107 // it into a location different from the operand of a live range |
| 1108 // covering a branch instruction. |
| 1109 // Thus we need to manually record a pointer. |
| 1110 if (HasTaggedValue(range->id())) { |
| 1111 LInstruction* branch = InstructionAt(pred->last_instruction_index()); |
| 1112 if (branch->HasPointerMap()) { |
| 1113 branch->pointer_map()->RecordPointer(cur_op); |
| 1114 } |
| 1115 } |
| 1106 } | 1116 } |
| 1107 gap->GetOrCreateParallelMove(LGap::START)->AddMove(pred_op, cur_op); | 1117 gap->GetOrCreateParallelMove(LGap::START)->AddMove(pred_op, cur_op); |
| 1108 } | 1118 } |
| 1109 } | 1119 } |
| 1110 } | 1120 } |
| 1111 | 1121 |
| 1112 | 1122 |
| 1113 LParallelMove* LAllocator::GetConnectingParallelMove(LifetimePosition pos) { | 1123 LParallelMove* LAllocator::GetConnectingParallelMove(LifetimePosition pos) { |
| 1114 int index = pos.InstructionIndex(); | 1124 int index = pos.InstructionIndex(); |
| 1115 if (IsGapAt(index)) { | 1125 if (IsGapAt(index)) { |
| (...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2070 LiveRange* current = live_ranges()->at(i); | 2080 LiveRange* current = live_ranges()->at(i); |
| 2071 if (current != NULL) current->Verify(); | 2081 if (current != NULL) current->Verify(); |
| 2072 } | 2082 } |
| 2073 } | 2083 } |
| 2074 | 2084 |
| 2075 | 2085 |
| 2076 #endif | 2086 #endif |
| 2077 | 2087 |
| 2078 | 2088 |
| 2079 } } // namespace v8::internal | 2089 } } // namespace v8::internal |
| OLD | NEW |