OLD | NEW |
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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 V(CheckHeapObject) \ | 91 V(CheckHeapObject) \ |
92 V(CheckInstanceType) \ | 92 V(CheckInstanceType) \ |
93 V(CheckMaps) \ | 93 V(CheckMaps) \ |
94 V(CheckMapValue) \ | 94 V(CheckMapValue) \ |
95 V(CheckSmi) \ | 95 V(CheckSmi) \ |
96 V(CheckValue) \ | 96 V(CheckValue) \ |
97 V(ClampToUint8) \ | 97 V(ClampToUint8) \ |
98 V(ClassOfTestAndBranch) \ | 98 V(ClassOfTestAndBranch) \ |
99 V(CompareNumericAndBranch) \ | 99 V(CompareNumericAndBranch) \ |
100 V(CompareHoleAndBranch) \ | 100 V(CompareHoleAndBranch) \ |
101 V(CompareGenericAndBranch) \ | 101 V(CompareGeneric) \ |
102 V(CompareObjectEqAndBranch) \ | 102 V(CompareObjectEqAndBranch) \ |
103 V(CompareMap) \ | 103 V(CompareMap) \ |
104 V(Constant) \ | 104 V(Constant) \ |
105 V(Context) \ | 105 V(Context) \ |
106 V(DateField) \ | 106 V(DateField) \ |
107 V(DebugBreak) \ | 107 V(DebugBreak) \ |
108 V(DeclareGlobals) \ | 108 V(DeclareGlobals) \ |
109 V(Deoptimize) \ | 109 V(Deoptimize) \ |
110 V(Div) \ | 110 V(Div) \ |
111 V(DummyUse) \ | 111 V(DummyUse) \ |
(...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1062 int flags_; | 1062 int flags_; |
1063 GVNFlagSet gvn_flags_; | 1063 GVNFlagSet gvn_flags_; |
1064 | 1064 |
1065 private: | 1065 private: |
1066 virtual bool IsDeletable() const { return false; } | 1066 virtual bool IsDeletable() const { return false; } |
1067 | 1067 |
1068 DISALLOW_COPY_AND_ASSIGN(HValue); | 1068 DISALLOW_COPY_AND_ASSIGN(HValue); |
1069 }; | 1069 }; |
1070 | 1070 |
1071 | 1071 |
1072 #define DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P0(I) \ | |
1073 static I* New(Zone* zone, HValue* context) { \ | |
1074 return new(zone) I(context); \ | |
1075 } | |
1076 | |
1077 #define DECLARE_INSTRUCTION_FACTORY_P0(I) \ | 1072 #define DECLARE_INSTRUCTION_FACTORY_P0(I) \ |
1078 static I* New(Zone* zone, HValue* context) { \ | 1073 static I* New(Zone* zone, HValue* context) { \ |
1079 return new(zone) I(); \ | 1074 return new(zone) I(); \ |
1080 } | 1075 } |
1081 | 1076 |
1082 #define DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(I, P1) \ | |
1083 static I* New(Zone* zone, HValue* context, P1 p1) { \ | |
1084 return new(zone) I(context, p1); \ | |
1085 } | |
1086 | |
1087 #define DECLARE_INSTRUCTION_FACTORY_P1(I, P1) \ | 1077 #define DECLARE_INSTRUCTION_FACTORY_P1(I, P1) \ |
1088 static I* New(Zone* zone, HValue* context, P1 p1) { \ | 1078 static I* New(Zone* zone, HValue* context, P1 p1) { \ |
1089 return new(zone) I(p1); \ | 1079 return new(zone) I(p1); \ |
1090 } | 1080 } |
1091 | 1081 |
1092 #define DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(I, P1, P2) \ | |
1093 static I* New(Zone* zone, HValue* context, P1 p1, P2 p2) { \ | |
1094 return new(zone) I(context, p1, p2); \ | |
1095 } | |
1096 | |
1097 #define DECLARE_INSTRUCTION_FACTORY_P2(I, P1, P2) \ | 1082 #define DECLARE_INSTRUCTION_FACTORY_P2(I, P1, P2) \ |
1098 static I* New(Zone* zone, HValue* context, P1 p1, P2 p2) { \ | 1083 static I* New(Zone* zone, HValue* context, P1 p1, P2 p2) { \ |
1099 return new(zone) I(p1, p2); \ | 1084 return new(zone) I(p1, p2); \ |
1100 } | 1085 } |
1101 | 1086 |
1102 #define DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(I, P1, P2, P3) \ | |
1103 static I* New(Zone* zone, HValue* context, P1 p1, P2 p2, P3 p3) { \ | |
1104 return new(zone) I(context, p1, p2, p3); \ | |
1105 } | |
1106 | |
1107 #define DECLARE_INSTRUCTION_FACTORY_P3(I, P1, P2, P3) \ | 1087 #define DECLARE_INSTRUCTION_FACTORY_P3(I, P1, P2, P3) \ |
1108 static I* New(Zone* zone, HValue* context, P1 p1, P2 p2, P3 p3) { \ | 1088 static I* New(Zone* zone, HValue* context, P1 p1, P2 p2, P3 p3) { \ |
1109 return new(zone) I(p1, p2, p3); \ | 1089 return new(zone) I(p1, p2, p3); \ |
1110 } | 1090 } |
1111 | 1091 |
1112 #define DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(I, P1, P2, P3, P4) \ | |
1113 static I* New(Zone* zone, \ | |
1114 HValue* context, \ | |
1115 P1 p1, \ | |
1116 P2 p2, \ | |
1117 P3 p3, \ | |
1118 P4 p4) { \ | |
1119 return new(zone) I(context, p1, p2, p3, p4); \ | |
1120 } | |
1121 | |
1122 #define DECLARE_INSTRUCTION_FACTORY_P4(I, P1, P2, P3, P4) \ | 1092 #define DECLARE_INSTRUCTION_FACTORY_P4(I, P1, P2, P3, P4) \ |
1123 static I* New(Zone* zone, \ | 1093 static I* New(Zone* zone, \ |
1124 HValue* context, \ | 1094 HValue* context, \ |
1125 P1 p1, \ | 1095 P1 p1, \ |
1126 P2 p2, \ | 1096 P2 p2, \ |
1127 P3 p3, \ | 1097 P3 p3, \ |
1128 P4 p4) { \ | 1098 P4 p4) { \ |
1129 return new(zone) I(p1, p2, p3, p4); \ | 1099 return new(zone) I(p1, p2, p3, p4); \ |
1130 } | 1100 } |
1131 | 1101 |
1132 #define DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P5(I, P1, P2, P3, P4, P5) \ | |
1133 static I* New(Zone* zone, \ | |
1134 HValue* context, \ | |
1135 P1 p1, \ | |
1136 P2 p2, \ | |
1137 P3 p3, \ | |
1138 P4 p4, \ | |
1139 P5 p5) { \ | |
1140 return new(zone) I(context, p1, p2, p3, p4, p5); \ | |
1141 } | |
1142 | |
1143 #define DECLARE_INSTRUCTION_FACTORY_P5(I, P1, P2, P3, P4, P5) \ | 1102 #define DECLARE_INSTRUCTION_FACTORY_P5(I, P1, P2, P3, P4, P5) \ |
1144 static I* New(Zone* zone, \ | 1103 static I* New(Zone* zone, \ |
1145 HValue* context, \ | 1104 HValue* context, \ |
1146 P1 p1, \ | 1105 P1 p1, \ |
1147 P2 p2, \ | 1106 P2 p2, \ |
1148 P3 p3, \ | 1107 P3 p3, \ |
1149 P4 p4, \ | 1108 P4 p4, \ |
1150 P5 p5) { \ | 1109 P5 p5) { \ |
1151 return new(zone) I(p1, p2, p3, p4, p5); \ | 1110 return new(zone) I(p1, p2, p3, p4, p5); \ |
1152 } | 1111 } |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1247 HBasicBlock* SecondSuccessor() { | 1206 HBasicBlock* SecondSuccessor() { |
1248 return SuccessorCount() > 1 ? SuccessorAt(1) : NULL; | 1207 return SuccessorCount() > 1 ? SuccessorAt(1) : NULL; |
1249 } | 1208 } |
1250 | 1209 |
1251 void Not() { | 1210 void Not() { |
1252 HBasicBlock* swap = SuccessorAt(0); | 1211 HBasicBlock* swap = SuccessorAt(0); |
1253 SetSuccessorAt(0, SuccessorAt(1)); | 1212 SetSuccessorAt(0, SuccessorAt(1)); |
1254 SetSuccessorAt(1, swap); | 1213 SetSuccessorAt(1, swap); |
1255 } | 1214 } |
1256 | 1215 |
1257 #ifdef DEBUG | |
1258 virtual void Verify() V8_OVERRIDE; | |
1259 #endif | |
1260 | |
1261 DECLARE_ABSTRACT_INSTRUCTION(ControlInstruction) | 1216 DECLARE_ABSTRACT_INSTRUCTION(ControlInstruction) |
1262 }; | 1217 }; |
1263 | 1218 |
1264 | 1219 |
1265 class HSuccessorIterator V8_FINAL BASE_EMBEDDED { | 1220 class HSuccessorIterator V8_FINAL BASE_EMBEDDED { |
1266 public: | 1221 public: |
1267 explicit HSuccessorIterator(HControlInstruction* instr) | 1222 explicit HSuccessorIterator(HControlInstruction* instr) |
1268 : instr_(instr), current_(0) { } | 1223 : instr_(instr), current_(0) { } |
1269 | 1224 |
1270 bool Done() { return current_ >= instr_->SuccessorCount(); } | 1225 bool Done() { return current_ >= instr_->SuccessorCount(); } |
(...skipping 2775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4046 } | 4001 } |
4047 } | 4002 } |
4048 | 4003 |
4049 DECLARE_ABSTRACT_INSTRUCTION(ArithmeticBinaryOperation) | 4004 DECLARE_ABSTRACT_INSTRUCTION(ArithmeticBinaryOperation) |
4050 | 4005 |
4051 private: | 4006 private: |
4052 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 4007 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
4053 }; | 4008 }; |
4054 | 4009 |
4055 | 4010 |
4056 class HCompareGenericAndBranch V8_FINAL | 4011 class HCompareGeneric V8_FINAL : public HBinaryOperation { |
4057 : public HTemplateControlInstruction<2, 3> { | |
4058 public: | 4012 public: |
4059 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HCompareGenericAndBranch, | 4013 HCompareGeneric(HValue* context, |
4060 HValue*, HValue*, Token::Value); | 4014 HValue* left, |
4061 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P5(HCompareGenericAndBranch, | 4015 HValue* right, |
4062 HValue*, HValue*, Token::Value, | 4016 Token::Value token) |
4063 HBasicBlock*, HBasicBlock*); | 4017 : HBinaryOperation(context, left, right, HType::Boolean()), |
4064 HValue* context() { return OperandAt(0); } | 4018 token_(token) { |
4065 HValue* left() { return OperandAt(1); } | 4019 ASSERT(Token::IsCompareOp(token)); |
4066 HValue* right() { return OperandAt(2); } | 4020 set_representation(Representation::Tagged()); |
4067 Token::Value token() const { return token_; } | 4021 SetAllSideEffects(); |
| 4022 } |
4068 | 4023 |
4069 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 4024 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
4070 return index == 0 | 4025 return index == 0 |
4071 ? Representation::Tagged() | 4026 ? Representation::Tagged() |
4072 : representation(); | 4027 : representation(); |
4073 } | 4028 } |
4074 | 4029 |
4075 void set_observed_input_representation(Representation left, | 4030 Token::Value token() const { return token_; } |
4076 Representation right) { | |
4077 observed_input_representation_[0] = left; | |
4078 observed_input_representation_[1] = right; | |
4079 } | |
4080 | |
4081 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 4031 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
4082 | 4032 |
4083 DECLARE_CONCRETE_INSTRUCTION(CompareGenericAndBranch) | 4033 DECLARE_CONCRETE_INSTRUCTION(CompareGeneric) |
4084 | 4034 |
4085 private: | 4035 private: |
4086 HCompareGenericAndBranch(HValue* context, | |
4087 HValue* left, | |
4088 HValue* right, | |
4089 Token::Value token, | |
4090 HBasicBlock* true_target = NULL, | |
4091 HBasicBlock* false_target = NULL) | |
4092 : token_(token) { | |
4093 set_representation(Representation::Tagged()); | |
4094 SetAllSideEffects(); | |
4095 SetOperandAt(0, context); | |
4096 SetOperandAt(1, left); | |
4097 SetOperandAt(2, right); | |
4098 SetSuccessorAt(0, true_target); | |
4099 SetSuccessorAt(1, false_target); | |
4100 } | |
4101 | |
4102 Representation observed_input_representation_[2]; | |
4103 Token::Value token_; | 4036 Token::Value token_; |
4104 }; | 4037 }; |
4105 | 4038 |
4106 | 4039 |
4107 class HCompareNumericAndBranch : public HTemplateControlInstruction<2, 2> { | 4040 class HCompareNumericAndBranch : public HTemplateControlInstruction<2, 2> { |
4108 public: | 4041 public: |
4109 DECLARE_INSTRUCTION_FACTORY_P3(HCompareNumericAndBranch, | 4042 DECLARE_INSTRUCTION_FACTORY_P3(HCompareNumericAndBranch, |
4110 HValue*, HValue*, Token::Value); | 4043 HValue*, HValue*, Token::Value); |
4111 DECLARE_INSTRUCTION_FACTORY_P5(HCompareNumericAndBranch, | 4044 DECLARE_INSTRUCTION_FACTORY_P5(HCompareNumericAndBranch, |
4112 HValue*, HValue*, Token::Value, | 4045 HValue*, HValue*, Token::Value, |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4294 HIsUndetectableAndBranch(HValue* value, | 4227 HIsUndetectableAndBranch(HValue* value, |
4295 HBasicBlock* true_target = NULL, | 4228 HBasicBlock* true_target = NULL, |
4296 HBasicBlock* false_target = NULL) | 4229 HBasicBlock* false_target = NULL) |
4297 : HUnaryControlInstruction(value, true_target, false_target) {} | 4230 : HUnaryControlInstruction(value, true_target, false_target) {} |
4298 }; | 4231 }; |
4299 | 4232 |
4300 | 4233 |
4301 class HStringCompareAndBranch : public HTemplateControlInstruction<2, 3> { | 4234 class HStringCompareAndBranch : public HTemplateControlInstruction<2, 3> { |
4302 public: | 4235 public: |
4303 HStringCompareAndBranch(HValue* context, | 4236 HStringCompareAndBranch(HValue* context, |
4304 HValue* left, | 4237 HValue* left, |
4305 HValue* right, | 4238 HValue* right, |
4306 Token::Value token) | 4239 Token::Value token) |
4307 : token_(token) { | 4240 : token_(token) { |
4308 ASSERT(Token::IsCompareOp(token)); | 4241 ASSERT(Token::IsCompareOp(token)); |
4309 SetOperandAt(0, context); | 4242 SetOperandAt(0, context); |
4310 SetOperandAt(1, left); | 4243 SetOperandAt(1, left); |
4311 SetOperandAt(2, right); | 4244 SetOperandAt(2, right); |
4312 set_representation(Representation::Tagged()); | 4245 set_representation(Representation::Tagged()); |
4313 SetGVNFlag(kChangesNewSpacePromotion); | 4246 SetGVNFlag(kChangesNewSpacePromotion); |
4314 } | 4247 } |
4315 | 4248 |
4316 HValue* context() { return OperandAt(0); } | 4249 HValue* context() { return OperandAt(0); } |
(...skipping 2814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7131 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 7064 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
7132 }; | 7065 }; |
7133 | 7066 |
7134 | 7067 |
7135 #undef DECLARE_INSTRUCTION | 7068 #undef DECLARE_INSTRUCTION |
7136 #undef DECLARE_CONCRETE_INSTRUCTION | 7069 #undef DECLARE_CONCRETE_INSTRUCTION |
7137 | 7070 |
7138 } } // namespace v8::internal | 7071 } } // namespace v8::internal |
7139 | 7072 |
7140 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7073 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |