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

Side by Side Diff: src/hydrogen-instructions.h

Issue 18331004: Refactoring and cleanup of control instructions (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebase to ToT Created 7 years, 5 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
« no previous file with comments | « src/hydrogen.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 V(CallStub) \ 89 V(CallStub) \
90 V(Change) \ 90 V(Change) \
91 V(CheckFunction) \ 91 V(CheckFunction) \
92 V(CheckHeapObject) \ 92 V(CheckHeapObject) \
93 V(CheckInstanceType) \ 93 V(CheckInstanceType) \
94 V(CheckMaps) \ 94 V(CheckMaps) \
95 V(CheckSmi) \ 95 V(CheckSmi) \
96 V(CheckPrototypeMaps) \ 96 V(CheckPrototypeMaps) \
97 V(ClampToUint8) \ 97 V(ClampToUint8) \
98 V(ClassOfTestAndBranch) \ 98 V(ClassOfTestAndBranch) \
99 V(CompareIDAndBranch) \ 99 V(CompareNumericAndBranch) \
100 V(CompareGeneric) \ 100 V(CompareGeneric) \
101 V(CompareObjectEqAndBranch) \ 101 V(CompareObjectEqAndBranch) \
102 V(CompareMap) \ 102 V(CompareMap) \
103 V(CompareConstantEqAndBranch) \ 103 V(CompareConstantEqAndBranch) \
104 V(Constant) \ 104 V(Constant) \
105 V(Context) \ 105 V(Context) \
106 V(DebugBreak) \ 106 V(DebugBreak) \
107 V(DeclareGlobals) \ 107 V(DeclareGlobals) \
108 V(DeleteProperty) \ 108 V(DeleteProperty) \
109 V(Deoptimize) \ 109 V(Deoptimize) \
(...skipping 1489 matching lines...) Expand 10 before | Expand all | Expand 10 after
1599 1599
1600 virtual void PrintDataTo(StringStream* stream); 1600 virtual void PrintDataTo(StringStream* stream);
1601 1601
1602 HValue* value() { return OperandAt(0); } 1602 HValue* value() { return OperandAt(0); }
1603 }; 1603 };
1604 1604
1605 1605
1606 class HBranch: public HUnaryControlInstruction { 1606 class HBranch: public HUnaryControlInstruction {
1607 public: 1607 public:
1608 HBranch(HValue* value, 1608 HBranch(HValue* value,
1609 HBasicBlock* true_target, 1609 ToBooleanStub::Types expected_input_types = ToBooleanStub::Types(),
1610 HBasicBlock* false_target, 1610 HBasicBlock* true_target = NULL,
1611 ToBooleanStub::Types expected_input_types = ToBooleanStub::Types()) 1611 HBasicBlock* false_target = NULL)
1612 : HUnaryControlInstruction(value, true_target, false_target), 1612 : HUnaryControlInstruction(value, true_target, false_target),
1613 expected_input_types_(expected_input_types) { 1613 expected_input_types_(expected_input_types) {
1614 ASSERT(true_target != NULL && false_target != NULL);
1615 SetFlag(kAllowUndefinedAsNaN);
1616 }
1617 explicit HBranch(HValue* value)
1618 : HUnaryControlInstruction(value, NULL, NULL) {
1619 SetFlag(kAllowUndefinedAsNaN);
1620 }
1621 HBranch(HValue* value, ToBooleanStub::Types expected_input_types)
1622 : HUnaryControlInstruction(value, NULL, NULL),
1623 expected_input_types_(expected_input_types) {
1624 SetFlag(kAllowUndefinedAsNaN); 1614 SetFlag(kAllowUndefinedAsNaN);
1625 } 1615 }
1626 1616
1627 virtual Representation RequiredInputRepresentation(int index) { 1617 virtual Representation RequiredInputRepresentation(int index) {
1628 return Representation::None(); 1618 return Representation::None();
1629 } 1619 }
1630 virtual Representation observed_input_representation(int index); 1620 virtual Representation observed_input_representation(int index);
1631 1621
1632 ToBooleanStub::Types expected_input_types() const { 1622 ToBooleanStub::Types expected_input_types() const {
1633 return expected_input_types_; 1623 return expected_input_types_;
1634 } 1624 }
1635 1625
1636 DECLARE_CONCRETE_INSTRUCTION(Branch) 1626 DECLARE_CONCRETE_INSTRUCTION(Branch)
1637 1627
1638 private: 1628 private:
1639 ToBooleanStub::Types expected_input_types_; 1629 ToBooleanStub::Types expected_input_types_;
1640 }; 1630 };
1641 1631
1642 1632
1643 class HCompareMap: public HUnaryControlInstruction { 1633 class HCompareMap: public HUnaryControlInstruction {
1644 public: 1634 public:
1645 HCompareMap(HValue* value, 1635 HCompareMap(HValue* value,
1646 Handle<Map> map, 1636 Handle<Map> map,
1647 HBasicBlock* true_target, 1637 HBasicBlock* true_target = NULL,
1648 HBasicBlock* false_target) 1638 HBasicBlock* false_target = NULL)
1649 : HUnaryControlInstruction(value, true_target, false_target), 1639 : HUnaryControlInstruction(value, true_target, false_target),
1650 map_(map) { 1640 map_(map) {
1651 ASSERT(true_target != NULL);
1652 ASSERT(false_target != NULL);
1653 ASSERT(!map.is_null()); 1641 ASSERT(!map.is_null());
1654 } 1642 }
1655 1643
1656 virtual void PrintDataTo(StringStream* stream); 1644 virtual void PrintDataTo(StringStream* stream);
1657 1645
1658 Handle<Map> map() const { return map_; } 1646 Handle<Map> map() const { return map_; }
1659 1647
1660 virtual Representation RequiredInputRepresentation(int index) { 1648 virtual Representation RequiredInputRepresentation(int index) {
1661 return Representation::Tagged(); 1649 return Representation::Tagged();
1662 } 1650 }
(...skipping 2290 matching lines...) Expand 10 before | Expand all | Expand 10 after
3953 3941
3954 virtual HType CalculateInferredType(); 3942 virtual HType CalculateInferredType();
3955 3943
3956 DECLARE_CONCRETE_INSTRUCTION(CompareGeneric) 3944 DECLARE_CONCRETE_INSTRUCTION(CompareGeneric)
3957 3945
3958 private: 3946 private:
3959 Token::Value token_; 3947 Token::Value token_;
3960 }; 3948 };
3961 3949
3962 3950
3963 class HCompareIDAndBranch: public HTemplateControlInstruction<2, 2> { 3951 class HCompareNumericAndBranch: public HTemplateControlInstruction<2, 2> {
3964 public: 3952 public:
3965 HCompareIDAndBranch(HValue* left, HValue* right, Token::Value token) 3953 HCompareNumericAndBranch(HValue* left, HValue* right, Token::Value token)
3966 : token_(token) { 3954 : token_(token) {
3967 SetFlag(kFlexibleRepresentation); 3955 SetFlag(kFlexibleRepresentation);
3968 ASSERT(Token::IsCompareOp(token)); 3956 ASSERT(Token::IsCompareOp(token));
3969 SetOperandAt(0, left); 3957 SetOperandAt(0, left);
3970 SetOperandAt(1, right); 3958 SetOperandAt(1, right);
3971 } 3959 }
3972 3960
3973 HValue* left() { return OperandAt(0); } 3961 HValue* left() { return OperandAt(0); }
3974 HValue* right() { return OperandAt(1); } 3962 HValue* right() { return OperandAt(1); }
3975 Token::Value token() const { return token_; } 3963 Token::Value token() const { return token_; }
3976 3964
3977 void set_observed_input_representation(Representation left, 3965 void set_observed_input_representation(Representation left,
3978 Representation right) { 3966 Representation right) {
3979 observed_input_representation_[0] = left; 3967 observed_input_representation_[0] = left;
3980 observed_input_representation_[1] = right; 3968 observed_input_representation_[1] = right;
3981 } 3969 }
3982 3970
3983 virtual void InferRepresentation(HInferRepresentationPhase* h_infer); 3971 virtual void InferRepresentation(HInferRepresentationPhase* h_infer);
3984 3972
3985 virtual Representation RequiredInputRepresentation(int index) { 3973 virtual Representation RequiredInputRepresentation(int index) {
3986 return representation(); 3974 return representation();
3987 } 3975 }
3988 virtual Representation observed_input_representation(int index) { 3976 virtual Representation observed_input_representation(int index) {
3989 return observed_input_representation_[index]; 3977 return observed_input_representation_[index];
3990 } 3978 }
3991 virtual void PrintDataTo(StringStream* stream); 3979 virtual void PrintDataTo(StringStream* stream);
3992 3980
3993 virtual void AddInformativeDefinitions(); 3981 virtual void AddInformativeDefinitions();
3994 3982
3995 DECLARE_CONCRETE_INSTRUCTION(CompareIDAndBranch) 3983 DECLARE_CONCRETE_INSTRUCTION(CompareNumericAndBranch)
3996 3984
3997 private: 3985 private:
3998 Representation observed_input_representation_[2]; 3986 Representation observed_input_representation_[2];
3999 Token::Value token_; 3987 Token::Value token_;
4000 }; 3988 };
4001 3989
4002 3990
4003 class HCompareObjectEqAndBranch: public HTemplateControlInstruction<2, 2> { 3991 class HCompareObjectEqAndBranch: public HTemplateControlInstruction<2, 2> {
4004 public: 3992 public:
4005 HCompareObjectEqAndBranch(HValue* left, HValue* right) { 3993 HCompareObjectEqAndBranch(HValue* left, HValue* right) {
(...skipping 2688 matching lines...) Expand 10 before | Expand all | Expand 10 after
6694 virtual bool IsDeletable() const { return true; } 6682 virtual bool IsDeletable() const { return true; }
6695 }; 6683 };
6696 6684
6697 6685
6698 #undef DECLARE_INSTRUCTION 6686 #undef DECLARE_INSTRUCTION
6699 #undef DECLARE_CONCRETE_INSTRUCTION 6687 #undef DECLARE_CONCRETE_INSTRUCTION
6700 6688
6701 } } // namespace v8::internal 6689 } } // namespace v8::internal
6702 6690
6703 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 6691 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698