| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 M(ExtractConstructorInstantiator, ExtractConstructorInstantiatorComp) \ | 93 M(ExtractConstructorInstantiator, ExtractConstructorInstantiatorComp) \ |
| 94 M(AllocateContext, AllocateContextComp) \ | 94 M(AllocateContext, AllocateContextComp) \ |
| 95 M(ChainContext, ChainContextComp) \ | 95 M(ChainContext, ChainContextComp) \ |
| 96 M(CloneContext, CloneContextComp) \ | 96 M(CloneContext, CloneContextComp) \ |
| 97 M(CatchEntry, CatchEntryComp) \ | 97 M(CatchEntry, CatchEntryComp) \ |
| 98 M(BinaryOp, BinaryOpComp) \ | 98 M(BinaryOp, BinaryOpComp) \ |
| 99 M(DoubleBinaryOp, DoubleBinaryOpComp) \ | 99 M(DoubleBinaryOp, DoubleBinaryOpComp) \ |
| 100 M(UnarySmiOp, UnarySmiOpComp) \ | 100 M(UnarySmiOp, UnarySmiOpComp) \ |
| 101 M(NumberNegate, NumberNegateComp) \ | 101 M(NumberNegate, NumberNegateComp) \ |
| 102 M(CheckStackOverflow, CheckStackOverflowComp) \ | 102 M(CheckStackOverflow, CheckStackOverflowComp) \ |
| 103 M(ToDouble, ToDoubleComp) \ | 103 M(DoubleToDouble, DoubleToDoubleComp) \ |
| 104 M(SmiToDouble, SmiToDoubleComp) |
| 104 | 105 |
| 105 | 106 |
| 106 #define FORWARD_DECLARATION(ShortName, ClassName) class ClassName; | 107 #define FORWARD_DECLARATION(ShortName, ClassName) class ClassName; |
| 107 FOR_EACH_COMPUTATION(FORWARD_DECLARATION) | 108 FOR_EACH_COMPUTATION(FORWARD_DECLARATION) |
| 108 #undef FORWARD_DECLARATION | 109 #undef FORWARD_DECLARATION |
| 109 | 110 |
| 110 // Forward declarations. | 111 // Forward declarations. |
| 111 class BindInstr; | 112 class BindInstr; |
| 112 class BranchInstr; | 113 class BranchInstr; |
| 113 class BufferFormatter; | 114 class BufferFormatter; |
| (...skipping 1586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1700 virtual bool CanDeoptimize() const { return false; } | 1701 virtual bool CanDeoptimize() const { return false; } |
| 1701 | 1702 |
| 1702 private: | 1703 private: |
| 1703 const intptr_t token_pos_; | 1704 const intptr_t token_pos_; |
| 1704 const intptr_t try_index_; | 1705 const intptr_t try_index_; |
| 1705 | 1706 |
| 1706 DISALLOW_COPY_AND_ASSIGN(CheckStackOverflowComp); | 1707 DISALLOW_COPY_AND_ASSIGN(CheckStackOverflowComp); |
| 1707 }; | 1708 }; |
| 1708 | 1709 |
| 1709 | 1710 |
| 1710 class ToDoubleComp : public TemplateComputation<1> { | 1711 class DoubleToDoubleComp : public TemplateComputation<1> { |
| 1711 public: | 1712 public: |
| 1712 ToDoubleComp(Value* value, | 1713 DoubleToDoubleComp(Value* value, InstanceCallComp* instance_call) |
| 1713 intptr_t from, | 1714 : instance_call_(instance_call) { |
| 1714 InstanceCallComp* instance_call) | |
| 1715 : from_(from), instance_call_(instance_call) { | |
| 1716 ASSERT(value != NULL); | 1715 ASSERT(value != NULL); |
| 1717 inputs_[0] = value; | 1716 inputs_[0] = value; |
| 1718 } | 1717 } |
| 1719 | 1718 |
| 1720 Value* value() const { return inputs_[0]; } | 1719 Value* value() const { return inputs_[0]; } |
| 1721 intptr_t from() const { return from_; } | |
| 1722 | 1720 |
| 1723 InstanceCallComp* instance_call() const { return instance_call_; } | 1721 InstanceCallComp* instance_call() const { return instance_call_; } |
| 1724 | 1722 |
| 1725 virtual void PrintOperandsTo(BufferFormatter* f) const; | 1723 DECLARE_COMPUTATION(DoubleToDouble) |
| 1726 | |
| 1727 DECLARE_COMPUTATION(ToDouble) | |
| 1728 | 1724 |
| 1729 virtual bool CanDeoptimize() const { return true; } | 1725 virtual bool CanDeoptimize() const { return true; } |
| 1730 | 1726 |
| 1731 private: | 1727 private: |
| 1732 const intptr_t from_; | |
| 1733 InstanceCallComp* instance_call_; | 1728 InstanceCallComp* instance_call_; |
| 1734 | 1729 |
| 1735 DISALLOW_COPY_AND_ASSIGN(ToDoubleComp); | 1730 DISALLOW_COPY_AND_ASSIGN(DoubleToDoubleComp); |
| 1736 }; | 1731 }; |
| 1737 | 1732 |
| 1738 | 1733 |
| 1734 class SmiToDoubleComp : public TemplateComputation<0> { |
| 1735 public: |
| 1736 explicit SmiToDoubleComp(InstanceCallComp* instance_call) |
| 1737 : instance_call_(instance_call) { } |
| 1738 |
| 1739 InstanceCallComp* instance_call() const { return instance_call_; } |
| 1740 |
| 1741 DECLARE_CALL_COMPUTATION(SmiToDouble) |
| 1742 |
| 1743 virtual intptr_t ArgumentCount() const { return 1; } |
| 1744 |
| 1745 virtual bool CanDeoptimize() const { return true; } |
| 1746 |
| 1747 private: |
| 1748 InstanceCallComp* instance_call_; |
| 1749 |
| 1750 DISALLOW_COPY_AND_ASSIGN(SmiToDoubleComp); |
| 1751 }; |
| 1752 |
| 1753 |
| 1739 #undef DECLARE_COMPUTATION | 1754 #undef DECLARE_COMPUTATION |
| 1740 | 1755 |
| 1741 | 1756 |
| 1742 // Implementation of type testers and cast functins. | 1757 // Implementation of type testers and cast functins. |
| 1743 #define DEFINE_PREDICATE(ShortName, ClassName) \ | 1758 #define DEFINE_PREDICATE(ShortName, ClassName) \ |
| 1744 bool Computation::Is##ShortName() const { \ | 1759 bool Computation::Is##ShortName() const { \ |
| 1745 return computation_kind() == k##ShortName; \ | 1760 return computation_kind() == k##ShortName; \ |
| 1746 } \ | 1761 } \ |
| 1747 const ClassName* Computation::As##ShortName() const { \ | 1762 const ClassName* Computation::As##ShortName() const { \ |
| 1748 if (!Is##ShortName()) return NULL; \ | 1763 if (!Is##ShortName()) return NULL; \ |
| (...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2907 const GrowableArray<BlockEntryInstr*>& block_order_; | 2922 const GrowableArray<BlockEntryInstr*>& block_order_; |
| 2908 | 2923 |
| 2909 private: | 2924 private: |
| 2910 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 2925 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 2911 }; | 2926 }; |
| 2912 | 2927 |
| 2913 | 2928 |
| 2914 } // namespace dart | 2929 } // namespace dart |
| 2915 | 2930 |
| 2916 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 2931 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |