| 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/cpu.h" | 8 #include "vm/cpu.h" |
| 9 #include "vm/dart_entry.h" | 9 #include "vm/dart_entry.h" |
| 10 #include "vm/flow_graph_allocator.h" | 10 #include "vm/flow_graph_allocator.h" |
| (...skipping 1729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1740 // Fold away UnboxInt<N>Instr(BoxInt<N>Instr(v)). | 1740 // Fold away UnboxInt<N>Instr(BoxInt<N>Instr(v)). |
| 1741 BoxIntNInstr* box_defn = value()->definition()->AsBoxIntN(); | 1741 BoxIntNInstr* box_defn = value()->definition()->AsBoxIntN(); |
| 1742 if (box_defn != NULL) { | 1742 if (box_defn != NULL) { |
| 1743 if (box_defn->value()->definition()->representation() == representation()) { | 1743 if (box_defn->value()->definition()->representation() == representation()) { |
| 1744 return box_defn->value()->definition(); | 1744 return box_defn->value()->definition(); |
| 1745 } else { | 1745 } else { |
| 1746 UnboxedIntConverterInstr* converter = new UnboxedIntConverterInstr( | 1746 UnboxedIntConverterInstr* converter = new UnboxedIntConverterInstr( |
| 1747 box_defn->value()->definition()->representation(), | 1747 box_defn->value()->definition()->representation(), |
| 1748 representation(), | 1748 representation(), |
| 1749 box_defn->value()->CopyWithType(), | 1749 box_defn->value()->CopyWithType(), |
| 1750 representation() == kUnboxedInt32 ? deopt_id_ : Isolate::kNoDeoptId); | 1750 (representation() == kUnboxedInt32) ? |
| 1751 deopt_id_ : Isolate::kNoDeoptId); |
| 1751 if ((representation() == kUnboxedInt32) && is_truncating()) { | 1752 if ((representation() == kUnboxedInt32) && is_truncating()) { |
| 1752 converter->mark_truncating(); | 1753 converter->mark_truncating(); |
| 1753 } | 1754 } |
| 1754 flow_graph->InsertBefore(this, converter, env(), FlowGraph::kValue); | 1755 flow_graph->InsertBefore(this, converter, env(), FlowGraph::kValue); |
| 1755 return converter; | 1756 return converter; |
| 1756 } | 1757 } |
| 1757 } | 1758 } |
| 1758 | 1759 |
| 1759 return this; | 1760 return this; |
| 1760 } | 1761 } |
| 1761 | 1762 |
| 1762 | 1763 |
| 1763 Definition* UnboxedIntConverterInstr::Canonicalize(FlowGraph* flow_graph) { | 1764 Definition* UnboxedIntConverterInstr::Canonicalize(FlowGraph* flow_graph) { |
| 1764 if (!HasUses()) return NULL; | 1765 if (!HasUses()) return NULL; |
| 1765 | 1766 |
| 1766 UnboxedIntConverterInstr* box_defn = | 1767 UnboxedIntConverterInstr* box_defn = |
| 1767 value()->definition()->AsUnboxedIntConverter(); | 1768 value()->definition()->AsUnboxedIntConverter(); |
| 1768 if ((box_defn != NULL) && (box_defn->representation() == from())) { | 1769 if ((box_defn != NULL) && (box_defn->representation() == from())) { |
| 1769 if (box_defn->from() == to()) { | 1770 if (box_defn->from() == to()) { |
| 1770 return box_defn->value()->definition(); | 1771 return box_defn->value()->definition(); |
| 1771 } | 1772 } |
| 1772 | 1773 |
| 1773 UnboxedIntConverterInstr* converter = new UnboxedIntConverterInstr( | 1774 UnboxedIntConverterInstr* converter = new UnboxedIntConverterInstr( |
| 1774 box_defn->from(), | 1775 box_defn->from(), |
| 1775 representation(), | 1776 representation(), |
| 1776 box_defn->value()->CopyWithType(), | 1777 box_defn->value()->CopyWithType(), |
| 1777 to() == kUnboxedInt32 ? deopt_id_ : NULL); | 1778 (to() == kUnboxedInt32) ? deopt_id_ : Isolate::kNoDeoptId); |
| 1778 if ((representation() == kUnboxedInt32) && is_truncating()) { | 1779 if ((representation() == kUnboxedInt32) && is_truncating()) { |
| 1779 converter->mark_truncating(); | 1780 converter->mark_truncating(); |
| 1780 } | 1781 } |
| 1781 flow_graph->InsertBefore(this, converter, env(), FlowGraph::kValue); | 1782 flow_graph->InsertBefore(this, converter, env(), FlowGraph::kValue); |
| 1782 return converter; | 1783 return converter; |
| 1783 } | 1784 } |
| 1784 | 1785 |
| 1785 UnboxIntegerInstr* unbox_defn = value()->definition()->AsUnboxInteger(); | 1786 UnboxIntegerInstr* unbox_defn = value()->definition()->AsUnboxInteger(); |
| 1786 if (unbox_defn != NULL && | 1787 if (unbox_defn != NULL && |
| 1787 (from() == kUnboxedMint) && | 1788 (from() == kUnboxedMint) && |
| (...skipping 1355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3143 case Token::kTRUNCDIV: return 0; | 3144 case Token::kTRUNCDIV: return 0; |
| 3144 case Token::kMOD: return 1; | 3145 case Token::kMOD: return 1; |
| 3145 default: UNIMPLEMENTED(); return -1; | 3146 default: UNIMPLEMENTED(); return -1; |
| 3146 } | 3147 } |
| 3147 } | 3148 } |
| 3148 | 3149 |
| 3149 | 3150 |
| 3150 #undef __ | 3151 #undef __ |
| 3151 | 3152 |
| 3152 } // namespace dart | 3153 } // namespace dart |
| OLD | NEW |