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 |
11 namespace v8 { | 11 namespace v8 { |
12 namespace internal { | 12 namespace internal { |
13 namespace compiler { | 13 namespace compiler { |
14 | 14 |
15 typedef ZoneList<MoveOperands>::iterator op_iterator; | 15 typedef ZoneList<MoveOperands>::iterator op_iterator; |
16 | 16 |
17 #ifdef ENABLE_SLOW_DCHECKS | 17 #ifdef ENABLE_SLOW_DCHECKS |
18 // TODO(svenpanne) Brush up InstructionOperand with comparison? | |
19 struct InstructionOperandComparator { | 18 struct InstructionOperandComparator { |
20 bool operator()(const InstructionOperand* x, | 19 bool operator()(const InstructionOperand* x, |
21 const InstructionOperand* y) const { | 20 const InstructionOperand* y) const { |
22 return (x->kind() < y->kind()) || | 21 return *x < *y; |
23 (x->kind() == y->kind() && x->index() < y->index()); | |
24 } | 22 } |
25 }; | 23 }; |
26 #endif | 24 #endif |
27 | 25 |
28 // No operand should be the destination for more than one move. | 26 // No operand should be the destination for more than one move. |
29 static void VerifyMovesAreInjective(ZoneList<MoveOperands>* moves) { | 27 static void VerifyMovesAreInjective(ZoneList<MoveOperands>* moves) { |
30 #ifdef ENABLE_SLOW_DCHECKS | 28 #ifdef ENABLE_SLOW_DCHECKS |
31 std::set<InstructionOperand*, InstructionOperandComparator> seen; | 29 std::set<InstructionOperand*, InstructionOperandComparator> seen; |
32 for (op_iterator i = moves->begin(); i != moves->end(); ++i) { | 30 for (op_iterator i = moves->begin(); i != moves->end(); ++i) { |
33 SLOW_DCHECK(seen.find(i->destination()) == seen.end()); | 31 SLOW_DCHECK(seen.find(i->destination()) == seen.end()); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 if (other->Blocks(source)) { | 125 if (other->Blocks(source)) { |
128 other->set_source(destination); | 126 other->set_source(destination); |
129 } else if (other->Blocks(destination)) { | 127 } else if (other->Blocks(destination)) { |
130 other->set_source(source); | 128 other->set_source(source); |
131 } | 129 } |
132 } | 130 } |
133 } | 131 } |
134 } | 132 } |
135 } | 133 } |
136 } // namespace v8::internal::compiler | 134 } // namespace v8::internal::compiler |
OLD | NEW |