| 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); |
| 1255 HBasicBlock* CreateLoopHeaderBlock(); | 1262 HBasicBlock* CreateLoopHeaderBlock(); |
| 1256 | 1263 |
| 1257 HValue* BuildCheckHeapObject(HValue* object); | 1264 HValue* BuildCheckHeapObject(HValue* object); |
| 1258 HValue* BuildCheckMap(HValue* obj, Handle<Map> map); | 1265 HValue* BuildCheckMap(HValue* obj, Handle<Map> map); |
| 1259 HValue* BuildCheckString(HValue* object, const char* failure_reason); | 1266 HValue* BuildCheckString(HValue* string); |
| 1260 HValue* BuildWrapReceiver(HValue* object, HValue* function); | 1267 HValue* BuildWrapReceiver(HValue* object, HValue* function); |
| 1261 | 1268 |
| 1262 // Building common constructs | 1269 // Building common constructs |
| 1263 HValue* BuildCheckForCapacityGrow(HValue* object, | 1270 HValue* BuildCheckForCapacityGrow(HValue* object, |
| 1264 HValue* elements, | 1271 HValue* elements, |
| 1265 ElementsKind kind, | 1272 ElementsKind kind, |
| 1266 HValue* length, | 1273 HValue* length, |
| 1267 HValue* key, | 1274 HValue* key, |
| 1268 bool is_js_array); | 1275 bool is_js_array); |
| 1269 | 1276 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1338 HValue* right, | 1345 HValue* right, |
| 1339 HValue** operand, | 1346 HValue** operand, |
| 1340 HValue** shift_amount); | 1347 HValue** shift_amount); |
| 1341 | 1348 |
| 1342 HValue* BuildBinaryOperation(Token::Value op, | 1349 HValue* BuildBinaryOperation(Token::Value op, |
| 1343 HValue* left, | 1350 HValue* left, |
| 1344 HValue* right, | 1351 HValue* right, |
| 1345 Handle<Type> left_type, | 1352 Handle<Type> left_type, |
| 1346 Handle<Type> right_type, | 1353 Handle<Type> right_type, |
| 1347 Handle<Type> result_type, | 1354 Handle<Type> result_type, |
| 1348 Maybe<int> fixed_right_arg, | 1355 Maybe<int> fixed_right_arg); |
| 1349 bool binop_stub = false); | |
| 1350 | 1356 |
| 1351 HLoadNamedField* AddLoadFixedArrayLength(HValue *object); | 1357 HLoadNamedField* AddLoadFixedArrayLength(HValue *object); |
| 1352 | 1358 |
| 1353 HValue* AddLoadJSBuiltin(Builtins::JavaScript builtin); | 1359 HValue* AddLoadJSBuiltin(Builtins::JavaScript builtin); |
| 1354 | 1360 |
| 1355 HValue* EnforceNumberType(HValue* number, Handle<Type> expected); | 1361 HValue* EnforceNumberType(HValue* number, Handle<Type> expected); |
| 1356 HValue* TruncateToNumber(HValue* value, Handle<Type>* expected); | 1362 HValue* TruncateToNumber(HValue* value, Handle<Type>* expected); |
| 1357 | 1363 |
| 1358 void FinishExitWithHardDeoptimization(const char* reason, | 1364 void FinishExitWithHardDeoptimization(const char* reason, |
| 1359 HBasicBlock* continuation); | 1365 HBasicBlock* continuation); |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1723 | 1729 |
| 1724 HInstruction* BuildGetNativeContext(); | 1730 HInstruction* BuildGetNativeContext(); |
| 1725 HInstruction* BuildGetArrayFunction(); | 1731 HInstruction* BuildGetArrayFunction(); |
| 1726 | 1732 |
| 1727 protected: | 1733 protected: |
| 1728 void SetSourcePosition(int position) { | 1734 void SetSourcePosition(int position) { |
| 1729 ASSERT(position != RelocInfo::kNoPosition); | 1735 ASSERT(position != RelocInfo::kNoPosition); |
| 1730 position_ = position; | 1736 position_ = position; |
| 1731 } | 1737 } |
| 1732 | 1738 |
| 1739 template <typename ViewClass> |
| 1740 void BuildArrayBufferViewInitialization(HValue* obj, |
| 1741 HValue* buffer, |
| 1742 HValue* byte_offset, |
| 1743 HValue* byte_length); |
| 1744 |
| 1733 private: | 1745 private: |
| 1734 HGraphBuilder(); | 1746 HGraphBuilder(); |
| 1735 | 1747 |
| 1736 HValue* BuildUncheckedDictionaryElementLoadHelper( | 1748 HValue* BuildUncheckedDictionaryElementLoadHelper( |
| 1737 HValue* elements, | 1749 HValue* elements, |
| 1738 HValue* key, | 1750 HValue* key, |
| 1739 HValue* hash, | 1751 HValue* hash, |
| 1740 HValue* mask, | 1752 HValue* mask, |
| 1741 int current_probe); | 1753 int current_probe); |
| 1742 | 1754 |
| 1743 void PadEnvironmentForContinuation(HBasicBlock* from, | 1755 void PadEnvironmentForContinuation(HBasicBlock* from, |
| 1744 HBasicBlock* continuation); | 1756 HBasicBlock* continuation); |
| 1745 | 1757 |
| 1758 template <class I> |
| 1759 I* AddInstructionTyped(I* instr) { |
| 1760 return I::cast(AddInstruction(instr)); |
| 1761 } |
| 1762 |
| 1746 CompilationInfo* info_; | 1763 CompilationInfo* info_; |
| 1747 HGraph* graph_; | 1764 HGraph* graph_; |
| 1748 HBasicBlock* current_block_; | 1765 HBasicBlock* current_block_; |
| 1749 int position_; | 1766 int position_; |
| 1750 }; | 1767 }; |
| 1751 | 1768 |
| 1752 | 1769 |
| 1753 template<> | 1770 template<> |
| 1754 inline HInstruction* HGraphBuilder::AddUncasted<HDeoptimize>( | 1771 inline HDeoptimize* HGraphBuilder::Add<HDeoptimize>( |
| 1755 const char* reason, Deoptimizer::BailoutType type) { | 1772 const char* reason, Deoptimizer::BailoutType type) { |
| 1756 if (type == Deoptimizer::SOFT) { | 1773 if (type == Deoptimizer::SOFT) { |
| 1757 isolate()->counters()->soft_deopts_requested()->Increment(); | 1774 isolate()->counters()->soft_deopts_requested()->Increment(); |
| 1758 if (FLAG_always_opt) return NULL; | 1775 if (FLAG_always_opt) return NULL; |
| 1759 } | 1776 } |
| 1760 if (current_block()->IsDeoptimizing()) return NULL; | 1777 if (current_block()->IsDeoptimizing()) return NULL; |
| 1761 HBasicBlock* after_deopt_block = CreateBasicBlock( | 1778 HBasicBlock* after_deopt_block = CreateBasicBlock( |
| 1762 current_block()->last_environment()); | 1779 current_block()->last_environment()); |
| 1763 HDeoptimize* instr = New<HDeoptimize>(reason, type, after_deopt_block); | 1780 HDeoptimize* instr = New<HDeoptimize>(reason, type, after_deopt_block); |
| 1764 if (type == Deoptimizer::SOFT) { | 1781 if (type == Deoptimizer::SOFT) { |
| 1765 isolate()->counters()->soft_deopts_inserted()->Increment(); | 1782 isolate()->counters()->soft_deopts_inserted()->Increment(); |
| 1766 } | 1783 } |
| 1767 FinishCurrentBlock(instr); | 1784 FinishCurrentBlock(instr); |
| 1768 set_current_block(after_deopt_block); | 1785 set_current_block(after_deopt_block); |
| 1769 return instr; | 1786 return instr; |
| 1770 } | 1787 } |
| 1771 | 1788 |
| 1772 | 1789 |
| 1773 template<> | 1790 template<> |
| 1774 inline HDeoptimize* HGraphBuilder::Add<HDeoptimize>( | 1791 inline HInstruction* HGraphBuilder::AddUncasted<HDeoptimize>( |
| 1775 const char* reason, Deoptimizer::BailoutType type) { | 1792 const char* reason, Deoptimizer::BailoutType type) { |
| 1776 return static_cast<HDeoptimize*>(AddUncasted<HDeoptimize>(reason, type)); | 1793 return Add<HDeoptimize>(reason, type); |
| 1777 } | 1794 } |
| 1778 | 1795 |
| 1779 | 1796 |
| 1780 template<> | 1797 template<> |
| 1781 inline HInstruction* HGraphBuilder::AddUncasted<HSimulate>( | 1798 inline HSimulate* HGraphBuilder::Add<HSimulate>( |
| 1782 BailoutId id, | 1799 BailoutId id, |
| 1783 RemovableSimulate removable) { | 1800 RemovableSimulate removable) { |
| 1784 HSimulate* instr = current_block()->CreateSimulate(id, removable); | 1801 HSimulate* instr = current_block()->CreateSimulate(id, removable); |
| 1785 AddInstruction(instr); | 1802 AddInstruction(instr); |
| 1786 return instr; | 1803 return instr; |
| 1787 } | 1804 } |
| 1788 | 1805 |
| 1789 | 1806 |
| 1790 template<> | 1807 template<> |
| 1808 inline HSimulate* HGraphBuilder::Add<HSimulate>( |
| 1809 BailoutId id) { |
| 1810 return Add<HSimulate>(id, FIXED_SIMULATE); |
| 1811 } |
| 1812 |
| 1813 |
| 1814 template<> |
| 1791 inline HInstruction* HGraphBuilder::AddUncasted<HSimulate>(BailoutId id) { | 1815 inline HInstruction* HGraphBuilder::AddUncasted<HSimulate>(BailoutId id) { |
| 1792 return AddUncasted<HSimulate>(id, FIXED_SIMULATE); | 1816 return Add<HSimulate>(id, FIXED_SIMULATE); |
| 1793 } | 1817 } |
| 1794 | 1818 |
| 1795 | 1819 |
| 1796 template<> | 1820 template<> |
| 1797 inline HInstruction* HGraphBuilder::AddUncasted<HReturn>(HValue* value) { | 1821 inline HReturn* HGraphBuilder::Add<HReturn>(HValue* value) { |
| 1798 int num_parameters = graph()->info()->num_parameters(); | 1822 int num_parameters = graph()->info()->num_parameters(); |
| 1799 HValue* params = AddUncasted<HConstant>(num_parameters); | 1823 HValue* params = AddUncasted<HConstant>(num_parameters); |
| 1800 HReturn* return_instruction = New<HReturn>(value, params); | 1824 HReturn* return_instruction = New<HReturn>(value, params); |
| 1801 FinishExitCurrentBlock(return_instruction); | 1825 FinishExitCurrentBlock(return_instruction); |
| 1802 return return_instruction; | 1826 return return_instruction; |
| 1803 } | 1827 } |
| 1804 | 1828 |
| 1805 | 1829 |
| 1806 template<> | 1830 template<> |
| 1831 inline HReturn* HGraphBuilder::Add<HReturn>(HConstant* value) { |
| 1832 return Add<HReturn>(static_cast<HValue*>(value)); |
| 1833 } |
| 1834 |
| 1835 template<> |
| 1836 inline HInstruction* HGraphBuilder::AddUncasted<HReturn>(HValue* value) { |
| 1837 return Add<HReturn>(value); |
| 1838 } |
| 1839 |
| 1840 |
| 1841 template<> |
| 1807 inline HInstruction* HGraphBuilder::AddUncasted<HReturn>(HConstant* value) { | 1842 inline HInstruction* HGraphBuilder::AddUncasted<HReturn>(HConstant* value) { |
| 1808 return AddUncasted<HReturn>(static_cast<HValue*>(value)); | 1843 return Add<HReturn>(value); |
| 1809 } | 1844 } |
| 1810 | 1845 |
| 1811 | 1846 |
| 1812 template<> | 1847 template<> |
| 1813 inline HInstruction* HGraphBuilder::AddUncasted<HCallRuntime>( | 1848 inline HCallRuntime* HGraphBuilder::Add<HCallRuntime>( |
| 1814 Handle<String> name, | 1849 Handle<String> name, |
| 1815 const Runtime::Function* c_function, | 1850 const Runtime::Function* c_function, |
| 1816 int argument_count) { | 1851 int argument_count) { |
| 1817 HCallRuntime* instr = New<HCallRuntime>(name, c_function, argument_count); | 1852 HCallRuntime* instr = New<HCallRuntime>(name, c_function, argument_count); |
| 1818 if (graph()->info()->IsStub()) { | 1853 if (graph()->info()->IsStub()) { |
| 1819 // When compiling code stubs, we don't want to save all double registers | 1854 // When compiling code stubs, we don't want to save all double registers |
| 1820 // upon entry to the stub, but instead have the call runtime instruction | 1855 // upon entry to the stub, but instead have the call runtime instruction |
| 1821 // save the double registers only on-demand (in the fallback case). | 1856 // save the double registers only on-demand (in the fallback case). |
| 1822 instr->set_save_doubles(kSaveFPRegs); | 1857 instr->set_save_doubles(kSaveFPRegs); |
| 1823 } | 1858 } |
| 1824 AddInstruction(instr); | 1859 AddInstruction(instr); |
| 1825 return instr; | 1860 return instr; |
| 1826 } | 1861 } |
| 1827 | 1862 |
| 1828 | 1863 |
| 1829 template<> | 1864 template<> |
| 1865 inline HInstruction* HGraphBuilder::AddUncasted<HCallRuntime>( |
| 1866 Handle<String> name, |
| 1867 const Runtime::Function* c_function, |
| 1868 int argument_count) { |
| 1869 return Add<HCallRuntime>(name, c_function, argument_count); |
| 1870 } |
| 1871 |
| 1872 |
| 1873 template<> |
| 1874 inline HContext* HGraphBuilder::New<HContext>() { |
| 1875 return HContext::New(zone()); |
| 1876 } |
| 1877 |
| 1878 |
| 1879 template<> |
| 1830 inline HInstruction* HGraphBuilder::NewUncasted<HContext>() { | 1880 inline HInstruction* HGraphBuilder::NewUncasted<HContext>() { |
| 1831 return HContext::New(zone()); | 1881 return New<HContext>(); |
| 1832 } | 1882 } |
| 1833 | 1883 |
| 1834 | |
| 1835 class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor { | 1884 class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor { |
| 1836 public: | 1885 public: |
| 1837 // A class encapsulating (lazily-allocated) break and continue blocks for | 1886 // A class encapsulating (lazily-allocated) break and continue blocks for |
| 1838 // a breakable statement. Separated from BreakAndContinueScope so that it | 1887 // a breakable statement. Separated from BreakAndContinueScope so that it |
| 1839 // can have a separate lifetime. | 1888 // can have a separate lifetime. |
| 1840 class BreakAndContinueInfo V8_FINAL BASE_EMBEDDED { | 1889 class BreakAndContinueInfo V8_FINAL BASE_EMBEDDED { |
| 1841 public: | 1890 public: |
| 1842 explicit BreakAndContinueInfo(BreakableStatement* target, | 1891 explicit BreakAndContinueInfo(BreakableStatement* target, |
| 1843 int drop_extra = 0) | 1892 int drop_extra = 0) |
| 1844 : target_(target), | 1893 : target_(target), |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2145 BailoutId ast_id); | 2194 BailoutId ast_id); |
| 2146 | 2195 |
| 2147 void HandlePropertyAssignment(Assignment* expr); | 2196 void HandlePropertyAssignment(Assignment* expr); |
| 2148 void HandleCompoundAssignment(Assignment* expr); | 2197 void HandleCompoundAssignment(Assignment* expr); |
| 2149 void HandlePolymorphicLoadNamedField(BailoutId ast_id, | 2198 void HandlePolymorphicLoadNamedField(BailoutId ast_id, |
| 2150 BailoutId return_id, | 2199 BailoutId return_id, |
| 2151 HValue* object, | 2200 HValue* object, |
| 2152 SmallMapList* types, | 2201 SmallMapList* types, |
| 2153 Handle<String> name); | 2202 Handle<String> name); |
| 2154 | 2203 |
| 2204 void VisitTypedArrayInitialize(CallRuntime* expr); |
| 2205 |
| 2155 bool IsCallNewArrayInlineable(CallNew* expr); | 2206 bool IsCallNewArrayInlineable(CallNew* expr); |
| 2156 void BuildInlinedCallNewArray(CallNew* expr); | 2207 void BuildInlinedCallNewArray(CallNew* expr); |
| 2157 | 2208 |
| 2158 void VisitDataViewInitialize(CallRuntime* expr); | 2209 void VisitDataViewInitialize(CallRuntime* expr); |
| 2159 | 2210 |
| 2160 class PropertyAccessInfo { | 2211 class PropertyAccessInfo { |
| 2161 public: | 2212 public: |
| 2162 PropertyAccessInfo(Isolate* isolate, Handle<Map> map, Handle<String> name) | 2213 PropertyAccessInfo(Isolate* isolate, Handle<Map> map, Handle<String> name) |
| 2163 : lookup_(isolate), | 2214 : lookup_(isolate), |
| 2164 map_(map), | 2215 map_(map), |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2353 Handle<Map> map); | 2404 Handle<Map> map); |
| 2354 HInstruction* BuildStoreKeyedGeneric(HValue* object, | 2405 HInstruction* BuildStoreKeyedGeneric(HValue* object, |
| 2355 HValue* key, | 2406 HValue* key, |
| 2356 HValue* value); | 2407 HValue* value); |
| 2357 | 2408 |
| 2358 HValue* BuildContextChainWalk(Variable* var); | 2409 HValue* BuildContextChainWalk(Variable* var); |
| 2359 | 2410 |
| 2360 HInstruction* BuildThisFunction(); | 2411 HInstruction* BuildThisFunction(); |
| 2361 | 2412 |
| 2362 HInstruction* BuildFastLiteral(Handle<JSObject> boilerplate_object, | 2413 HInstruction* BuildFastLiteral(Handle<JSObject> boilerplate_object, |
| 2363 AllocationSiteContext* site_context); | 2414 AllocationSiteUsageContext* site_context); |
| 2364 | 2415 |
| 2365 void BuildEmitObjectHeader(Handle<JSObject> boilerplate_object, | 2416 void BuildEmitObjectHeader(Handle<JSObject> boilerplate_object, |
| 2366 HInstruction* object); | 2417 HInstruction* object); |
| 2367 | 2418 |
| 2368 void BuildInitElementsInObjectHeader(Handle<JSObject> boilerplate_object, | 2419 void BuildInitElementsInObjectHeader(Handle<JSObject> boilerplate_object, |
| 2369 HInstruction* object, | 2420 HInstruction* object, |
| 2370 HInstruction* object_elements); | 2421 HInstruction* object_elements); |
| 2371 | 2422 |
| 2372 void BuildEmitInObjectProperties(Handle<JSObject> boilerplate_object, | 2423 void BuildEmitInObjectProperties(Handle<JSObject> boilerplate_object, |
| 2373 HInstruction* object, | 2424 HInstruction* object, |
| 2374 AllocationSiteContext* site_context); | 2425 AllocationSiteUsageContext* site_context); |
| 2375 | 2426 |
| 2376 void BuildEmitElements(Handle<JSObject> boilerplate_object, | 2427 void BuildEmitElements(Handle<JSObject> boilerplate_object, |
| 2377 Handle<FixedArrayBase> elements, | 2428 Handle<FixedArrayBase> elements, |
| 2378 HValue* object_elements, | 2429 HValue* object_elements, |
| 2379 AllocationSiteContext* site_context); | 2430 AllocationSiteUsageContext* site_context); |
| 2380 | 2431 |
| 2381 void BuildEmitFixedDoubleArray(Handle<FixedArrayBase> elements, | 2432 void BuildEmitFixedDoubleArray(Handle<FixedArrayBase> elements, |
| 2382 ElementsKind kind, | 2433 ElementsKind kind, |
| 2383 HValue* object_elements); | 2434 HValue* object_elements); |
| 2384 | 2435 |
| 2385 void BuildEmitFixedArray(Handle<FixedArrayBase> elements, | 2436 void BuildEmitFixedArray(Handle<FixedArrayBase> elements, |
| 2386 ElementsKind kind, | 2437 ElementsKind kind, |
| 2387 HValue* object_elements, | 2438 HValue* object_elements, |
| 2388 AllocationSiteContext* site_context); | 2439 AllocationSiteUsageContext* site_context); |
| 2389 | 2440 |
| 2390 void AddCheckPrototypeMaps(Handle<JSObject> holder, | 2441 void AddCheckPrototypeMaps(Handle<JSObject> holder, |
| 2391 Handle<Map> receiver_map); | 2442 Handle<Map> receiver_map); |
| 2392 | 2443 |
| 2393 void AddCheckConstantFunction(Handle<JSObject> holder, | 2444 void AddCheckConstantFunction(Handle<JSObject> holder, |
| 2394 HValue* receiver, | 2445 HValue* receiver, |
| 2395 Handle<Map> receiver_map); | 2446 Handle<Map> receiver_map); |
| 2396 | 2447 |
| 2397 // The translation state of the currently-being-translated function. | 2448 // The translation state of the currently-being-translated function. |
| 2398 FunctionState* function_state_; | 2449 FunctionState* function_state_; |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2578 } | 2629 } |
| 2579 | 2630 |
| 2580 private: | 2631 private: |
| 2581 HGraphBuilder* builder_; | 2632 HGraphBuilder* builder_; |
| 2582 }; | 2633 }; |
| 2583 | 2634 |
| 2584 | 2635 |
| 2585 } } // namespace v8::internal | 2636 } } // namespace v8::internal |
| 2586 | 2637 |
| 2587 #endif // V8_HYDROGEN_H_ | 2638 #endif // V8_HYDROGEN_H_ |
| OLD | NEW |