OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 #ifndef VM_INTERMEDIATE_LANGUAGE_H_ | 5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_ |
6 #define VM_INTERMEDIATE_LANGUAGE_H_ | 6 #define VM_INTERMEDIATE_LANGUAGE_H_ |
7 | 7 |
8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
9 #include "vm/ast.h" | 9 #include "vm/ast.h" |
10 #include "vm/growable_array.h" | 10 #include "vm/growable_array.h" |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 enum ComputationKind { | 234 enum ComputationKind { |
235 #define DECLARE_COMPUTATION_KIND(ShortName, ClassName) k##ShortName, | 235 #define DECLARE_COMPUTATION_KIND(ShortName, ClassName) k##ShortName, |
236 | 236 |
237 FOR_EACH_COMPUTATION(DECLARE_COMPUTATION_KIND) | 237 FOR_EACH_COMPUTATION(DECLARE_COMPUTATION_KIND) |
238 | 238 |
239 #undef DECLARE_COMPUTATION_KIND | 239 #undef DECLARE_COMPUTATION_KIND |
240 }; | 240 }; |
241 | 241 |
242 virtual ComputationKind computation_kind() const = 0; | 242 virtual ComputationKind computation_kind() const = 0; |
243 | 243 |
| 244 // Returns representation expected for the input operand at the given index. |
| 245 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
| 246 return kTagged; |
| 247 } |
| 248 |
| 249 // Representation of the value produced by this computation. |
244 virtual Representation representation() const { | 250 virtual Representation representation() const { |
245 return kTagged; | 251 return kTagged; |
246 } | 252 } |
247 | 253 |
| 254 // Returns deoptimization id that corresponds to the deoptimization target |
| 255 // that input operands conversions inserted for this instruction can jump |
| 256 // to. Can return kNoDeoptId. |
| 257 virtual intptr_t DeoptimizationTarget() const { |
| 258 UNREACHABLE(); |
| 259 return Isolate::kNoDeoptId; |
| 260 } |
| 261 |
248 // Declare predicate for each computation. | 262 // Declare predicate for each computation. |
249 #define DECLARE_PREDICATE(ShortName, ClassName) \ | 263 #define DECLARE_PREDICATE(ShortName, ClassName) \ |
250 inline bool Is##ShortName() const; \ | 264 inline bool Is##ShortName() const; \ |
251 inline const ClassName* As##ShortName() const; \ | 265 inline const ClassName* As##ShortName() const; \ |
252 inline ClassName* As##ShortName(); | 266 inline ClassName* As##ShortName(); |
253 FOR_EACH_COMPUTATION(DECLARE_PREDICATE) | 267 FOR_EACH_COMPUTATION(DECLARE_PREDICATE) |
254 #undef DECLARE_PREDICATE | 268 #undef DECLARE_PREDICATE |
255 | 269 |
| 270 protected: |
| 271 // Fetch deopt id without checking if this computation can deoptimize. |
| 272 intptr_t GetDeoptId() const { |
| 273 return deopt_id_; |
| 274 } |
| 275 |
256 private: | 276 private: |
257 friend class BranchInstr; | 277 friend class BranchInstr; |
258 | 278 |
259 intptr_t deopt_id_; | 279 intptr_t deopt_id_; |
260 const ICData* ic_data_; | 280 const ICData* ic_data_; |
261 LocationSummary* locs_; | 281 LocationSummary* locs_; |
262 | 282 |
263 DISALLOW_COPY_AND_ASSIGN(Computation); | 283 DISALLOW_COPY_AND_ASSIGN(Computation); |
264 }; | 284 }; |
265 | 285 |
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 DECLARE_COMPUTATION(EqualityCompare) | 759 DECLARE_COMPUTATION(EqualityCompare) |
740 | 760 |
741 intptr_t token_pos() const { return token_pos_; } | 761 intptr_t token_pos() const { return token_pos_; } |
742 | 762 |
743 // Receiver class id is computed from collected ICData. | 763 // Receiver class id is computed from collected ICData. |
744 void set_receiver_class_id(intptr_t value) { receiver_class_id_ = value; } | 764 void set_receiver_class_id(intptr_t value) { receiver_class_id_ = value; } |
745 intptr_t receiver_class_id() const { return receiver_class_id_; } | 765 intptr_t receiver_class_id() const { return receiver_class_id_; } |
746 | 766 |
747 virtual void PrintOperandsTo(BufferFormatter* f) const; | 767 virtual void PrintOperandsTo(BufferFormatter* f) const; |
748 | 768 |
749 virtual bool CanDeoptimize() const { return true; } | 769 virtual bool CanDeoptimize() const { |
| 770 return (receiver_class_id() != kDoubleCid); |
| 771 } |
| 772 |
750 virtual intptr_t ResultCid() const; | 773 virtual intptr_t ResultCid() const; |
751 | 774 |
752 virtual void EmitBranchCode(FlowGraphCompiler* compiler, | 775 virtual void EmitBranchCode(FlowGraphCompiler* compiler, |
753 BranchInstr* branch); | 776 BranchInstr* branch); |
754 | 777 |
| 778 virtual intptr_t DeoptimizationTarget() const { |
| 779 return GetDeoptId(); |
| 780 } |
| 781 |
| 782 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
| 783 ASSERT((idx == 0) || (idx == 1)); |
| 784 return (receiver_class_id() == kDoubleCid) ? kUnboxedDouble : kTagged; |
| 785 } |
| 786 |
755 private: | 787 private: |
756 const intptr_t token_pos_; | 788 const intptr_t token_pos_; |
757 intptr_t receiver_class_id_; // Set by optimizer. | 789 intptr_t receiver_class_id_; // Set by optimizer. |
758 | 790 |
759 DISALLOW_COPY_AND_ASSIGN(EqualityCompareComp); | 791 DISALLOW_COPY_AND_ASSIGN(EqualityCompareComp); |
760 }; | 792 }; |
761 | 793 |
762 | 794 |
763 class RelationalOpComp : public ComparisonComp { | 795 class RelationalOpComp : public ComparisonComp { |
764 public: | 796 public: |
(...skipping 14 matching lines...) Expand all Loading... |
779 // TODO(srdjan): instead of class-id pass an enum that can differentiate | 811 // TODO(srdjan): instead of class-id pass an enum that can differentiate |
780 // between boxed and unboxed doubles and integers. | 812 // between boxed and unboxed doubles and integers. |
781 void set_operands_class_id(intptr_t value) { | 813 void set_operands_class_id(intptr_t value) { |
782 operands_class_id_ = value; | 814 operands_class_id_ = value; |
783 } | 815 } |
784 | 816 |
785 intptr_t operands_class_id() const { return operands_class_id_; } | 817 intptr_t operands_class_id() const { return operands_class_id_; } |
786 | 818 |
787 virtual void PrintOperandsTo(BufferFormatter* f) const; | 819 virtual void PrintOperandsTo(BufferFormatter* f) const; |
788 | 820 |
789 virtual bool CanDeoptimize() const { return true; } | 821 virtual bool CanDeoptimize() const { |
| 822 return operands_class_id() != kDoubleCid; |
| 823 } |
| 824 |
790 virtual intptr_t ResultCid() const; | 825 virtual intptr_t ResultCid() const; |
791 | 826 |
792 virtual void EmitBranchCode(FlowGraphCompiler* compiler, | 827 virtual void EmitBranchCode(FlowGraphCompiler* compiler, |
793 BranchInstr* branch); | 828 BranchInstr* branch); |
794 | 829 |
| 830 |
| 831 virtual intptr_t DeoptimizationTarget() const { |
| 832 return GetDeoptId(); |
| 833 } |
| 834 |
| 835 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
| 836 ASSERT((idx == 0) || (idx == 1)); |
| 837 return (operands_class_id() == kDoubleCid) ? kUnboxedDouble : kTagged; |
| 838 } |
| 839 |
795 private: | 840 private: |
796 const intptr_t token_pos_; | 841 const intptr_t token_pos_; |
797 intptr_t operands_class_id_; // class id of both operands. | 842 intptr_t operands_class_id_; // class id of both operands. |
798 | 843 |
799 DISALLOW_COPY_AND_ASSIGN(RelationalOpComp); | 844 DISALLOW_COPY_AND_ASSIGN(RelationalOpComp); |
800 }; | 845 }; |
801 | 846 |
802 | 847 |
803 class StaticCallComp : public TemplateComputation<0> { | 848 class StaticCallComp : public TemplateComputation<0> { |
804 public: | 849 public: |
(...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1591 private: | 1636 private: |
1592 InstanceCallComp* instance_call_; | 1637 InstanceCallComp* instance_call_; |
1593 | 1638 |
1594 DISALLOW_COPY_AND_ASSIGN(CheckEitherNonSmiComp); | 1639 DISALLOW_COPY_AND_ASSIGN(CheckEitherNonSmiComp); |
1595 }; | 1640 }; |
1596 | 1641 |
1597 | 1642 |
1598 class BoxDoubleComp : public TemplateComputation<1> { | 1643 class BoxDoubleComp : public TemplateComputation<1> { |
1599 public: | 1644 public: |
1600 BoxDoubleComp(Value* value, InstanceCallComp* instance_call) | 1645 BoxDoubleComp(Value* value, InstanceCallComp* instance_call) |
1601 : instance_call_(instance_call) { | 1646 : token_pos_((instance_call != NULL) ? instance_call->token_pos() : 0) { |
1602 ASSERT(value != NULL); | 1647 ASSERT(value != NULL); |
1603 inputs_[0] = value; | 1648 inputs_[0] = value; |
1604 } | 1649 } |
1605 | 1650 |
1606 Value* value() const { return inputs_[0]; } | 1651 Value* value() const { return inputs_[0]; } |
1607 InstanceCallComp* instance_call() const { return instance_call_; } | 1652 |
| 1653 intptr_t token_pos() const { return token_pos_; } |
1608 | 1654 |
1609 virtual bool CanDeoptimize() const { return false; } | 1655 virtual bool CanDeoptimize() const { return false; } |
| 1656 virtual bool HasSideEffect() const { return false; } |
| 1657 virtual bool AttributesEqual(Computation* other) const { return true; } |
1610 | 1658 |
1611 virtual intptr_t ResultCid() const; | 1659 virtual intptr_t ResultCid() const; |
1612 | 1660 |
| 1661 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
| 1662 ASSERT(idx == 0); |
| 1663 return kUnboxedDouble; |
| 1664 } |
| 1665 |
1613 DECLARE_COMPUTATION(BoxDouble) | 1666 DECLARE_COMPUTATION(BoxDouble) |
1614 | 1667 |
1615 private: | 1668 private: |
1616 InstanceCallComp* instance_call_; | 1669 const intptr_t token_pos_; |
1617 | 1670 |
1618 DISALLOW_COPY_AND_ASSIGN(BoxDoubleComp); | 1671 DISALLOW_COPY_AND_ASSIGN(BoxDoubleComp); |
1619 }; | 1672 }; |
1620 | 1673 |
1621 | 1674 |
1622 class UnboxDoubleComp : public TemplateComputation<1> { | 1675 class UnboxDoubleComp : public TemplateComputation<1> { |
1623 public: | 1676 public: |
1624 UnboxDoubleComp(Value* value, InstanceCallComp* instance_call) | 1677 UnboxDoubleComp(Value* value, intptr_t deopt_id) |
1625 : instance_call_(instance_call) { | 1678 : deopt_id_(deopt_id) { |
1626 ASSERT(value != NULL); | 1679 ASSERT(value != NULL); |
1627 inputs_[0] = value; | 1680 inputs_[0] = value; |
1628 } | 1681 } |
1629 | 1682 |
1630 Value* value() const { return inputs_[0]; } | 1683 Value* value() const { return inputs_[0]; } |
1631 InstanceCallComp* instance_call() const { return instance_call_; } | |
1632 | 1684 |
1633 virtual bool CanDeoptimize() const { | 1685 virtual bool CanDeoptimize() const { |
1634 return value()->ResultCid() != kDoubleCid; | 1686 return value()->ResultCid() != kDoubleCid; |
1635 } | 1687 } |
1636 // The output is not an instance. | 1688 |
1637 virtual intptr_t ResultCid() const { return kDynamicCid; } | 1689 // The output is not an instance but when it is boxed it becomes double. |
| 1690 virtual intptr_t ResultCid() const { return kDoubleCid; } |
1638 | 1691 |
1639 virtual Representation representation() const { | 1692 virtual Representation representation() const { |
1640 return kUnboxedDouble; | 1693 return kUnboxedDouble; |
1641 } | 1694 } |
1642 | 1695 |
| 1696 virtual bool HasSideEffect() const { return false; } |
| 1697 virtual bool AttributesEqual(Computation* other) const { return true; } |
| 1698 |
1643 DECLARE_COMPUTATION(UnboxDouble) | 1699 DECLARE_COMPUTATION(UnboxDouble) |
1644 | 1700 |
1645 private: | 1701 private: |
1646 InstanceCallComp* instance_call_; | 1702 const intptr_t deopt_id_; |
1647 | 1703 |
1648 DISALLOW_COPY_AND_ASSIGN(UnboxDoubleComp); | 1704 DISALLOW_COPY_AND_ASSIGN(UnboxDoubleComp); |
1649 }; | 1705 }; |
1650 | 1706 |
1651 | 1707 |
1652 class UnboxedDoubleBinaryOpComp : public TemplateComputation<2> { | 1708 class UnboxedDoubleBinaryOpComp : public TemplateComputation<2> { |
1653 public: | 1709 public: |
1654 UnboxedDoubleBinaryOpComp(Token::Kind op_kind, | 1710 UnboxedDoubleBinaryOpComp(Token::Kind op_kind, |
1655 Value* left, | 1711 Value* left, |
1656 Value* right) | 1712 Value* right, |
1657 : op_kind_(op_kind) { | 1713 InstanceCallComp* call) |
| 1714 : op_kind_(op_kind), deopt_id_(call->deopt_id()) { |
1658 ASSERT(left != NULL); | 1715 ASSERT(left != NULL); |
1659 ASSERT(right != NULL); | 1716 ASSERT(right != NULL); |
1660 inputs_[0] = left; | 1717 inputs_[0] = left; |
1661 inputs_[1] = right; | 1718 inputs_[1] = right; |
1662 } | 1719 } |
1663 | 1720 |
1664 Value* left() const { return inputs_[0]; } | 1721 Value* left() const { return inputs_[0]; } |
1665 Value* right() const { return inputs_[1]; } | 1722 Value* right() const { return inputs_[1]; } |
1666 | 1723 |
1667 Token::Kind op_kind() const { return op_kind_; } | 1724 Token::Kind op_kind() const { return op_kind_; } |
1668 | 1725 |
1669 virtual void PrintOperandsTo(BufferFormatter* f) const; | 1726 virtual void PrintOperandsTo(BufferFormatter* f) const; |
1670 | 1727 |
1671 virtual bool CanDeoptimize() const { return false; } | 1728 virtual bool CanDeoptimize() const { return false; } |
1672 // The output is not an instance. | 1729 virtual bool HasSideEffect() const { return false; } |
1673 virtual intptr_t ResultCid() const { return kDynamicCid; } | 1730 |
| 1731 virtual bool AttributesEqual(Computation* other) const { |
| 1732 return op_kind() == other->AsUnboxedDoubleBinaryOp()->op_kind(); |
| 1733 } |
| 1734 |
| 1735 // The output is not an instance but when it is boxed it becomes double. |
| 1736 virtual intptr_t ResultCid() const { return kDoubleCid; } |
1674 | 1737 |
1675 virtual Representation representation() const { | 1738 virtual Representation representation() const { |
1676 return kUnboxedDouble; | 1739 return kUnboxedDouble; |
1677 } | 1740 } |
1678 | 1741 |
| 1742 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
| 1743 ASSERT((idx == 0) || (idx == 1)); |
| 1744 return kUnboxedDouble; |
| 1745 } |
| 1746 |
| 1747 virtual intptr_t DeoptimizationTarget() const { |
| 1748 return deopt_id_; |
| 1749 } |
| 1750 |
1679 DECLARE_COMPUTATION(UnboxedDoubleBinaryOp) | 1751 DECLARE_COMPUTATION(UnboxedDoubleBinaryOp) |
1680 | 1752 |
1681 private: | 1753 private: |
1682 const Token::Kind op_kind_; | 1754 const Token::Kind op_kind_; |
| 1755 const intptr_t deopt_id_; |
1683 | 1756 |
1684 DISALLOW_COPY_AND_ASSIGN(UnboxedDoubleBinaryOpComp); | 1757 DISALLOW_COPY_AND_ASSIGN(UnboxedDoubleBinaryOpComp); |
1685 }; | 1758 }; |
1686 | 1759 |
1687 | 1760 |
1688 class BinarySmiOpComp : public TemplateComputation<2> { | 1761 class BinarySmiOpComp : public TemplateComputation<2> { |
1689 public: | 1762 public: |
1690 BinarySmiOpComp(Token::Kind op_kind, | 1763 BinarySmiOpComp(Token::Kind op_kind, |
1691 InstanceCallComp* instance_call, | 1764 InstanceCallComp* instance_call, |
1692 Value* left, | 1765 Value* left, |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2176 } | 2249 } |
2177 | 2250 |
2178 Environment* env() const { return env_; } | 2251 Environment* env() const { return env_; } |
2179 void set_env(Environment* env) { env_ = env; } | 2252 void set_env(Environment* env) { env_ = env; } |
2180 | 2253 |
2181 intptr_t lifetime_position() const { return lifetime_position_; } | 2254 intptr_t lifetime_position() const { return lifetime_position_; } |
2182 void set_lifetime_position(intptr_t pos) { | 2255 void set_lifetime_position(intptr_t pos) { |
2183 lifetime_position_ = pos; | 2256 lifetime_position_ = pos; |
2184 } | 2257 } |
2185 | 2258 |
| 2259 // Returns representation expected for the input operand at the given index. |
| 2260 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
| 2261 return kTagged; |
| 2262 } |
| 2263 |
| 2264 // Representation of the value produced by this computation. |
2186 virtual Representation representation() const { | 2265 virtual Representation representation() const { |
2187 return kTagged; | 2266 return kTagged; |
2188 } | 2267 } |
2189 | 2268 |
| 2269 bool WasEliminated() const { |
| 2270 return next() == NULL; |
| 2271 } |
| 2272 |
| 2273 // Returns deoptimization id that corresponds to the deoptimization target |
| 2274 // that input operands conversions inserted for this instruction can jump |
| 2275 // to. |
| 2276 virtual intptr_t DeoptimizationTarget() const { |
| 2277 UNREACHABLE(); |
| 2278 return Isolate::kNoDeoptId; |
| 2279 } |
| 2280 |
2190 private: | 2281 private: |
2191 friend class BindInstr; // Needed for BindInstr::InsertBefore. | 2282 friend class BindInstr; // Needed for BindInstr::InsertBefore. |
2192 | 2283 |
2193 intptr_t lifetime_position_; // Position used by register allocator. | 2284 intptr_t lifetime_position_; // Position used by register allocator. |
2194 Instruction* previous_; | 2285 Instruction* previous_; |
2195 Instruction* next_; | 2286 Instruction* next_; |
2196 Environment* env_; | 2287 Environment* env_; |
2197 DISALLOW_COPY_AND_ASSIGN(Instruction); | 2288 DISALLOW_COPY_AND_ASSIGN(Instruction); |
2198 }; | 2289 }; |
2199 | 2290 |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2745 } | 2836 } |
2746 | 2837 |
2747 virtual void EmitNativeCode(FlowGraphCompiler* compiler); | 2838 virtual void EmitNativeCode(FlowGraphCompiler* compiler); |
2748 | 2839 |
2749 // Insert this instruction before 'next'. | 2840 // Insert this instruction before 'next'. |
2750 void InsertBefore(Instruction* next); | 2841 void InsertBefore(Instruction* next); |
2751 | 2842 |
2752 // Insert this instruction after 'prev'. | 2843 // Insert this instruction after 'prev'. |
2753 void InsertAfter(Instruction* prev); | 2844 void InsertAfter(Instruction* prev); |
2754 | 2845 |
| 2846 virtual Representation RequiredInputRepresentation(intptr_t i) const { |
| 2847 return computation()->RequiredInputRepresentation(i); |
| 2848 } |
| 2849 |
2755 virtual Representation representation() const { | 2850 virtual Representation representation() const { |
2756 return computation()->representation(); | 2851 return computation()->representation(); |
2757 } | 2852 } |
2758 | 2853 |
| 2854 virtual intptr_t DeoptimizationTarget() const { |
| 2855 return computation()->DeoptimizationTarget(); |
| 2856 } |
| 2857 |
2759 private: | 2858 private: |
2760 Computation* computation_; | 2859 Computation* computation_; |
2761 const bool is_used_; | 2860 const bool is_used_; |
2762 | 2861 |
2763 DISALLOW_COPY_AND_ASSIGN(BindInstr); | 2862 DISALLOW_COPY_AND_ASSIGN(BindInstr); |
2764 }; | 2863 }; |
2765 | 2864 |
2766 | 2865 |
2767 class PhiInstr : public Definition { | 2866 class PhiInstr : public Definition { |
2768 public: | 2867 public: |
2769 explicit PhiInstr(intptr_t num_inputs) | 2868 explicit PhiInstr(JoinEntryInstr* block, intptr_t num_inputs) |
2770 : inputs_(num_inputs), is_alive_(false) { | 2869 : block_(block), |
| 2870 inputs_(num_inputs), |
| 2871 is_alive_(false), |
| 2872 representation_(kTagged) { |
2771 for (intptr_t i = 0; i < num_inputs; ++i) { | 2873 for (intptr_t i = 0; i < num_inputs; ++i) { |
2772 inputs_.Add(NULL); | 2874 inputs_.Add(NULL); |
2773 } | 2875 } |
2774 } | 2876 } |
2775 | 2877 |
| 2878 JoinEntryInstr* block() const { return block_; } |
| 2879 |
2776 virtual RawAbstractType* CompileType() const; | 2880 virtual RawAbstractType* CompileType() const; |
2777 virtual intptr_t GetPropagatedCid() { return propagated_cid(); } | 2881 virtual intptr_t GetPropagatedCid() { return propagated_cid(); } |
2778 | 2882 |
2779 virtual intptr_t ArgumentCount() const { return 0; } | 2883 virtual intptr_t ArgumentCount() const { return 0; } |
2780 | 2884 |
2781 intptr_t InputCount() const { return inputs_.length(); } | 2885 intptr_t InputCount() const { return inputs_.length(); } |
2782 | 2886 |
2783 Value* InputAt(intptr_t i) const { return inputs_[i]; } | 2887 Value* InputAt(intptr_t i) const { return inputs_[i]; } |
2784 | 2888 |
2785 void SetInputAt(intptr_t i, Value* value) { inputs_[i] = value; } | 2889 void SetInputAt(intptr_t i, Value* value) { inputs_[i] = value; } |
2786 | 2890 |
2787 virtual bool CanDeoptimize() const { return false; } | 2891 virtual bool CanDeoptimize() const { return false; } |
2788 | 2892 |
2789 // TODO(regis): This helper will be removed once we support type sets. | 2893 // TODO(regis): This helper will be removed once we support type sets. |
2790 RawAbstractType* LeastSpecificInputType() const; | 2894 RawAbstractType* LeastSpecificInputType() const; |
2791 | 2895 |
2792 // Phi is alive if it reaches a non-environment use. | 2896 // Phi is alive if it reaches a non-environment use. |
2793 bool is_alive() const { return is_alive_; } | 2897 bool is_alive() const { return is_alive_; } |
2794 void mark_alive() { is_alive_ = true; } | 2898 void mark_alive() { is_alive_ = true; } |
2795 | 2899 |
| 2900 virtual Representation RequiredInputRepresentation(intptr_t i) const { |
| 2901 return representation_; |
| 2902 } |
| 2903 |
| 2904 virtual Representation representation() const { |
| 2905 return representation_; |
| 2906 } |
| 2907 |
| 2908 virtual void set_representation(Representation r) { |
| 2909 representation_ = r; |
| 2910 } |
| 2911 |
2796 DECLARE_INSTRUCTION(Phi) | 2912 DECLARE_INSTRUCTION(Phi) |
2797 | 2913 |
2798 private: | 2914 private: |
| 2915 JoinEntryInstr* block_; |
2799 GrowableArray<Value*> inputs_; | 2916 GrowableArray<Value*> inputs_; |
2800 bool is_alive_; | 2917 bool is_alive_; |
| 2918 Representation representation_; |
2801 | 2919 |
2802 DISALLOW_COPY_AND_ASSIGN(PhiInstr); | 2920 DISALLOW_COPY_AND_ASSIGN(PhiInstr); |
2803 }; | 2921 }; |
2804 | 2922 |
2805 | 2923 |
2806 class ParameterInstr : public Definition { | 2924 class ParameterInstr : public Definition { |
2807 public: | 2925 public: |
2808 explicit ParameterInstr(intptr_t index) : index_(index) { } | 2926 explicit ParameterInstr(intptr_t index) : index_(index) { } |
2809 | 2927 |
2810 DECLARE_INSTRUCTION(Parameter) | 2928 DECLARE_INSTRUCTION(Parameter) |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2865 } | 2983 } |
2866 return locs_; | 2984 return locs_; |
2867 } | 2985 } |
2868 | 2986 |
2869 LocationSummary* MakeLocationSummary() const; | 2987 LocationSummary* MakeLocationSummary() const; |
2870 | 2988 |
2871 virtual void EmitNativeCode(FlowGraphCompiler* compiler); | 2989 virtual void EmitNativeCode(FlowGraphCompiler* compiler); |
2872 | 2990 |
2873 virtual bool CanDeoptimize() const { return false; } | 2991 virtual bool CanDeoptimize() const { return false; } |
2874 | 2992 |
2875 bool WasEliminated() const { | |
2876 return next() == NULL; | |
2877 } | |
2878 | |
2879 private: | 2993 private: |
2880 Value* value_; | 2994 Value* value_; |
2881 LocationSummary* locs_; | 2995 LocationSummary* locs_; |
2882 | 2996 |
2883 DISALLOW_COPY_AND_ASSIGN(PushArgumentInstr); | 2997 DISALLOW_COPY_AND_ASSIGN(PushArgumentInstr); |
2884 }; | 2998 }; |
2885 | 2999 |
2886 | 3000 |
2887 class ReturnInstr : public TemplateInstruction<1> { | 3001 class ReturnInstr : public TemplateInstruction<1> { |
2888 public: | 3002 public: |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3078 virtual LocationSummary* locs() { | 3192 virtual LocationSummary* locs() { |
3079 if (computation_->locs_ == NULL) { | 3193 if (computation_->locs_ == NULL) { |
3080 LocationSummary* summary = computation_->MakeLocationSummary(); | 3194 LocationSummary* summary = computation_->MakeLocationSummary(); |
3081 // Branches don't produce a result. | 3195 // Branches don't produce a result. |
3082 summary->set_out(Location::NoLocation()); | 3196 summary->set_out(Location::NoLocation()); |
3083 computation_->locs_ = summary; | 3197 computation_->locs_ = summary; |
3084 } | 3198 } |
3085 return computation_->locs_; | 3199 return computation_->locs_; |
3086 } | 3200 } |
3087 | 3201 |
| 3202 virtual intptr_t DeoptimizationTarget() const { |
| 3203 return computation_->DeoptimizationTarget(); |
| 3204 } |
| 3205 |
| 3206 virtual Representation RequiredInputRepresentation(intptr_t i) const { |
| 3207 return computation()->RequiredInputRepresentation(i); |
| 3208 } |
| 3209 |
3088 private: | 3210 private: |
3089 ComparisonComp* computation_; | 3211 ComparisonComp* computation_; |
3090 LocationSummary* locs_; | 3212 LocationSummary* locs_; |
3091 | 3213 |
3092 DISALLOW_COPY_AND_ASSIGN(BranchInstr); | 3214 DISALLOW_COPY_AND_ASSIGN(BranchInstr); |
3093 }; | 3215 }; |
3094 | 3216 |
3095 | 3217 |
3096 #undef DECLARE_INSTRUCTION | 3218 #undef DECLARE_INSTRUCTION |
3097 | 3219 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3182 ForwardInstructionIterator* current_iterator_; | 3304 ForwardInstructionIterator* current_iterator_; |
3183 | 3305 |
3184 private: | 3306 private: |
3185 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 3307 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
3186 }; | 3308 }; |
3187 | 3309 |
3188 | 3310 |
3189 } // namespace dart | 3311 } // namespace dart |
3190 | 3312 |
3191 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 3313 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
OLD | NEW |