Chromium Code Reviews| 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/intermediate_language.h" | 5 #include "vm/intermediate_language.h" |
| 6 | 6 |
| 7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
| 8 #include "vm/dart_entry.h" | 8 #include "vm/dart_entry.h" |
| 9 #include "vm/flow_graph_allocator.h" | 9 #include "vm/flow_graph_allocator.h" |
| 10 #include "vm/flow_graph_builder.h" | 10 #include "vm/flow_graph_builder.h" |
| (...skipping 1803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1814 return this; | 1814 return this; |
| 1815 } | 1815 } |
| 1816 | 1816 |
| 1817 | 1817 |
| 1818 Instruction* BranchInstr::Canonicalize(FlowGraphOptimizer* optimizer) { | 1818 Instruction* BranchInstr::Canonicalize(FlowGraphOptimizer* optimizer) { |
| 1819 // Only handle strict-compares. | 1819 // Only handle strict-compares. |
| 1820 if (comparison()->IsStrictCompare()) { | 1820 if (comparison()->IsStrictCompare()) { |
| 1821 Definition* replacement = comparison()->Canonicalize(optimizer); | 1821 Definition* replacement = comparison()->Canonicalize(optimizer); |
| 1822 if (replacement == comparison() || replacement == NULL) return this; | 1822 if (replacement == comparison() || replacement == NULL) return this; |
| 1823 ComparisonInstr* comp = replacement->AsComparison(); | 1823 ComparisonInstr* comp = replacement->AsComparison(); |
| 1824 if (comp == NULL) return this; | 1824 if ((comp == NULL) || comp->CanDeoptimize()) return this; |
| 1825 | |
| 1826 // Check that comparison is not serving as a pending deoptimization target | |
| 1827 // for conversions. | |
| 1828 for (intptr_t i = 0; i < comp->InputCount(); i++) { | |
| 1829 if (comp->RequiredInputRepresentation(i) != | |
| 1830 comp->InputAt(i)->definition()->representation()) { | |
|
Florian Schneider
2013/02/13 14:08:43
Indentation off.
Vyacheslav Egorov (Google)
2013/02/13 14:10:19
Done.
| |
| 1831 return this; | |
| 1832 } | |
| 1833 } | |
| 1825 | 1834 |
| 1826 // Replace the comparison if the replacement is used at this branch, | 1835 // Replace the comparison if the replacement is used at this branch, |
| 1827 // and has exactly one use. | 1836 // and has exactly one use. |
| 1828 if ((comp->input_use_list()->instruction() == this) && | 1837 if ((comp->input_use_list()->instruction() == this) && |
| 1829 (comp->input_use_list()->next_use() == NULL) && | 1838 (comp->input_use_list()->next_use() == NULL) && |
| 1830 (comp->env_use_list() == NULL)) { | 1839 (comp->env_use_list() == NULL)) { |
| 1831 comp->RemoveFromGraph(); | 1840 comp->RemoveFromGraph(); |
| 1832 // It is safe to pass a NULL iterator because we're replacing the | 1841 // It is safe to pass a NULL iterator because we're replacing the |
| 1833 // comparison wrapped in a BranchInstr which does not modify the | 1842 // comparison wrapped in a BranchInstr which does not modify the |
| 1834 // linked list of instructions. | 1843 // linked list of instructions. |
| (...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2868 default: | 2877 default: |
| 2869 UNREACHABLE(); | 2878 UNREACHABLE(); |
| 2870 } | 2879 } |
| 2871 return kPowRuntimeEntry; | 2880 return kPowRuntimeEntry; |
| 2872 } | 2881 } |
| 2873 | 2882 |
| 2874 | 2883 |
| 2875 #undef __ | 2884 #undef __ |
| 2876 | 2885 |
| 2877 } // namespace dart | 2886 } // namespace dart |
| OLD | NEW |