Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(245)

Side by Side Diff: vm/intermediate_language.h

Issue 10834311: Split ToDouble into two IL instruction to make it work with SSA. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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)
srdjan 2012/08/14 21:21:26 Don't need instance_call, pass int deopt_id and tr
Florian Schneider 2012/08/15 10:27:23 Since the deopt_id has to agree for correctness, I
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> {
srdjan 2012/08/14 21:21:26 Shouldn't this be TemplateComputation<1> ?
Florian Schneider 2012/08/15 10:27:23 This instruction is implemented as call with pushe
1735 public:
1736 explicit SmiToDoubleComp(InstanceCallComp* instance_call)
1737 : instance_call_(instance_call) { }
1738
1739 Value* value() const { return inputs_[0]; }
Florian Schneider 2012/08/15 10:27:23 I forgot to remove this function. I'll remove it b
1740
1741 InstanceCallComp* instance_call() const { return instance_call_; }
1742
1743 DECLARE_CALL_COMPUTATION(SmiToDouble)
1744
1745 virtual intptr_t ArgumentCount() const { return 1; }
1746
1747 virtual bool CanDeoptimize() const { return true; }
1748
1749 private:
1750 InstanceCallComp* instance_call_;
1751
1752 DISALLOW_COPY_AND_ASSIGN(SmiToDoubleComp);
1753 };
1754
1755
1739 #undef DECLARE_COMPUTATION 1756 #undef DECLARE_COMPUTATION
1740 1757
1741 1758
1742 // Implementation of type testers and cast functins. 1759 // Implementation of type testers and cast functins.
1743 #define DEFINE_PREDICATE(ShortName, ClassName) \ 1760 #define DEFINE_PREDICATE(ShortName, ClassName) \
1744 bool Computation::Is##ShortName() const { \ 1761 bool Computation::Is##ShortName() const { \
1745 return computation_kind() == k##ShortName; \ 1762 return computation_kind() == k##ShortName; \
1746 } \ 1763 } \
1747 const ClassName* Computation::As##ShortName() const { \ 1764 const ClassName* Computation::As##ShortName() const { \
1748 if (!Is##ShortName()) return NULL; \ 1765 if (!Is##ShortName()) return NULL; \
(...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after
2907 const GrowableArray<BlockEntryInstr*>& block_order_; 2924 const GrowableArray<BlockEntryInstr*>& block_order_;
2908 2925
2909 private: 2926 private:
2910 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 2927 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
2911 }; 2928 };
2912 2929
2913 2930
2914 } // namespace dart 2931 } // namespace dart
2915 2932
2916 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 2933 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698