| 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/compiler/gap-resolver.h" | 5 #include "src/compiler/gap-resolver.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 std::bind2nd(std::ptr_fun(&Blocks), destination)); | 87 std::bind2nd(std::ptr_fun(&Blocks), destination)); |
| 88 if (blocker == moves->end()) { | 88 if (blocker == moves->end()) { |
| 89 // The easy case: This move is not blocked. | 89 // The easy case: This move is not blocked. |
| 90 assembler_->AssembleMove(&source, &destination); | 90 assembler_->AssembleMove(&source, &destination); |
| 91 move->Eliminate(); | 91 move->Eliminate(); |
| 92 return; | 92 return; |
| 93 } | 93 } |
| 94 | 94 |
| 95 DCHECK((*blocker)->IsPending()); | 95 DCHECK((*blocker)->IsPending()); |
| 96 // Ensure source is a register or both are stack slots, to limit swap cases. | 96 // Ensure source is a register or both are stack slots, to limit swap cases. |
| 97 if (source.IsStackSlot() || source.IsDoubleStackSlot()) { | 97 if (source.IsStackSlot() || source.IsFPStackSlot()) { |
| 98 std::swap(source, destination); | 98 std::swap(source, destination); |
| 99 } | 99 } |
| 100 assembler_->AssembleSwap(&source, &destination); | 100 assembler_->AssembleSwap(&source, &destination); |
| 101 move->Eliminate(); | 101 move->Eliminate(); |
| 102 | 102 |
| 103 // Any unperformed (including pending) move with a source of either this | 103 // Any unperformed (including pending) move with a source of either this |
| 104 // move's source or destination needs to have their source changed to | 104 // move's source or destination needs to have their source changed to |
| 105 // reflect the state of affairs after the swap. | 105 // reflect the state of affairs after the swap. |
| 106 for (MoveOperands* other : *moves) { | 106 for (MoveOperands* other : *moves) { |
| 107 if (other->Blocks(source)) { | 107 if (other->Blocks(source)) { |
| 108 other->set_source(destination); | 108 other->set_source(destination); |
| 109 } else if (other->Blocks(destination)) { | 109 } else if (other->Blocks(destination)) { |
| 110 other->set_source(source); | 110 other->set_source(source); |
| 111 } | 111 } |
| 112 } | 112 } |
| 113 } | 113 } |
| 114 } // namespace compiler | 114 } // namespace compiler |
| 115 } // namespace internal | 115 } // namespace internal |
| 116 } // namespace v8 | 116 } // namespace v8 |
| OLD | NEW |