OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/flow_graph_optimizer.h" | 5 #include "vm/flow_graph_optimizer.h" |
6 | 6 |
7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
8 #include "vm/cha.h" | 8 #include "vm/cha.h" |
9 #include "vm/cpu.h" | 9 #include "vm/cpu.h" |
10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 iterator->RemoveCurrentFromGraph(); | 582 iterator->RemoveCurrentFromGraph(); |
583 } | 583 } |
584 | 584 |
585 | 585 |
586 bool FlowGraphOptimizer::Canonicalize() { | 586 bool FlowGraphOptimizer::Canonicalize() { |
587 bool changed = false; | 587 bool changed = false; |
588 for (intptr_t i = 0; i < block_order_.length(); ++i) { | 588 for (intptr_t i = 0; i < block_order_.length(); ++i) { |
589 BlockEntryInstr* entry = block_order_[i]; | 589 BlockEntryInstr* entry = block_order_[i]; |
590 for (ForwardInstructionIterator it(entry); !it.Done(); it.Advance()) { | 590 for (ForwardInstructionIterator it(entry); !it.Done(); it.Advance()) { |
591 Instruction* current = it.Current(); | 591 Instruction* current = it.Current(); |
| 592 if (current->HasUnmatchedInputRepresentations()) { |
| 593 // Can't canonicalize this instruction until all conversions for its |
| 594 // inputs are inserted. |
| 595 continue; |
| 596 } |
| 597 |
592 Instruction* replacement = current->Canonicalize(flow_graph()); | 598 Instruction* replacement = current->Canonicalize(flow_graph()); |
| 599 |
593 if (replacement != current) { | 600 if (replacement != current) { |
594 // For non-definitions Canonicalize should return either NULL or | 601 // For non-definitions Canonicalize should return either NULL or |
595 // this. | 602 // this. |
596 ASSERT((replacement == NULL) || current->IsDefinition()); | 603 ASSERT((replacement == NULL) || current->IsDefinition()); |
597 ReplaceCurrentInstruction(&it, current, replacement, flow_graph_); | 604 ReplaceCurrentInstruction(&it, current, replacement, flow_graph_); |
598 changed = true; | 605 changed = true; |
599 } | 606 } |
600 } | 607 } |
601 } | 608 } |
602 return changed; | 609 return changed; |
(...skipping 9376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9979 | 9986 |
9980 // Insert materializations at environment uses. | 9987 // Insert materializations at environment uses. |
9981 for (intptr_t i = 0; i < exits_collector_.exits().length(); i++) { | 9988 for (intptr_t i = 0; i < exits_collector_.exits().length(); i++) { |
9982 CreateMaterializationAt( | 9989 CreateMaterializationAt( |
9983 exits_collector_.exits()[i], alloc, alloc->cls(), *slots); | 9990 exits_collector_.exits()[i], alloc, alloc->cls(), *slots); |
9984 } | 9991 } |
9985 } | 9992 } |
9986 | 9993 |
9987 | 9994 |
9988 } // namespace dart | 9995 } // namespace dart |
OLD | NEW |