| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 } | 68 } |
| 69 } | 69 } |
| 70 | 70 |
| 71 // We are about to resolve this move and don't need it marked as pending, so | 71 // We are about to resolve this move and don't need it marked as pending, so |
| 72 // restore its destination. | 72 // restore its destination. |
| 73 move->set_destination(destination); | 73 move->set_destination(destination); |
| 74 | 74 |
| 75 // This move's source may have changed due to swaps to resolve cycles and so | 75 // This move's source may have changed due to swaps to resolve cycles and so |
| 76 // it may now be the last move in the cycle. If so remove it. | 76 // it may now be the last move in the cycle. If so remove it. |
| 77 InstructionOperand source = move->source(); | 77 InstructionOperand source = move->source(); |
| 78 if (source.EqualsModuloType(destination)) { | 78 if (source.EqualsCanonicalized(destination)) { |
| 79 move->Eliminate(); | 79 move->Eliminate(); |
| 80 return; | 80 return; |
| 81 } | 81 } |
| 82 | 82 |
| 83 // The move may be blocked on a (at most one) pending move, in which case we | 83 // The move may be blocked on a (at most one) pending move, in which case we |
| 84 // have a cycle. Search for such a blocking move and perform a swap to | 84 // have a cycle. Search for such a blocking move and perform a swap to |
| 85 // resolve it. | 85 // resolve it. |
| 86 auto blocker = std::find_if(moves->begin(), moves->end(), | 86 auto blocker = std::find_if(moves->begin(), moves->end(), |
| 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()) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 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 |