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