| 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 1133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1144 public: | 1144 public: |
| 1145 explicit IfBuilder(HGraphBuilder* builder, | 1145 explicit IfBuilder(HGraphBuilder* builder, |
| 1146 int position = RelocInfo::kNoPosition); | 1146 int position = RelocInfo::kNoPosition); |
| 1147 IfBuilder(HGraphBuilder* builder, | 1147 IfBuilder(HGraphBuilder* builder, |
| 1148 HIfContinuation* continuation); | 1148 HIfContinuation* continuation); |
| 1149 | 1149 |
| 1150 ~IfBuilder() { | 1150 ~IfBuilder() { |
| 1151 if (!finished_) End(); | 1151 if (!finished_) End(); |
| 1152 } | 1152 } |
| 1153 | 1153 |
| 1154 HInstruction* IfCompare( | |
| 1155 HValue* left, | |
| 1156 HValue* right, | |
| 1157 Token::Value token); | |
| 1158 | |
| 1159 HInstruction* IfCompareMap(HValue* left, Handle<Map> map); | |
| 1160 | |
| 1161 template<class Condition> | 1154 template<class Condition> |
| 1162 HInstruction* If(HValue *p) { | 1155 HInstruction* If(HValue *p) { |
| 1163 HControlInstruction* compare = new(zone()) Condition(p); | 1156 HControlInstruction* compare = new(zone()) Condition(p); |
| 1164 AddCompare(compare); | 1157 AddCompare(compare); |
| 1165 return compare; | 1158 return compare; |
| 1166 } | 1159 } |
| 1167 | 1160 |
| 1168 template<class Condition, class P2> | 1161 template<class Condition, class P2> |
| 1169 HInstruction* If(HValue* p1, P2 p2) { | 1162 HInstruction* If(HValue* p1, P2 p2) { |
| 1170 HControlInstruction* compare = new(zone()) Condition(p1, p2); | 1163 HControlInstruction* compare = new(zone()) Condition(p1, p2); |
| 1171 AddCompare(compare); | 1164 AddCompare(compare); |
| 1172 return compare; | 1165 return compare; |
| 1173 } | 1166 } |
| 1174 | 1167 |
| 1168 template<class Condition, class P2, class P3> |
| 1169 HInstruction* If(HValue* p1, P2 p2, P3 p3) { |
| 1170 HControlInstruction* compare = new(zone()) Condition(p1, p2, p3); |
| 1171 AddCompare(compare); |
| 1172 return compare; |
| 1173 } |
| 1174 |
| 1175 template<class Condition, class P2> | 1175 template<class Condition, class P2> |
| 1176 HInstruction* IfNot(HValue* p1, P2 p2) { | 1176 HInstruction* IfNot(HValue* p1, P2 p2) { |
| 1177 HControlInstruction* compare = new(zone()) Condition(p1, p2); | 1177 HControlInstruction* compare = new(zone()) Condition(p1, p2); |
| 1178 AddCompare(compare); | 1178 AddCompare(compare); |
| 1179 HBasicBlock* block0 = compare->SuccessorAt(0); | 1179 HBasicBlock* block0 = compare->SuccessorAt(0); |
| 1180 HBasicBlock* block1 = compare->SuccessorAt(1); | 1180 HBasicBlock* block1 = compare->SuccessorAt(1); |
| 1181 compare->SetSuccessorAt(0, block1); | 1181 compare->SetSuccessorAt(0, block1); |
| 1182 compare->SetSuccessorAt(1, block0); | 1182 compare->SetSuccessorAt(1, block0); |
| 1183 return compare; | 1183 return compare; |
| 1184 } | 1184 } |
| 1185 | 1185 |
| 1186 HInstruction* OrIfCompare( | 1186 template<class Condition, class P2, class P3> |
| 1187 HValue* p1, | 1187 HInstruction* IfNot(HValue* p1, P2 p2, P3 p3) { |
| 1188 HValue* p2, | 1188 HControlInstruction* compare = new(zone()) Condition(p1, p2, p3); |
| 1189 Token::Value token) { | 1189 AddCompare(compare); |
| 1190 Or(); | 1190 HBasicBlock* block0 = compare->SuccessorAt(0); |
| 1191 return IfCompare(p1, p2, token); | 1191 HBasicBlock* block1 = compare->SuccessorAt(1); |
| 1192 } | 1192 compare->SetSuccessorAt(0, block1); |
| 1193 | 1193 compare->SetSuccessorAt(1, block0); |
| 1194 HInstruction* OrIfCompareMap(HValue* left, Handle<Map> map) { | 1194 return compare; |
| 1195 Or(); | |
| 1196 return IfCompareMap(left, map); | |
| 1197 } | 1195 } |
| 1198 | 1196 |
| 1199 template<class Condition> | 1197 template<class Condition> |
| 1200 HInstruction* OrIf(HValue *p) { | 1198 HInstruction* OrIf(HValue *p) { |
| 1201 Or(); | 1199 Or(); |
| 1202 return If<Condition>(p); | 1200 return If<Condition>(p); |
| 1203 } | 1201 } |
| 1204 | 1202 |
| 1205 template<class Condition, class P2> | 1203 template<class Condition, class P2> |
| 1206 HInstruction* OrIf(HValue* p1, P2 p2) { | 1204 HInstruction* OrIf(HValue* p1, P2 p2) { |
| 1207 Or(); | 1205 Or(); |
| 1208 return If<Condition>(p1, p2); | 1206 return If<Condition>(p1, p2); |
| 1209 } | 1207 } |
| 1210 | 1208 |
| 1211 HInstruction* AndIfCompare( | 1209 template<class Condition, class P2, class P3> |
| 1212 HValue* p1, | 1210 HInstruction* OrIf(HValue* p1, P2 p2, P3 p3) { |
| 1213 HValue* p2, | 1211 Or(); |
| 1214 Token::Value token) { | 1212 return If<Condition>(p1, p2, p3); |
| 1215 And(); | |
| 1216 return IfCompare(p1, p2, token); | |
| 1217 } | |
| 1218 | |
| 1219 HInstruction* AndIfCompareMap(HValue* left, Handle<Map> map) { | |
| 1220 And(); | |
| 1221 return IfCompareMap(left, map); | |
| 1222 } | 1213 } |
| 1223 | 1214 |
| 1224 template<class Condition> | 1215 template<class Condition> |
| 1225 HInstruction* AndIf(HValue *p) { | 1216 HInstruction* AndIf(HValue *p) { |
| 1226 And(); | 1217 And(); |
| 1227 return If<Condition>(p); | 1218 return If<Condition>(p); |
| 1228 } | 1219 } |
| 1229 | 1220 |
| 1230 template<class Condition, class P2> | 1221 template<class Condition, class P2> |
| 1231 HInstruction* AndIf(HValue* p1, P2 p2) { | 1222 HInstruction* AndIf(HValue* p1, P2 p2) { |
| 1232 And(); | 1223 And(); |
| 1233 return If<Condition>(p1, p2); | 1224 return If<Condition>(p1, p2); |
| 1234 } | 1225 } |
| 1235 | 1226 |
| 1227 template<class Condition, class P2, class P3> |
| 1228 HInstruction* AndIf(HValue* p1, P2 p2, P3 p3) { |
| 1229 And(); |
| 1230 return If<Condition>(p1, p2, p3); |
| 1231 } |
| 1232 |
| 1236 void Or(); | 1233 void Or(); |
| 1237 void And(); | 1234 void And(); |
| 1238 | 1235 |
| 1239 void CaptureContinuation(HIfContinuation* continuation); | 1236 void CaptureContinuation(HIfContinuation* continuation); |
| 1240 | 1237 |
| 1241 void Then(); | 1238 void Then(); |
| 1242 void Else(); | 1239 void Else(); |
| 1243 void End(); | 1240 void End(); |
| 1244 | 1241 |
| 1245 void Deopt(); | 1242 void Deopt(); |
| (...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2108 EmbeddedVector<char, 64> filename_; | 2105 EmbeddedVector<char, 64> filename_; |
| 2109 HeapStringAllocator string_allocator_; | 2106 HeapStringAllocator string_allocator_; |
| 2110 StringStream trace_; | 2107 StringStream trace_; |
| 2111 int indent_; | 2108 int indent_; |
| 2112 }; | 2109 }; |
| 2113 | 2110 |
| 2114 | 2111 |
| 2115 } } // namespace v8::internal | 2112 } } // namespace v8::internal |
| 2116 | 2113 |
| 2117 #endif // V8_HYDROGEN_H_ | 2114 #endif // V8_HYDROGEN_H_ |
| OLD | NEW |