| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/bit-vector.h" | 5 #include "src/bit-vector.h" |
| 6 #include "src/compiler/instruction.h" | 6 #include "src/compiler/instruction.h" |
| 7 #include "src/compiler/register-allocator-verifier.h" | 7 #include "src/compiler/register-allocator-verifier.h" |
| 8 | 8 |
| 9 namespace v8 { | 9 namespace v8 { |
| 10 namespace internal { | 10 namespace internal { |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 constraint->type_ = kFixedDoubleRegister; | 155 constraint->type_ = kFixedDoubleRegister; |
| 156 constraint->value_ = unallocated->fixed_register_index(); | 156 constraint->value_ = unallocated->fixed_register_index(); |
| 157 break; | 157 break; |
| 158 case UnallocatedOperand::MUST_HAVE_REGISTER: | 158 case UnallocatedOperand::MUST_HAVE_REGISTER: |
| 159 if (sequence()->IsDouble(vreg)) { | 159 if (sequence()->IsDouble(vreg)) { |
| 160 constraint->type_ = kDoubleRegister; | 160 constraint->type_ = kDoubleRegister; |
| 161 } else { | 161 } else { |
| 162 constraint->type_ = kRegister; | 162 constraint->type_ = kRegister; |
| 163 } | 163 } |
| 164 break; | 164 break; |
| 165 case UnallocatedOperand::MUST_HAVE_SLOT: |
| 166 if (sequence()->IsDouble(vreg)) { |
| 167 constraint->type_ = kDoubleSlot; |
| 168 } else { |
| 169 constraint->type_ = kSlot; |
| 170 } |
| 171 break; |
| 165 case UnallocatedOperand::SAME_AS_FIRST_INPUT: | 172 case UnallocatedOperand::SAME_AS_FIRST_INPUT: |
| 166 constraint->type_ = kSameAsFirst; | 173 constraint->type_ = kSameAsFirst; |
| 167 break; | 174 break; |
| 168 } | 175 } |
| 169 } | 176 } |
| 170 } | 177 } |
| 171 } | 178 } |
| 172 | 179 |
| 173 | 180 |
| 174 void RegisterAllocatorVerifier::CheckConstraint( | 181 void RegisterAllocatorVerifier::CheckConstraint( |
| (...skipping 18 matching lines...) Expand all Loading... |
| 193 CHECK(op->IsDoubleRegister()); | 200 CHECK(op->IsDoubleRegister()); |
| 194 return; | 201 return; |
| 195 case kFixedDoubleRegister: | 202 case kFixedDoubleRegister: |
| 196 CHECK(op->IsDoubleRegister()); | 203 CHECK(op->IsDoubleRegister()); |
| 197 CHECK_EQ(op->index(), constraint->value_); | 204 CHECK_EQ(op->index(), constraint->value_); |
| 198 return; | 205 return; |
| 199 case kFixedSlot: | 206 case kFixedSlot: |
| 200 CHECK(op->IsStackSlot()); | 207 CHECK(op->IsStackSlot()); |
| 201 CHECK_EQ(op->index(), constraint->value_); | 208 CHECK_EQ(op->index(), constraint->value_); |
| 202 return; | 209 return; |
| 210 case kSlot: |
| 211 CHECK(op->IsStackSlot()); |
| 212 return; |
| 213 case kDoubleSlot: |
| 214 CHECK(op->IsDoubleStackSlot()); |
| 215 return; |
| 203 case kNone: | 216 case kNone: |
| 204 CHECK(op->IsRegister() || op->IsStackSlot()); | 217 CHECK(op->IsRegister() || op->IsStackSlot()); |
| 205 return; | 218 return; |
| 206 case kNoneDouble: | 219 case kNoneDouble: |
| 207 CHECK(op->IsDoubleRegister() || op->IsDoubleStackSlot()); | 220 CHECK(op->IsDoubleRegister() || op->IsDoubleStackSlot()); |
| 208 return; | 221 return; |
| 209 case kSameAsFirst: | 222 case kSameAsFirst: |
| 210 CHECK(false); | 223 CHECK(false); |
| 211 return; | 224 return; |
| 212 } | 225 } |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 Map& map() { return map_; } | 307 Map& map() { return map_; } |
| 295 | 308 |
| 296 void RunParallelMoves(Zone* zone, const ParallelMove* move) { | 309 void RunParallelMoves(Zone* zone, const ParallelMove* move) { |
| 297 // Compute outgoing mappings. | 310 // Compute outgoing mappings. |
| 298 Map to_insert(zone); | 311 Map to_insert(zone); |
| 299 auto moves = move->move_operands(); | 312 auto moves = move->move_operands(); |
| 300 for (auto i = moves->begin(); i != moves->end(); ++i) { | 313 for (auto i = moves->begin(); i != moves->end(); ++i) { |
| 301 if (i->IsEliminated()) continue; | 314 if (i->IsEliminated()) continue; |
| 302 auto cur = map().find(i->source()); | 315 auto cur = map().find(i->source()); |
| 303 CHECK(cur != map().end()); | 316 CHECK(cur != map().end()); |
| 304 to_insert.insert(std::make_pair(i->destination(), cur->second)); | 317 auto res = |
| 318 to_insert.insert(std::make_pair(i->destination(), cur->second)); |
| 319 // Ensure injectivity of moves. |
| 320 CHECK(res.second); |
| 305 } | 321 } |
| 306 // Drop current mappings. | 322 // Drop current mappings. |
| 307 for (auto i = moves->begin(); i != moves->end(); ++i) { | 323 for (auto i = moves->begin(); i != moves->end(); ++i) { |
| 308 if (i->IsEliminated()) continue; | 324 if (i->IsEliminated()) continue; |
| 309 auto cur = map().find(i->destination()); | 325 auto cur = map().find(i->destination()); |
| 310 if (cur != map().end()) map().erase(cur); | 326 if (cur != map().end()) map().erase(cur); |
| 311 } | 327 } |
| 312 // Insert new values. | 328 // Insert new values. |
| 313 map().insert(to_insert.begin(), to_insert.end()); | 329 map().insert(to_insert.begin(), to_insert.end()); |
| 314 } | 330 } |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 660 int virtual_register = op_constraints[count].virtual_register_; | 676 int virtual_register = op_constraints[count].virtual_register_; |
| 661 current->Define(zone(), instr->OutputAt(i), virtual_register); | 677 current->Define(zone(), instr->OutputAt(i), virtual_register); |
| 662 } | 678 } |
| 663 } | 679 } |
| 664 } | 680 } |
| 665 } | 681 } |
| 666 | 682 |
| 667 } // namespace compiler | 683 } // namespace compiler |
| 668 } // namespace internal | 684 } // namespace internal |
| 669 } // namespace v8 | 685 } // namespace v8 |
| OLD | NEW |