| 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 949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1061 int flags_; | 1061 int flags_; |
| 1062 GVNFlagSet gvn_flags_; | 1062 GVNFlagSet gvn_flags_; |
| 1063 | 1063 |
| 1064 private: | 1064 private: |
| 1065 virtual bool IsDeletable() const { return false; } | 1065 virtual bool IsDeletable() const { return false; } |
| 1066 | 1066 |
| 1067 DISALLOW_COPY_AND_ASSIGN(HValue); | 1067 DISALLOW_COPY_AND_ASSIGN(HValue); |
| 1068 }; | 1068 }; |
| 1069 | 1069 |
| 1070 | 1070 |
| 1071 #define DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P0(I) \ |
| 1072 static I* New(Zone* zone, HValue* context) { \ |
| 1073 return new(zone) I(context); \ |
| 1074 } |
| 1075 |
| 1071 #define DECLARE_INSTRUCTION_FACTORY_P0(I) \ | 1076 #define DECLARE_INSTRUCTION_FACTORY_P0(I) \ |
| 1072 static I* New(Zone* zone, HValue* context) { \ | 1077 static I* New(Zone* zone, HValue* context) { \ |
| 1073 return new(zone) I(); \ | 1078 return new(zone) I(); \ |
| 1074 } | 1079 } |
| 1075 | 1080 |
| 1081 #define DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(I, P1) \ |
| 1082 static I* New(Zone* zone, HValue* context, P1 p1) { \ |
| 1083 return new(zone) I(context, p1); \ |
| 1084 } |
| 1085 |
| 1076 #define DECLARE_INSTRUCTION_FACTORY_P1(I, P1) \ | 1086 #define DECLARE_INSTRUCTION_FACTORY_P1(I, P1) \ |
| 1077 static I* New(Zone* zone, HValue* context, P1 p1) { \ | 1087 static I* New(Zone* zone, HValue* context, P1 p1) { \ |
| 1078 return new(zone) I(p1); \ | 1088 return new(zone) I(p1); \ |
| 1079 } | 1089 } |
| 1080 | 1090 |
| 1091 #define DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(I, P1, P2) \ |
| 1092 static I* New(Zone* zone, HValue* context, P1 p1, P2 p2) { \ |
| 1093 return new(zone) I(context, p1, p2); \ |
| 1094 } |
| 1095 |
| 1081 #define DECLARE_INSTRUCTION_FACTORY_P2(I, P1, P2) \ | 1096 #define DECLARE_INSTRUCTION_FACTORY_P2(I, P1, P2) \ |
| 1082 static I* New(Zone* zone, HValue* context, P1 p1, P2 p2) { \ | 1097 static I* New(Zone* zone, HValue* context, P1 p1, P2 p2) { \ |
| 1083 return new(zone) I(p1, p2); \ | 1098 return new(zone) I(p1, p2); \ |
| 1084 } | 1099 } |
| 1085 | 1100 |
| 1101 #define DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(I, P1, P2, P3) \ |
| 1102 static I* New(Zone* zone, HValue* context, P1 p1, P2 p2, P3 p3) { \ |
| 1103 return new(zone) I(context, p1, p2, p3); \ |
| 1104 } |
| 1105 |
| 1086 #define DECLARE_INSTRUCTION_FACTORY_P3(I, P1, P2, P3) \ | 1106 #define DECLARE_INSTRUCTION_FACTORY_P3(I, P1, P2, P3) \ |
| 1087 static I* New(Zone* zone, HValue* context, P1 p1, P2 p2, P3 p3) { \ | 1107 static I* New(Zone* zone, HValue* context, P1 p1, P2 p2, P3 p3) { \ |
| 1088 return new(zone) I(p1, p2, p3); \ | 1108 return new(zone) I(p1, p2, p3); \ |
| 1089 } | 1109 } |
| 1090 | 1110 |
| 1111 #define DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(I, P1, P2, P3, P4) \ |
| 1112 static I* New(Zone* zone, \ |
| 1113 HValue* context, \ |
| 1114 P1 p1, \ |
| 1115 P2 p2, \ |
| 1116 P3 p3, \ |
| 1117 P4 p4) { \ |
| 1118 return new(zone) I(context, p1, p2, p3, p4); \ |
| 1119 } |
| 1120 |
| 1091 #define DECLARE_INSTRUCTION_FACTORY_P4(I, P1, P2, P3, P4) \ | 1121 #define DECLARE_INSTRUCTION_FACTORY_P4(I, P1, P2, P3, P4) \ |
| 1092 static I* New(Zone* zone, \ | 1122 static I* New(Zone* zone, \ |
| 1093 HValue* context, \ | 1123 HValue* context, \ |
| 1094 P1 p1, \ | 1124 P1 p1, \ |
| 1095 P2 p2, \ | 1125 P2 p2, \ |
| 1096 P3 p3, \ | 1126 P3 p3, \ |
| 1097 P4 p4) { \ | 1127 P4 p4) { \ |
| 1098 return new(zone) I(p1, p2, p3, p4); \ | 1128 return new(zone) I(p1, p2, p3, p4); \ |
| 1099 } | 1129 } |
| 1100 | 1130 |
| 1131 #define DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P5(I, P1, P2, P3, P4, P5) \ |
| 1132 static I* New(Zone* zone, \ |
| 1133 HValue* context, \ |
| 1134 P1 p1, \ |
| 1135 P2 p2, \ |
| 1136 P3 p3, \ |
| 1137 P4 p4, \ |
| 1138 P5 p5) { \ |
| 1139 return new(zone) I(context, p1, p2, p3, p4, p5); \ |
| 1140 } |
| 1141 |
| 1101 #define DECLARE_INSTRUCTION_FACTORY_P5(I, P1, P2, P3, P4, P5) \ | 1142 #define DECLARE_INSTRUCTION_FACTORY_P5(I, P1, P2, P3, P4, P5) \ |
| 1102 static I* New(Zone* zone, \ | 1143 static I* New(Zone* zone, \ |
| 1103 HValue* context, \ | 1144 HValue* context, \ |
| 1104 P1 p1, \ | 1145 P1 p1, \ |
| 1105 P2 p2, \ | 1146 P2 p2, \ |
| 1106 P3 p3, \ | 1147 P3 p3, \ |
| 1107 P4 p4, \ | 1148 P4 p4, \ |
| 1108 P5 p5) { \ | 1149 P5 p5) { \ |
| 1109 return new(zone) I(p1, p2, p3, p4, p5); \ | 1150 return new(zone) I(p1, p2, p3, p4, p5); \ |
| 1110 } | 1151 } |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1199 | 1240 |
| 1200 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 1241 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
| 1201 | 1242 |
| 1202 HBasicBlock* FirstSuccessor() { | 1243 HBasicBlock* FirstSuccessor() { |
| 1203 return SuccessorCount() > 0 ? SuccessorAt(0) : NULL; | 1244 return SuccessorCount() > 0 ? SuccessorAt(0) : NULL; |
| 1204 } | 1245 } |
| 1205 HBasicBlock* SecondSuccessor() { | 1246 HBasicBlock* SecondSuccessor() { |
| 1206 return SuccessorCount() > 1 ? SuccessorAt(1) : NULL; | 1247 return SuccessorCount() > 1 ? SuccessorAt(1) : NULL; |
| 1207 } | 1248 } |
| 1208 | 1249 |
| 1250 #ifdef DEBUG |
| 1251 virtual void Verify() V8_OVERRIDE; |
| 1252 #endif |
| 1253 |
| 1209 DECLARE_ABSTRACT_INSTRUCTION(ControlInstruction) | 1254 DECLARE_ABSTRACT_INSTRUCTION(ControlInstruction) |
| 1210 }; | 1255 }; |
| 1211 | 1256 |
| 1212 | 1257 |
| 1213 class HSuccessorIterator V8_FINAL BASE_EMBEDDED { | 1258 class HSuccessorIterator V8_FINAL BASE_EMBEDDED { |
| 1214 public: | 1259 public: |
| 1215 explicit HSuccessorIterator(HControlInstruction* instr) | 1260 explicit HSuccessorIterator(HControlInstruction* instr) |
| 1216 : instr_(instr), current_(0) { } | 1261 : instr_(instr), current_(0) { } |
| 1217 | 1262 |
| 1218 bool Done() { return current_ >= instr_->SuccessorCount(); } | 1263 bool Done() { return current_ >= instr_->SuccessorCount(); } |
| (...skipping 2773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3992 } | 4037 } |
| 3993 } | 4038 } |
| 3994 | 4039 |
| 3995 DECLARE_ABSTRACT_INSTRUCTION(ArithmeticBinaryOperation) | 4040 DECLARE_ABSTRACT_INSTRUCTION(ArithmeticBinaryOperation) |
| 3996 | 4041 |
| 3997 private: | 4042 private: |
| 3998 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 4043 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
| 3999 }; | 4044 }; |
| 4000 | 4045 |
| 4001 | 4046 |
| 4002 class HCompareGeneric V8_FINAL : public HBinaryOperation { | 4047 class HCompareGenericAndBranch V8_FINAL |
| 4048 : public HTemplateControlInstruction<2, 3> { |
| 4003 public: | 4049 public: |
| 4004 HCompareGeneric(HValue* context, | 4050 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HCompareGenericAndBranch, |
| 4005 HValue* left, | 4051 HValue*, HValue*, Token::Value); |
| 4006 HValue* right, | 4052 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P5(HCompareGenericAndBranch, |
| 4007 Token::Value token) | 4053 HValue*, HValue*, Token::Value, |
| 4008 : HBinaryOperation(context, left, right, HType::Boolean()), | 4054 HBasicBlock*, HBasicBlock*); |
| 4009 token_(token) { | 4055 HValue* context() { return OperandAt(0); } |
| 4010 ASSERT(Token::IsCompareOp(token)); | 4056 HValue* left() { return OperandAt(1); } |
| 4011 set_representation(Representation::Tagged()); | 4057 HValue* right() { return OperandAt(2); } |
| 4012 SetAllSideEffects(); | 4058 Token::Value token() const { return token_; } |
| 4013 } | |
| 4014 | 4059 |
| 4015 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 4060 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
| 4016 return index == 0 | 4061 return index == 0 |
| 4017 ? Representation::Tagged() | 4062 ? Representation::Tagged() |
| 4018 : representation(); | 4063 : representation(); |
| 4019 } | 4064 } |
| 4020 | 4065 |
| 4021 Token::Value token() const { return token_; } | 4066 void set_observed_input_representation(Representation left, |
| 4067 Representation right) { |
| 4068 observed_input_representation_[0] = left; |
| 4069 observed_input_representation_[1] = right; |
| 4070 } |
| 4071 |
| 4022 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 4072 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
| 4023 | 4073 |
| 4024 DECLARE_CONCRETE_INSTRUCTION(CompareGeneric) | 4074 DECLARE_CONCRETE_INSTRUCTION(CompareGenericAndBranch) |
| 4025 | 4075 |
| 4026 private: | 4076 private: |
| 4077 HCompareGenericAndBranch(HValue* context, |
| 4078 HValue* left, |
| 4079 HValue* right, |
| 4080 Token::Value token, |
| 4081 HBasicBlock* true_target = NULL, |
| 4082 HBasicBlock* false_target = NULL) |
| 4083 : token_(token) { |
| 4084 set_representation(Representation::Tagged()); |
| 4085 SetAllSideEffects(); |
| 4086 SetOperandAt(0, context); |
| 4087 SetOperandAt(1, left); |
| 4088 SetOperandAt(2, right); |
| 4089 SetSuccessorAt(0, true_target); |
| 4090 SetSuccessorAt(1, false_target); |
| 4091 } |
| 4092 |
| 4093 Representation observed_input_representation_[2]; |
| 4027 Token::Value token_; | 4094 Token::Value token_; |
| 4028 }; | 4095 }; |
| 4029 | 4096 |
| 4030 | 4097 |
| 4031 class HCompareNumericAndBranch : public HTemplateControlInstruction<2, 2> { | 4098 class HCompareNumericAndBranch : public HTemplateControlInstruction<2, 2> { |
| 4032 public: | 4099 public: |
| 4033 DECLARE_INSTRUCTION_FACTORY_P3(HCompareNumericAndBranch, | 4100 DECLARE_INSTRUCTION_FACTORY_P3(HCompareNumericAndBranch, |
| 4034 HValue*, HValue*, Token::Value); | 4101 HValue*, HValue*, Token::Value); |
| 4035 DECLARE_INSTRUCTION_FACTORY_P5(HCompareNumericAndBranch, | 4102 DECLARE_INSTRUCTION_FACTORY_P5(HCompareNumericAndBranch, |
| 4036 HValue*, HValue*, Token::Value, | 4103 HValue*, HValue*, Token::Value, |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4218 HIsUndetectableAndBranch(HValue* value, | 4285 HIsUndetectableAndBranch(HValue* value, |
| 4219 HBasicBlock* true_target = NULL, | 4286 HBasicBlock* true_target = NULL, |
| 4220 HBasicBlock* false_target = NULL) | 4287 HBasicBlock* false_target = NULL) |
| 4221 : HUnaryControlInstruction(value, true_target, false_target) {} | 4288 : HUnaryControlInstruction(value, true_target, false_target) {} |
| 4222 }; | 4289 }; |
| 4223 | 4290 |
| 4224 | 4291 |
| 4225 class HStringCompareAndBranch : public HTemplateControlInstruction<2, 3> { | 4292 class HStringCompareAndBranch : public HTemplateControlInstruction<2, 3> { |
| 4226 public: | 4293 public: |
| 4227 HStringCompareAndBranch(HValue* context, | 4294 HStringCompareAndBranch(HValue* context, |
| 4228 HValue* left, | 4295 HValue* left, |
| 4229 HValue* right, | 4296 HValue* right, |
| 4230 Token::Value token) | 4297 Token::Value token) |
| 4231 : token_(token) { | 4298 : token_(token) { |
| 4232 ASSERT(Token::IsCompareOp(token)); | 4299 ASSERT(Token::IsCompareOp(token)); |
| 4233 SetOperandAt(0, context); | 4300 SetOperandAt(0, context); |
| 4234 SetOperandAt(1, left); | 4301 SetOperandAt(1, left); |
| 4235 SetOperandAt(2, right); | 4302 SetOperandAt(2, right); |
| 4236 set_representation(Representation::Tagged()); | 4303 set_representation(Representation::Tagged()); |
| 4237 SetGVNFlag(kChangesNewSpacePromotion); | 4304 SetGVNFlag(kChangesNewSpacePromotion); |
| 4238 } | 4305 } |
| 4239 | 4306 |
| 4240 HValue* context() { return OperandAt(0); } | 4307 HValue* context() { return OperandAt(0); } |
| (...skipping 2793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7034 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 7101 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
| 7035 }; | 7102 }; |
| 7036 | 7103 |
| 7037 | 7104 |
| 7038 #undef DECLARE_INSTRUCTION | 7105 #undef DECLARE_INSTRUCTION |
| 7039 #undef DECLARE_CONCRETE_INSTRUCTION | 7106 #undef DECLARE_CONCRETE_INSTRUCTION |
| 7040 | 7107 |
| 7041 } } // namespace v8::internal | 7108 } } // namespace v8::internal |
| 7042 | 7109 |
| 7043 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7110 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |