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

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: More tweaks 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
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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 V(CallRuntime) \ 88 V(CallRuntime) \
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(CheckPrototypeMaps) \ 95 V(CheckPrototypeMaps) \
96 V(ClampToUint8) \ 96 V(ClampToUint8) \
97 V(ClassOfTestAndBranch) \ 97 V(ClassOfTestAndBranch) \
98 V(CompareIDAndBranch) \ 98 V(CompareNumericAndBranch) \
99 V(CompareGeneric) \ 99 V(CompareGeneric) \
100 V(CompareObjectEqAndBranch) \ 100 V(CompareObjectEqAndBranch) \
101 V(CompareMap) \ 101 V(CompareMap) \
102 V(CompareConstantEqAndBranch) \ 102 V(CompareConstantEqAndBranch) \
103 V(Constant) \ 103 V(Constant) \
104 V(Context) \ 104 V(Context) \
105 V(DebugBreak) \ 105 V(DebugBreak) \
106 V(DeclareGlobals) \ 106 V(DeclareGlobals) \
107 V(DeleteProperty) \ 107 V(DeleteProperty) \
108 V(Deoptimize) \ 108 V(Deoptimize) \
(...skipping 1485 matching lines...) Expand 10 before | Expand all | Expand 10 after
1594 1594
1595 virtual void PrintDataTo(StringStream* stream); 1595 virtual void PrintDataTo(StringStream* stream);
1596 1596
1597 HValue* value() { return OperandAt(0); } 1597 HValue* value() { return OperandAt(0); }
1598 }; 1598 };
1599 1599
1600 1600
1601 class HBranch: public HUnaryControlInstruction { 1601 class HBranch: public HUnaryControlInstruction {
1602 public: 1602 public:
1603 HBranch(HValue* value, 1603 HBranch(HValue* value,
1604 HBasicBlock* true_target, 1604 ToBooleanStub::Types expected_input_types = ToBooleanStub::Types(),
1605 HBasicBlock* false_target, 1605 HBasicBlock* true_target = NULL,
1606 ToBooleanStub::Types expected_input_types = ToBooleanStub::Types()) 1606 HBasicBlock* false_target = NULL)
1607 : HUnaryControlInstruction(value, true_target, false_target), 1607 : HUnaryControlInstruction(value, true_target, false_target),
1608 expected_input_types_(expected_input_types) { 1608 expected_input_types_(expected_input_types) {
1609 ASSERT(true_target != NULL && false_target != NULL);
1610 SetFlag(kAllowUndefinedAsNaN);
1611 }
1612 explicit HBranch(HValue* value)
1613 : HUnaryControlInstruction(value, NULL, NULL) {
1614 SetFlag(kAllowUndefinedAsNaN);
1615 }
1616 HBranch(HValue* value, ToBooleanStub::Types expected_input_types)
1617 : HUnaryControlInstruction(value, NULL, NULL),
1618 expected_input_types_(expected_input_types) {
1619 SetFlag(kAllowUndefinedAsNaN); 1609 SetFlag(kAllowUndefinedAsNaN);
1620 } 1610 }
1621 1611
1622 virtual Representation RequiredInputRepresentation(int index) { 1612 virtual Representation RequiredInputRepresentation(int index) {
1623 return Representation::None(); 1613 return Representation::None();
1624 } 1614 }
1625 virtual Representation observed_input_representation(int index); 1615 virtual Representation observed_input_representation(int index);
1626 1616
1627 ToBooleanStub::Types expected_input_types() const { 1617 ToBooleanStub::Types expected_input_types() const {
1628 return expected_input_types_; 1618 return expected_input_types_;
1629 } 1619 }
1630 1620
1631 DECLARE_CONCRETE_INSTRUCTION(Branch) 1621 DECLARE_CONCRETE_INSTRUCTION(Branch)
1632 1622
1633 private: 1623 private:
1634 ToBooleanStub::Types expected_input_types_; 1624 ToBooleanStub::Types expected_input_types_;
1635 }; 1625 };
1636 1626
1637 1627
1638 class HCompareMap: public HUnaryControlInstruction { 1628 class HCompareMap: public HUnaryControlInstruction {
1639 public: 1629 public:
1640 HCompareMap(HValue* value, 1630 HCompareMap(HValue* value, Handle<Map> map,
Michael Starzinger 2013/07/01 12:30:39 nit: One parameter per line.
danno 2013/07/05 09:52:39 Done.
1641 Handle<Map> map, 1631 HBasicBlock* true_target = NULL,
1642 HBasicBlock* true_target, 1632 HBasicBlock* false_target = NULL)
1643 HBasicBlock* false_target)
1644 : HUnaryControlInstruction(value, true_target, false_target), 1633 : HUnaryControlInstruction(value, true_target, false_target),
1645 map_(map) { 1634 map_(map) {
1646 ASSERT(true_target != NULL);
1647 ASSERT(false_target != NULL);
1648 ASSERT(!map.is_null()); 1635 ASSERT(!map.is_null());
1649 } 1636 }
1650 1637
1651 virtual void PrintDataTo(StringStream* stream); 1638 virtual void PrintDataTo(StringStream* stream);
1652 1639
1653 Handle<Map> map() const { return map_; } 1640 Handle<Map> map() const { return map_; }
1654 1641
1655 virtual Representation RequiredInputRepresentation(int index) { 1642 virtual Representation RequiredInputRepresentation(int index) {
1656 return Representation::Tagged(); 1643 return Representation::Tagged();
1657 } 1644 }
(...skipping 2266 matching lines...) Expand 10 before | Expand all | Expand 10 after
3924 3911
3925 virtual HType CalculateInferredType(); 3912 virtual HType CalculateInferredType();
3926 3913
3927 DECLARE_CONCRETE_INSTRUCTION(CompareGeneric) 3914 DECLARE_CONCRETE_INSTRUCTION(CompareGeneric)
3928 3915
3929 private: 3916 private:
3930 Token::Value token_; 3917 Token::Value token_;
3931 }; 3918 };
3932 3919
3933 3920
3934 class HCompareIDAndBranch: public HTemplateControlInstruction<2, 2> { 3921 class HCompareNumericAndBranch: public HTemplateControlInstruction<2, 2> {
3935 public: 3922 public:
3936 HCompareIDAndBranch(HValue* left, HValue* right, Token::Value token) 3923 HCompareNumericAndBranch(HValue* left, HValue* right, Token::Value token)
3937 : token_(token) { 3924 : token_(token) {
3938 SetFlag(kFlexibleRepresentation); 3925 SetFlag(kFlexibleRepresentation);
3939 ASSERT(Token::IsCompareOp(token)); 3926 ASSERT(Token::IsCompareOp(token));
3940 SetOperandAt(0, left); 3927 SetOperandAt(0, left);
3941 SetOperandAt(1, right); 3928 SetOperandAt(1, right);
3942 } 3929 }
3943 3930
3944 HValue* left() { return OperandAt(0); } 3931 HValue* left() { return OperandAt(0); }
3945 HValue* right() { return OperandAt(1); } 3932 HValue* right() { return OperandAt(1); }
3946 Token::Value token() const { return token_; } 3933 Token::Value token() const { return token_; }
3947 3934
3948 void set_observed_input_representation(Representation left, 3935 void set_observed_input_representation(Representation left,
3949 Representation right) { 3936 Representation right) {
3950 observed_input_representation_[0] = left; 3937 observed_input_representation_[0] = left;
3951 observed_input_representation_[1] = right; 3938 observed_input_representation_[1] = right;
3952 } 3939 }
3953 3940
3954 virtual void InferRepresentation(HInferRepresentationPhase* h_infer); 3941 virtual void InferRepresentation(HInferRepresentationPhase* h_infer);
3955 3942
3956 virtual Representation RequiredInputRepresentation(int index) { 3943 virtual Representation RequiredInputRepresentation(int index) {
3957 return representation(); 3944 return representation();
3958 } 3945 }
3959 virtual Representation observed_input_representation(int index) { 3946 virtual Representation observed_input_representation(int index) {
3960 return observed_input_representation_[index]; 3947 return observed_input_representation_[index];
3961 } 3948 }
3962 virtual void PrintDataTo(StringStream* stream); 3949 virtual void PrintDataTo(StringStream* stream);
3963 3950
3964 virtual void AddInformativeDefinitions(); 3951 virtual void AddInformativeDefinitions();
3965 3952
3966 DECLARE_CONCRETE_INSTRUCTION(CompareIDAndBranch) 3953 DECLARE_CONCRETE_INSTRUCTION(CompareNumericAndBranch)
3967 3954
3968 private: 3955 private:
3969 Representation observed_input_representation_[2]; 3956 Representation observed_input_representation_[2];
3970 Token::Value token_; 3957 Token::Value token_;
3971 }; 3958 };
3972 3959
3973 3960
3974 class HCompareObjectEqAndBranch: public HTemplateControlInstruction<2, 2> { 3961 class HCompareObjectEqAndBranch: public HTemplateControlInstruction<2, 2> {
3975 public: 3962 public:
3976 HCompareObjectEqAndBranch(HValue* left, HValue* right) { 3963 HCompareObjectEqAndBranch(HValue* left, HValue* right) {
(...skipping 2675 matching lines...) Expand 10 before | Expand all | Expand 10 after
6652 virtual bool IsDeletable() const { return true; } 6639 virtual bool IsDeletable() const { return true; }
6653 }; 6640 };
6654 6641
6655 6642
6656 #undef DECLARE_INSTRUCTION 6643 #undef DECLARE_INSTRUCTION
6657 #undef DECLARE_CONCRETE_INSTRUCTION 6644 #undef DECLARE_CONCRETE_INSTRUCTION
6658 6645
6659 } } // namespace v8::internal 6646 } } // namespace v8::internal
6660 6647
6661 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 6648 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« src/hydrogen.cc ('K') | « src/hydrogen.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698