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 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1050 block->AddLeaveInlined(return_value, state, position_); | 1050 block->AddLeaveInlined(return_value, state, position_); |
1051 } | 1051 } |
1052 void AddLeaveInlined(HValue* return_value, FunctionState* state) { | 1052 void AddLeaveInlined(HValue* return_value, FunctionState* state) { |
1053 return AddLeaveInlined(current_block(), return_value, state); | 1053 return AddLeaveInlined(current_block(), return_value, state); |
1054 } | 1054 } |
1055 | 1055 |
1056 template<class I> | 1056 template<class I> |
1057 HInstruction* NewUncasted() { return I::New(zone(), context()); } | 1057 HInstruction* NewUncasted() { return I::New(zone(), context()); } |
1058 | 1058 |
1059 template<class I> | 1059 template<class I> |
1060 I* New() { return I::cast(NewUncasted<I>()); } | 1060 I* New() { return I::New(zone(), context()); } |
1061 | 1061 |
1062 template<class I> | 1062 template<class I> |
1063 HInstruction* AddUncasted() { return AddInstruction(NewUncasted<I>());} | 1063 HInstruction* AddUncasted() { return AddInstruction(NewUncasted<I>());} |
1064 | 1064 |
1065 template<class I> | 1065 template<class I> |
1066 I* Add() { return I::cast(AddUncasted<I>());} | 1066 I* Add() { return AddInstructionTyped(New<I>());} |
1067 | 1067 |
1068 template<class I, class P1> | 1068 template<class I, class P1> |
1069 HInstruction* NewUncasted(P1 p1) { | 1069 HInstruction* NewUncasted(P1 p1) { |
1070 return I::New(zone(), context(), p1); | 1070 return I::New(zone(), context(), p1); |
1071 } | 1071 } |
1072 | 1072 |
1073 template<class I, class P1> | 1073 template<class I, class P1> |
1074 I* New(P1 p1) { return I::cast(NewUncasted<I>(p1)); } | 1074 I* New(P1 p1) { return I::New(zone(), context(), p1); } |
1075 | 1075 |
1076 template<class I, class P1> | 1076 template<class I, class P1> |
1077 HInstruction* AddUncasted(P1 p1) { | 1077 HInstruction* AddUncasted(P1 p1) { |
1078 HInstruction* result = AddInstruction(NewUncasted<I>(p1)); | 1078 HInstruction* result = AddInstruction(NewUncasted<I>(p1)); |
1079 // Specializations must have their parameters properly casted | 1079 // Specializations must have their parameters properly casted |
1080 // to avoid landing here. | 1080 // to avoid landing here. |
1081 ASSERT(!result->IsReturn() && !result->IsSimulate() && | 1081 ASSERT(!result->IsReturn() && !result->IsSimulate() && |
1082 !result->IsDeoptimize()); | 1082 !result->IsDeoptimize()); |
1083 return result; | 1083 return result; |
1084 } | 1084 } |
1085 | 1085 |
1086 template<class I, class P1> | 1086 template<class I, class P1> |
1087 I* Add(P1 p1) { | 1087 I* Add(P1 p1) { |
1088 return I::cast(AddUncasted<I>(p1)); | 1088 I* result = AddInstructionTyped(New<I>(p1)); |
1089 // Specializations must have their parameters properly casted | |
1090 // to avoid landing here. | |
1091 ASSERT(!result->IsReturn() && !result->IsSimulate() && | |
1092 !result->IsDeoptimize()); | |
1093 return result; | |
1089 } | 1094 } |
1090 | 1095 |
1091 template<class I, class P1, class P2> | 1096 template<class I, class P1, class P2> |
1092 HInstruction* NewUncasted(P1 p1, P2 p2) { | 1097 HInstruction* NewUncasted(P1 p1, P2 p2) { |
1093 return I::New(zone(), context(), p1, p2); | 1098 return I::New(zone(), context(), p1, p2); |
1094 } | 1099 } |
1095 | 1100 |
1096 template<class I, class P1, class P2> | 1101 template<class I, class P1, class P2> |
1097 I* New(P1 p1, P2 p2) { | 1102 I* New(P1 p1, P2 p2) { |
1098 return I::cast(NewUncasted<I>(p1, p2)); | 1103 return I::New(zone(), context(), p1, p2); |
1099 } | 1104 } |
1100 | 1105 |
1101 template<class I, class P1, class P2> | 1106 template<class I, class P1, class P2> |
1102 HInstruction* AddUncasted(P1 p1, P2 p2) { | 1107 HInstruction* AddUncasted(P1 p1, P2 p2) { |
1103 HInstruction* result = AddInstruction(NewUncasted<I>(p1, p2)); | 1108 HInstruction* result = AddInstruction(NewUncasted<I>(p1, p2)); |
1104 // Specializations must have their parameters properly casted | 1109 // Specializations must have their parameters properly casted |
1105 // to avoid landing here. | 1110 // to avoid landing here. |
1106 ASSERT(!result->IsSimulate()); | 1111 ASSERT(!result->IsSimulate()); |
1107 return result; | 1112 return result; |
1108 } | 1113 } |
1109 | 1114 |
1110 template<class I, class P1, class P2> | 1115 template<class I, class P1, class P2> |
1111 I* Add(P1 p1, P2 p2) { | 1116 I* Add(P1 p1, P2 p2) { |
1112 return I::cast(AddUncasted<I>(p1, p2)); | 1117 I* result = AddInstructionTyped(New<I>(p1, p2)); |
1118 // Specializations must have their parameters properly casted | |
1119 // to avoid landing here. | |
1120 ASSERT(!result->IsSimulate()); | |
1121 return result; | |
1113 } | 1122 } |
1114 | 1123 |
1115 template<class I, class P1, class P2, class P3> | 1124 template<class I, class P1, class P2, class P3> |
1116 HInstruction* NewUncasted(P1 p1, P2 p2, P3 p3) { | 1125 HInstruction* NewUncasted(P1 p1, P2 p2, P3 p3) { |
1117 return I::New(zone(), context(), p1, p2, p3); | 1126 return I::New(zone(), context(), p1, p2, p3); |
1118 } | 1127 } |
1119 | 1128 |
1120 template<class I, class P1, class P2, class P3> | 1129 template<class I, class P1, class P2, class P3> |
1121 I* New(P1 p1, P2 p2, P3 p3) { | 1130 I* New(P1 p1, P2 p2, P3 p3) { |
1122 return I::cast(NewUncasted<I>(p1, p2, p3)); | 1131 return I::New(zone(), context(), p1, p2, p3); |
1123 } | 1132 } |
1124 | 1133 |
1125 template<class I, class P1, class P2, class P3> | 1134 template<class I, class P1, class P2, class P3> |
1126 HInstruction* AddUncasted(P1 p1, P2 p2, P3 p3) { | 1135 HInstruction* AddUncasted(P1 p1, P2 p2, P3 p3) { |
1127 return AddInstruction(NewUncasted<I>(p1, p2, p3)); | 1136 return AddInstruction(NewUncasted<I>(p1, p2, p3)); |
1128 } | 1137 } |
1129 | 1138 |
1130 template<class I, class P1, class P2, class P3> | 1139 template<class I, class P1, class P2, class P3> |
1131 I* Add(P1 p1, P2 p2, P3 p3) { | 1140 I* Add(P1 p1, P2 p2, P3 p3) { |
1132 return I::cast(AddUncasted<I>(p1, p2, p3)); | 1141 return AddInstructionTyped(New<I>(p1, p2, p3)); |
1133 } | 1142 } |
1134 | 1143 |
1135 template<class I, class P1, class P2, class P3, class P4> | 1144 template<class I, class P1, class P2, class P3, class P4> |
1136 HInstruction* NewUncasted(P1 p1, P2 p2, P3 p3, P4 p4) { | 1145 HInstruction* NewUncasted(P1 p1, P2 p2, P3 p3, P4 p4) { |
1137 return I::New(zone(), context(), p1, p2, p3, p4); | 1146 return I::New(zone(), context(), p1, p2, p3, p4); |
1138 } | 1147 } |
1139 | 1148 |
1140 template<class I, class P1, class P2, class P3, class P4> | 1149 template<class I, class P1, class P2, class P3, class P4> |
1141 I* New(P1 p1, P2 p2, P3 p3, P4 p4) { | 1150 I* New(P1 p1, P2 p2, P3 p3, P4 p4) { |
1142 return I::cast(NewUncasted<I>(p1, p2, p3, p4)); | 1151 return I::New(zone(), context(), p1, p2, p3, p4); |
1143 } | 1152 } |
1144 | 1153 |
1145 template<class I, class P1, class P2, class P3, class P4> | 1154 template<class I, class P1, class P2, class P3, class P4> |
1146 HInstruction* AddUncasted(P1 p1, P2 p2, P3 p3, P4 p4) { | 1155 HInstruction* AddUncasted(P1 p1, P2 p2, P3 p3, P4 p4) { |
1147 return AddInstruction(NewUncasted<I>(p1, p2, p3, p4)); | 1156 return AddInstruction(NewUncasted<I>(p1, p2, p3, p4)); |
1148 } | 1157 } |
1149 | 1158 |
1150 template<class I, class P1, class P2, class P3, class P4> | 1159 template<class I, class P1, class P2, class P3, class P4> |
1151 I* Add(P1 p1, P2 p2, P3 p3, P4 p4) { | 1160 I* Add(P1 p1, P2 p2, P3 p3, P4 p4) { |
1152 return I::cast(AddUncasted<I>(p1, p2, p3, p4)); | 1161 return AddInstructionTyped(New<I>(p1, p2, p3, p4)); |
1153 } | 1162 } |
1154 | 1163 |
1155 template<class I, class P1, class P2, class P3, class P4, class P5> | 1164 template<class I, class P1, class P2, class P3, class P4, class P5> |
1156 HInstruction* NewUncasted(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) { | 1165 HInstruction* NewUncasted(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) { |
1157 return I::New(zone(), context(), p1, p2, p3, p4, p5); | 1166 return I::New(zone(), context(), p1, p2, p3, p4, p5); |
1158 } | 1167 } |
1159 | 1168 |
1160 template<class I, class P1, class P2, class P3, class P4, class P5> | 1169 template<class I, class P1, class P2, class P3, class P4, class P5> |
1161 I* New(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) { | 1170 I* New(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) { |
1162 return I::cast(NewUncasted<I>(p1, p2, p3, p4, p5)); | 1171 return I::New(zone(), context(), p1, p2, p3, p4, p5); |
1163 } | 1172 } |
1164 | 1173 |
1165 template<class I, class P1, class P2, class P3, class P4, class P5> | 1174 template<class I, class P1, class P2, class P3, class P4, class P5> |
1166 HInstruction* AddUncasted(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) { | 1175 HInstruction* AddUncasted(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) { |
1167 return AddInstruction(NewUncasted<I>(p1, p2, p3, p4, p5)); | 1176 return AddInstruction(NewUncasted<I>(p1, p2, p3, p4, p5)); |
1168 } | 1177 } |
1169 | 1178 |
1170 template<class I, class P1, class P2, class P3, class P4, class P5> | 1179 template<class I, class P1, class P2, class P3, class P4, class P5> |
1171 I* Add(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) { | 1180 I* Add(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) { |
1172 return I::cast(AddUncasted<I>(p1, p2, p3, p4, p5)); | 1181 return AddInstructionTyped(New<I>(p1, p2, p3, p4, p5)); |
1173 } | 1182 } |
1174 | 1183 |
1175 template<class I, class P1, class P2, class P3, class P4, class P5, class P6> | 1184 template<class I, class P1, class P2, class P3, class P4, class P5, class P6> |
1176 HInstruction* NewUncasted(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6) { | 1185 HInstruction* NewUncasted(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6) { |
1177 return I::New(zone(), context(), p1, p2, p3, p4, p5, p6); | 1186 return I::New(zone(), context(), p1, p2, p3, p4, p5, p6); |
1178 } | 1187 } |
1179 | 1188 |
1180 template<class I, class P1, class P2, class P3, class P4, class P5, class P6> | 1189 template<class I, class P1, class P2, class P3, class P4, class P5, class P6> |
1181 I* New(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6) { | 1190 I* New(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6) { |
1182 return I::cast(NewUncasted<I>(p1, p2, p3, p4, p5, p6)); | 1191 return I::New(zone(), context(), p1, p2, p3, p4, p5, p6); |
1183 } | 1192 } |
1184 | 1193 |
1185 template<class I, class P1, class P2, class P3, class P4, class P5, class P6> | 1194 template<class I, class P1, class P2, class P3, class P4, class P5, class P6> |
1186 HInstruction* AddUncasted(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6) { | 1195 HInstruction* AddUncasted(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6) { |
1187 return AddInstruction(NewUncasted<I>(p1, p2, p3, p4, p5, p6)); | 1196 return AddInstruction(NewUncasted<I>(p1, p2, p3, p4, p5, p6)); |
1188 } | 1197 } |
1189 | 1198 |
1190 template<class I, class P1, class P2, class P3, class P4, class P5, class P6> | 1199 template<class I, class P1, class P2, class P3, class P4, class P5, class P6> |
1191 I* Add(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6) { | 1200 I* Add(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6) { |
1192 return I::cast(AddInstruction(NewUncasted<I>(p1, p2, p3, p4, p5, p6))); | 1201 return AddInstructionTyped(New<I>(p1, p2, p3, p4, p5, p6)); |
1193 } | 1202 } |
1194 | 1203 |
1195 template<class I, class P1, class P2, class P3, class P4, | 1204 template<class I, class P1, class P2, class P3, class P4, |
1196 class P5, class P6, class P7> | 1205 class P5, class P6, class P7> |
1197 HInstruction* NewUncasted(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7) { | 1206 HInstruction* NewUncasted(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7) { |
1198 return I::New(zone(), context(), p1, p2, p3, p4, p5, p6, p7); | 1207 return I::New(zone(), context(), p1, p2, p3, p4, p5, p6, p7); |
1199 } | 1208 } |
1200 | 1209 |
1201 template<class I, class P1, class P2, class P3, class P4, | 1210 template<class I, class P1, class P2, class P3, class P4, |
1202 class P5, class P6, class P7> | 1211 class P5, class P6, class P7> |
1203 I* New(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7) { | 1212 I* New(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7) { |
1204 return I::cast(NewUncasted<I>(p1, p2, p3, p4, p5, p6, p7)); | 1213 return I::New(zone(), context(), p1, p2, p3, p4, p5, p6, p7); |
1205 } | 1214 } |
1206 | 1215 |
1207 template<class I, class P1, class P2, class P3, | 1216 template<class I, class P1, class P2, class P3, |
1208 class P4, class P5, class P6, class P7> | 1217 class P4, class P5, class P6, class P7> |
1209 HInstruction* AddUncasted(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7) { | 1218 HInstruction* AddUncasted(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7) { |
1210 return AddInstruction(NewUncasted<I>(p1, p2, p3, p4, p5, p6, p7)); | 1219 return AddInstruction(NewUncasted<I>(p1, p2, p3, p4, p5, p6, p7)); |
1211 } | 1220 } |
1212 | 1221 |
1213 template<class I, class P1, class P2, class P3, | 1222 template<class I, class P1, class P2, class P3, |
1214 class P4, class P5, class P6, class P7> | 1223 class P4, class P5, class P6, class P7> |
1215 I* Add(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7) { | 1224 I* Add(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7) { |
1216 return I::cast(AddInstruction(NewUncasted<I>(p1, p2, p3, p4, | 1225 return AddInstructionTyped(New<I>(p1, p2, p3, p4, p5, p6, p7)); |
1217 p5, p6, p7))); | |
1218 } | 1226 } |
1219 | 1227 |
1220 template<class I, class P1, class P2, class P3, class P4, | 1228 template<class I, class P1, class P2, class P3, class P4, |
1221 class P5, class P6, class P7, class P8> | 1229 class P5, class P6, class P7, class P8> |
1222 HInstruction* NewUncasted(P1 p1, P2 p2, P3 p3, P4 p4, | 1230 HInstruction* NewUncasted(P1 p1, P2 p2, P3 p3, P4 p4, |
1223 P5 p5, P6 p6, P7 p7, P8 p8) { | 1231 P5 p5, P6 p6, P7 p7, P8 p8) { |
1224 return I::New(zone(), context(), p1, p2, p3, p4, p5, p6, p7, p8); | 1232 return I::New(zone(), context(), p1, p2, p3, p4, p5, p6, p7, p8); |
1225 } | 1233 } |
1226 | 1234 |
1227 template<class I, class P1, class P2, class P3, class P4, | 1235 template<class I, class P1, class P2, class P3, class P4, |
1228 class P5, class P6, class P7, class P8> | 1236 class P5, class P6, class P7, class P8> |
1229 I* New(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8) { | 1237 I* New(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8) { |
1230 return I::cast(NewUncasted<I>(p1, p2, p3, p4, p5, p6, p7, p8)); | 1238 return I::New(zone(), context(), p1, p2, p3, p4, p5, p6, p7, p8); |
1231 } | 1239 } |
1232 | 1240 |
1233 template<class I, class P1, class P2, class P3, class P4, | 1241 template<class I, class P1, class P2, class P3, class P4, |
1234 class P5, class P6, class P7, class P8> | 1242 class P5, class P6, class P7, class P8> |
1235 HInstruction* AddUncasted(P1 p1, P2 p2, P3 p3, P4 p4, | 1243 HInstruction* AddUncasted(P1 p1, P2 p2, P3 p3, P4 p4, |
1236 P5 p5, P6 p6, P7 p7, P8 p8) { | 1244 P5 p5, P6 p6, P7 p7, P8 p8) { |
1237 return AddInstruction(NewUncasted<I>(p1, p2, p3, p4, p5, p6, p7, p8)); | 1245 return AddInstruction(NewUncasted<I>(p1, p2, p3, p4, p5, p6, p7, p8)); |
1238 } | 1246 } |
1239 | 1247 |
1240 template<class I, class P1, class P2, class P3, class P4, | 1248 template<class I, class P1, class P2, class P3, class P4, |
1241 class P5, class P6, class P7, class P8> | 1249 class P5, class P6, class P7, class P8> |
1242 I* Add(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8) { | 1250 I* Add(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8) { |
1243 return I::cast( | 1251 return AddInstructionTyped(New<I>(p1, p2, p3, p4, p5, p6, p7, p8)); |
1244 AddInstruction(NewUncasted<I>(p1, p2, p3, p4, p5, p6, p7, p8))); | |
1245 } | 1252 } |
1246 | 1253 |
1247 void AddSimulate(BailoutId id, RemovableSimulate removable = FIXED_SIMULATE); | 1254 void AddSimulate(BailoutId id, RemovableSimulate removable = FIXED_SIMULATE); |
1248 | 1255 |
1249 int position() const { return position_; } | 1256 int position() const { return position_; } |
1250 | 1257 |
1251 protected: | 1258 protected: |
1252 virtual bool BuildGraph() = 0; | 1259 virtual bool BuildGraph() = 0; |
1253 | 1260 |
1254 HBasicBlock* CreateBasicBlock(HEnvironment* env); | 1261 HBasicBlock* CreateBasicBlock(HEnvironment* env); |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1735 HValue* BuildUncheckedDictionaryElementLoadHelper( | 1742 HValue* BuildUncheckedDictionaryElementLoadHelper( |
1736 HValue* elements, | 1743 HValue* elements, |
1737 HValue* key, | 1744 HValue* key, |
1738 HValue* hash, | 1745 HValue* hash, |
1739 HValue* mask, | 1746 HValue* mask, |
1740 int current_probe); | 1747 int current_probe); |
1741 | 1748 |
1742 void PadEnvironmentForContinuation(HBasicBlock* from, | 1749 void PadEnvironmentForContinuation(HBasicBlock* from, |
1743 HBasicBlock* continuation); | 1750 HBasicBlock* continuation); |
1744 | 1751 |
1752 template <class I> | |
1753 I* AddInstructionTyped(I* instr) { | |
1754 return I::cast(AddInstruction(instr)); | |
Dmitry Lomov (no reviews)
2013/11/22 15:05:01
I could probably just make AddInstruction generic
danno
2013/11/22 16:42:40
I think this is OK. We should keep headers as free
| |
1755 } | |
1756 | |
1745 CompilationInfo* info_; | 1757 CompilationInfo* info_; |
1746 HGraph* graph_; | 1758 HGraph* graph_; |
1747 HBasicBlock* current_block_; | 1759 HBasicBlock* current_block_; |
1748 int position_; | 1760 int position_; |
1749 }; | 1761 }; |
1750 | 1762 |
1751 | 1763 |
1752 template<> | 1764 template<> |
1753 inline HInstruction* HGraphBuilder::AddUncasted<HDeoptimize>( | 1765 inline HDeoptimize* HGraphBuilder::Add<HDeoptimize>( |
1754 const char* reason, Deoptimizer::BailoutType type) { | 1766 const char* reason, Deoptimizer::BailoutType type) { |
1755 if (type == Deoptimizer::SOFT) { | 1767 if (type == Deoptimizer::SOFT) { |
1756 isolate()->counters()->soft_deopts_requested()->Increment(); | 1768 isolate()->counters()->soft_deopts_requested()->Increment(); |
1757 if (FLAG_always_opt) return NULL; | 1769 if (FLAG_always_opt) return NULL; |
1758 } | 1770 } |
1759 if (current_block()->IsDeoptimizing()) return NULL; | 1771 if (current_block()->IsDeoptimizing()) return NULL; |
1760 HBasicBlock* after_deopt_block = CreateBasicBlock( | 1772 HBasicBlock* after_deopt_block = CreateBasicBlock( |
1761 current_block()->last_environment()); | 1773 current_block()->last_environment()); |
1762 HDeoptimize* instr = New<HDeoptimize>(reason, type, after_deopt_block); | 1774 HDeoptimize* instr = New<HDeoptimize>(reason, type, after_deopt_block); |
1763 if (type == Deoptimizer::SOFT) { | 1775 if (type == Deoptimizer::SOFT) { |
1764 isolate()->counters()->soft_deopts_inserted()->Increment(); | 1776 isolate()->counters()->soft_deopts_inserted()->Increment(); |
1765 } | 1777 } |
1766 FinishCurrentBlock(instr); | 1778 FinishCurrentBlock(instr); |
1767 set_current_block(after_deopt_block); | 1779 set_current_block(after_deopt_block); |
1768 return instr; | 1780 return instr; |
1769 } | 1781 } |
1770 | 1782 |
1771 | 1783 |
1772 template<> | 1784 template<> |
1773 inline HDeoptimize* HGraphBuilder::Add<HDeoptimize>( | 1785 inline HInstruction* HGraphBuilder::AddUncasted<HDeoptimize>( |
1774 const char* reason, Deoptimizer::BailoutType type) { | 1786 const char* reason, Deoptimizer::BailoutType type) { |
1775 return static_cast<HDeoptimize*>(AddUncasted<HDeoptimize>(reason, type)); | 1787 return Add<HDeoptimize>(reason, type); |
1776 } | 1788 } |
1777 | 1789 |
1778 | 1790 |
1779 template<> | 1791 template<> |
1780 inline HInstruction* HGraphBuilder::AddUncasted<HSimulate>( | 1792 inline HSimulate* HGraphBuilder::Add<HSimulate>( |
1781 BailoutId id, | 1793 BailoutId id, |
1782 RemovableSimulate removable) { | 1794 RemovableSimulate removable) { |
1783 HSimulate* instr = current_block()->CreateSimulate(id, removable); | 1795 HSimulate* instr = current_block()->CreateSimulate(id, removable); |
1784 AddInstruction(instr); | 1796 AddInstruction(instr); |
1785 return instr; | 1797 return instr; |
1786 } | 1798 } |
1787 | 1799 |
1788 | 1800 |
1789 template<> | 1801 template<> |
1802 inline HSimulate* HGraphBuilder::Add<HSimulate>( | |
1803 BailoutId id) { | |
1804 return Add<HSimulate>(id, FIXED_SIMULATE); | |
1805 } | |
1806 | |
1807 | |
1808 template<> | |
1790 inline HInstruction* HGraphBuilder::AddUncasted<HSimulate>(BailoutId id) { | 1809 inline HInstruction* HGraphBuilder::AddUncasted<HSimulate>(BailoutId id) { |
1791 return AddUncasted<HSimulate>(id, FIXED_SIMULATE); | 1810 return Add<HSimulate>(id, FIXED_SIMULATE); |
1792 } | 1811 } |
1793 | 1812 |
1794 | 1813 |
1795 template<> | 1814 template<> |
1796 inline HInstruction* HGraphBuilder::AddUncasted<HReturn>(HValue* value) { | 1815 inline HReturn* HGraphBuilder::Add<HReturn>(HValue* value) { |
1797 int num_parameters = graph()->info()->num_parameters(); | 1816 int num_parameters = graph()->info()->num_parameters(); |
1798 HValue* params = AddUncasted<HConstant>(num_parameters); | 1817 HValue* params = AddUncasted<HConstant>(num_parameters); |
1799 HReturn* return_instruction = New<HReturn>(value, params); | 1818 HReturn* return_instruction = New<HReturn>(value, params); |
1800 FinishExitCurrentBlock(return_instruction); | 1819 FinishExitCurrentBlock(return_instruction); |
1801 return return_instruction; | 1820 return return_instruction; |
1802 } | 1821 } |
1803 | 1822 |
1804 | 1823 |
1805 template<> | 1824 template<> |
1825 inline HReturn* HGraphBuilder::Add<HReturn>(HConstant* value) { | |
1826 return Add<HReturn>(static_cast<HValue*>(value)); | |
1827 } | |
1828 | |
1829 template<> | |
1830 inline HInstruction* HGraphBuilder::AddUncasted<HReturn>(HValue* value) { | |
1831 return Add<HReturn>(value); | |
1832 } | |
1833 | |
1834 | |
1835 template<> | |
1806 inline HInstruction* HGraphBuilder::AddUncasted<HReturn>(HConstant* value) { | 1836 inline HInstruction* HGraphBuilder::AddUncasted<HReturn>(HConstant* value) { |
1807 return AddUncasted<HReturn>(static_cast<HValue*>(value)); | 1837 return Add<HReturn>(value); |
1808 } | 1838 } |
1809 | 1839 |
1810 | 1840 |
1811 template<> | 1841 template<> |
1812 inline HInstruction* HGraphBuilder::AddUncasted<HCallRuntime>( | 1842 inline HCallRuntime* HGraphBuilder::Add<HCallRuntime>( |
1813 Handle<String> name, | 1843 Handle<String> name, |
1814 const Runtime::Function* c_function, | 1844 const Runtime::Function* c_function, |
1815 int argument_count) { | 1845 int argument_count) { |
1816 HCallRuntime* instr = New<HCallRuntime>(name, c_function, argument_count); | 1846 HCallRuntime* instr = New<HCallRuntime>(name, c_function, argument_count); |
1817 if (graph()->info()->IsStub()) { | 1847 if (graph()->info()->IsStub()) { |
1818 // When compiling code stubs, we don't want to save all double registers | 1848 // When compiling code stubs, we don't want to save all double registers |
1819 // upon entry to the stub, but instead have the call runtime instruction | 1849 // upon entry to the stub, but instead have the call runtime instruction |
1820 // save the double registers only on-demand (in the fallback case). | 1850 // save the double registers only on-demand (in the fallback case). |
1821 instr->set_save_doubles(kSaveFPRegs); | 1851 instr->set_save_doubles(kSaveFPRegs); |
1822 } | 1852 } |
1823 AddInstruction(instr); | 1853 AddInstruction(instr); |
1824 return instr; | 1854 return instr; |
1825 } | 1855 } |
1826 | 1856 |
1827 | 1857 |
1828 template<> | 1858 template<> |
1859 inline HInstruction* HGraphBuilder::AddUncasted<HCallRuntime>( | |
1860 Handle<String> name, | |
1861 const Runtime::Function* c_function, | |
1862 int argument_count) { | |
1863 return Add<HCallRuntime>(name, c_function, argument_count); | |
1864 } | |
1865 | |
1866 | |
1867 template<> | |
1868 inline HContext* HGraphBuilder::New<HContext>() { | |
1869 return HContext::New(zone()); | |
1870 } | |
1871 | |
1872 | |
1873 template<> | |
1829 inline HInstruction* HGraphBuilder::NewUncasted<HContext>() { | 1874 inline HInstruction* HGraphBuilder::NewUncasted<HContext>() { |
1830 return HContext::New(zone()); | 1875 return New<HContext>(); |
1831 } | 1876 } |
1832 | 1877 |
1833 | |
1834 class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor { | 1878 class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor { |
1835 public: | 1879 public: |
1836 // A class encapsulating (lazily-allocated) break and continue blocks for | 1880 // A class encapsulating (lazily-allocated) break and continue blocks for |
1837 // a breakable statement. Separated from BreakAndContinueScope so that it | 1881 // a breakable statement. Separated from BreakAndContinueScope so that it |
1838 // can have a separate lifetime. | 1882 // can have a separate lifetime. |
1839 class BreakAndContinueInfo V8_FINAL BASE_EMBEDDED { | 1883 class BreakAndContinueInfo V8_FINAL BASE_EMBEDDED { |
1840 public: | 1884 public: |
1841 explicit BreakAndContinueInfo(BreakableStatement* target, | 1885 explicit BreakAndContinueInfo(BreakableStatement* target, |
1842 int drop_extra = 0) | 1886 int drop_extra = 0) |
1843 : target_(target), | 1887 : target_(target), |
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2577 } | 2621 } |
2578 | 2622 |
2579 private: | 2623 private: |
2580 HGraphBuilder* builder_; | 2624 HGraphBuilder* builder_; |
2581 }; | 2625 }; |
2582 | 2626 |
2583 | 2627 |
2584 } } // namespace v8::internal | 2628 } } // namespace v8::internal |
2585 | 2629 |
2586 #endif // V8_HYDROGEN_H_ | 2630 #endif // V8_HYDROGEN_H_ |
OLD | NEW |