Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Side by Side Diff: src/hydrogen.h

Issue 112863002: Merge bleeding_edge 18021:18297 (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/heap-snapshot-generator.cc ('k') | src/hydrogen.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
1704 ElementsKind kind, 1711 ElementsKind kind,
1705 int length); 1712 int length);
1706 1713
1707 HValue* BuildElementIndexHash(HValue* index); 1714 HValue* BuildElementIndexHash(HValue* index);
1708 1715
1709 void BuildCompareNil( 1716 void BuildCompareNil(
1710 HValue* value, 1717 HValue* value,
1711 Handle<Type> type, 1718 Handle<Type> type,
1712 HIfContinuation* continuation); 1719 HIfContinuation* continuation);
1713 1720
1714 HValue* BuildCreateAllocationMemento(HValue* previous_object, 1721 void BuildCreateAllocationMemento(HValue* previous_object,
1715 int previous_object_size, 1722 HValue* previous_object_size,
1716 HValue* payload); 1723 HValue* payload);
1717 1724
1718 HInstruction* BuildConstantMapCheck(Handle<JSObject> constant, 1725 HInstruction* BuildConstantMapCheck(Handle<JSObject> constant,
1719 CompilationInfo* info); 1726 CompilationInfo* info);
1720 HInstruction* BuildCheckPrototypeMaps(Handle<JSObject> prototype, 1727 HInstruction* BuildCheckPrototypeMaps(Handle<JSObject> prototype,
1721 Handle<JSObject> holder); 1728 Handle<JSObject> holder);
1722 1729
1723 HInstruction* BuildGetNativeContext(); 1730 HInstruction* BuildGetNativeContext();
1724 HInstruction* BuildGetArrayFunction(); 1731 HInstruction* BuildGetArrayFunction();
1725 1732
1726 protected: 1733 protected:
1727 void SetSourcePosition(int position) { 1734 void SetSourcePosition(int position) {
1728 ASSERT(position != RelocInfo::kNoPosition); 1735 ASSERT(position != RelocInfo::kNoPosition);
1729 position_ = position; 1736 position_ = position;
1730 } 1737 }
1731 1738
1739 template <typename ViewClass>
1740 void BuildArrayBufferViewInitialization(HValue* obj,
1741 HValue* buffer,
1742 HValue* byte_offset,
1743 HValue* byte_length);
1744
1732 private: 1745 private:
1733 HGraphBuilder(); 1746 HGraphBuilder();
1734 1747
1735 HValue* BuildUncheckedDictionaryElementLoadHelper( 1748 HValue* BuildUncheckedDictionaryElementLoadHelper(
1736 HValue* elements, 1749 HValue* elements,
1737 HValue* key, 1750 HValue* key,
1738 HValue* hash, 1751 HValue* hash,
1739 HValue* mask, 1752 HValue* mask,
1740 int current_probe); 1753 int current_probe);
1741 1754
1742 void PadEnvironmentForContinuation(HBasicBlock* from, 1755 void PadEnvironmentForContinuation(HBasicBlock* from,
1743 HBasicBlock* continuation); 1756 HBasicBlock* continuation);
1744 1757
1758 template <class I>
1759 I* AddInstructionTyped(I* instr) {
1760 return I::cast(AddInstruction(instr));
1761 }
1762
1745 CompilationInfo* info_; 1763 CompilationInfo* info_;
1746 HGraph* graph_; 1764 HGraph* graph_;
1747 HBasicBlock* current_block_; 1765 HBasicBlock* current_block_;
1748 int position_; 1766 int position_;
1749 }; 1767 };
1750 1768
1751 1769
1752 template<> 1770 template<>
1753 inline HInstruction* HGraphBuilder::AddUncasted<HDeoptimize>( 1771 inline HDeoptimize* HGraphBuilder::Add<HDeoptimize>(
1754 const char* reason, Deoptimizer::BailoutType type) { 1772 const char* reason, Deoptimizer::BailoutType type) {
1755 if (type == Deoptimizer::SOFT) { 1773 if (type == Deoptimizer::SOFT) {
1756 isolate()->counters()->soft_deopts_requested()->Increment(); 1774 isolate()->counters()->soft_deopts_requested()->Increment();
1757 if (FLAG_always_opt) return NULL; 1775 if (FLAG_always_opt) return NULL;
1758 } 1776 }
1759 if (current_block()->IsDeoptimizing()) return NULL; 1777 if (current_block()->IsDeoptimizing()) return NULL;
1760 HBasicBlock* after_deopt_block = CreateBasicBlock( 1778 HBasicBlock* after_deopt_block = CreateBasicBlock(
1761 current_block()->last_environment()); 1779 current_block()->last_environment());
1762 HDeoptimize* instr = New<HDeoptimize>(reason, type, after_deopt_block); 1780 HDeoptimize* instr = New<HDeoptimize>(reason, type, after_deopt_block);
1763 if (type == Deoptimizer::SOFT) { 1781 if (type == Deoptimizer::SOFT) {
1764 isolate()->counters()->soft_deopts_inserted()->Increment(); 1782 isolate()->counters()->soft_deopts_inserted()->Increment();
1765 } 1783 }
1766 FinishCurrentBlock(instr); 1784 FinishCurrentBlock(instr);
1767 set_current_block(after_deopt_block); 1785 set_current_block(after_deopt_block);
1768 return instr; 1786 return instr;
1769 } 1787 }
1770 1788
1771 1789
1772 template<> 1790 template<>
1773 inline HDeoptimize* HGraphBuilder::Add<HDeoptimize>( 1791 inline HInstruction* HGraphBuilder::AddUncasted<HDeoptimize>(
1774 const char* reason, Deoptimizer::BailoutType type) { 1792 const char* reason, Deoptimizer::BailoutType type) {
1775 return static_cast<HDeoptimize*>(AddUncasted<HDeoptimize>(reason, type)); 1793 return Add<HDeoptimize>(reason, type);
1776 } 1794 }
1777 1795
1778 1796
1779 template<> 1797 template<>
1780 inline HInstruction* HGraphBuilder::AddUncasted<HSimulate>( 1798 inline HSimulate* HGraphBuilder::Add<HSimulate>(
1781 BailoutId id, 1799 BailoutId id,
1782 RemovableSimulate removable) { 1800 RemovableSimulate removable) {
1783 HSimulate* instr = current_block()->CreateSimulate(id, removable); 1801 HSimulate* instr = current_block()->CreateSimulate(id, removable);
1784 AddInstruction(instr); 1802 AddInstruction(instr);
1785 return instr; 1803 return instr;
1786 } 1804 }
1787 1805
1788 1806
1789 template<> 1807 template<>
1808 inline HSimulate* HGraphBuilder::Add<HSimulate>(
1809 BailoutId id) {
1810 return Add<HSimulate>(id, FIXED_SIMULATE);
1811 }
1812
1813
1814 template<>
1790 inline HInstruction* HGraphBuilder::AddUncasted<HSimulate>(BailoutId id) { 1815 inline HInstruction* HGraphBuilder::AddUncasted<HSimulate>(BailoutId id) {
1791 return AddUncasted<HSimulate>(id, FIXED_SIMULATE); 1816 return Add<HSimulate>(id, FIXED_SIMULATE);
1792 } 1817 }
1793 1818
1794 1819
1795 template<> 1820 template<>
1796 inline HInstruction* HGraphBuilder::AddUncasted<HReturn>(HValue* value) { 1821 inline HReturn* HGraphBuilder::Add<HReturn>(HValue* value) {
1797 int num_parameters = graph()->info()->num_parameters(); 1822 int num_parameters = graph()->info()->num_parameters();
1798 HValue* params = AddUncasted<HConstant>(num_parameters); 1823 HValue* params = AddUncasted<HConstant>(num_parameters);
1799 HReturn* return_instruction = New<HReturn>(value, params); 1824 HReturn* return_instruction = New<HReturn>(value, params);
1800 FinishExitCurrentBlock(return_instruction); 1825 FinishExitCurrentBlock(return_instruction);
1801 return return_instruction; 1826 return return_instruction;
1802 } 1827 }
1803 1828
1804 1829
1805 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<>
1806 inline HInstruction* HGraphBuilder::AddUncasted<HReturn>(HConstant* value) { 1842 inline HInstruction* HGraphBuilder::AddUncasted<HReturn>(HConstant* value) {
1807 return AddUncasted<HReturn>(static_cast<HValue*>(value)); 1843 return Add<HReturn>(value);
1808 } 1844 }
1809 1845
1810 1846
1811 template<> 1847 template<>
1812 inline HInstruction* HGraphBuilder::AddUncasted<HCallRuntime>( 1848 inline HCallRuntime* HGraphBuilder::Add<HCallRuntime>(
1813 Handle<String> name, 1849 Handle<String> name,
1814 const Runtime::Function* c_function, 1850 const Runtime::Function* c_function,
1815 int argument_count) { 1851 int argument_count) {
1816 HCallRuntime* instr = New<HCallRuntime>(name, c_function, argument_count); 1852 HCallRuntime* instr = New<HCallRuntime>(name, c_function, argument_count);
1817 if (graph()->info()->IsStub()) { 1853 if (graph()->info()->IsStub()) {
1818 // 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
1819 // 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
1820 // save the double registers only on-demand (in the fallback case). 1856 // save the double registers only on-demand (in the fallback case).
1821 instr->set_save_doubles(kSaveFPRegs); 1857 instr->set_save_doubles(kSaveFPRegs);
1822 } 1858 }
1823 AddInstruction(instr); 1859 AddInstruction(instr);
1824 return instr; 1860 return instr;
1825 } 1861 }
1826 1862
1827 1863
1828 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<>
1829 inline HInstruction* HGraphBuilder::NewUncasted<HContext>() { 1880 inline HInstruction* HGraphBuilder::NewUncasted<HContext>() {
1830 return HContext::New(zone()); 1881 return New<HContext>();
1831 } 1882 }
1832 1883
1833
1834 class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor { 1884 class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor {
1835 public: 1885 public:
1836 // A class encapsulating (lazily-allocated) break and continue blocks for 1886 // A class encapsulating (lazily-allocated) break and continue blocks for
1837 // a breakable statement. Separated from BreakAndContinueScope so that it 1887 // a breakable statement. Separated from BreakAndContinueScope so that it
1838 // can have a separate lifetime. 1888 // can have a separate lifetime.
1839 class BreakAndContinueInfo V8_FINAL BASE_EMBEDDED { 1889 class BreakAndContinueInfo V8_FINAL BASE_EMBEDDED {
1840 public: 1890 public:
1841 explicit BreakAndContinueInfo(BreakableStatement* target, 1891 explicit BreakAndContinueInfo(BreakableStatement* target,
1842 int drop_extra = 0) 1892 int drop_extra = 0)
1843 : target_(target), 1893 : target_(target),
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
2144 BailoutId ast_id); 2194 BailoutId ast_id);
2145 2195
2146 void HandlePropertyAssignment(Assignment* expr); 2196 void HandlePropertyAssignment(Assignment* expr);
2147 void HandleCompoundAssignment(Assignment* expr); 2197 void HandleCompoundAssignment(Assignment* expr);
2148 void HandlePolymorphicLoadNamedField(BailoutId ast_id, 2198 void HandlePolymorphicLoadNamedField(BailoutId ast_id,
2149 BailoutId return_id, 2199 BailoutId return_id,
2150 HValue* object, 2200 HValue* object,
2151 SmallMapList* types, 2201 SmallMapList* types,
2152 Handle<String> name); 2202 Handle<String> name);
2153 2203
2204 void VisitTypedArrayInitialize(CallRuntime* expr);
2205
2154 bool IsCallNewArrayInlineable(CallNew* expr); 2206 bool IsCallNewArrayInlineable(CallNew* expr);
2155 void BuildInlinedCallNewArray(CallNew* expr); 2207 void BuildInlinedCallNewArray(CallNew* expr);
2156 2208
2157 void VisitDataViewInitialize(CallRuntime* expr); 2209 void VisitDataViewInitialize(CallRuntime* expr);
2158 2210
2159 class PropertyAccessInfo { 2211 class PropertyAccessInfo {
2160 public: 2212 public:
2161 PropertyAccessInfo(Isolate* isolate, Handle<Map> map, Handle<String> name) 2213 PropertyAccessInfo(Isolate* isolate, Handle<Map> map, Handle<String> name)
2162 : lookup_(isolate), 2214 : lookup_(isolate),
2163 map_(map), 2215 map_(map),
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
2352 Handle<Map> map); 2404 Handle<Map> map);
2353 HInstruction* BuildStoreKeyedGeneric(HValue* object, 2405 HInstruction* BuildStoreKeyedGeneric(HValue* object,
2354 HValue* key, 2406 HValue* key,
2355 HValue* value); 2407 HValue* value);
2356 2408
2357 HValue* BuildContextChainWalk(Variable* var); 2409 HValue* BuildContextChainWalk(Variable* var);
2358 2410
2359 HInstruction* BuildThisFunction(); 2411 HInstruction* BuildThisFunction();
2360 2412
2361 HInstruction* BuildFastLiteral(Handle<JSObject> boilerplate_object, 2413 HInstruction* BuildFastLiteral(Handle<JSObject> boilerplate_object,
2362 AllocationSiteContext* site_context); 2414 AllocationSiteUsageContext* site_context);
2363 2415
2364 void BuildEmitObjectHeader(Handle<JSObject> boilerplate_object, 2416 void BuildEmitObjectHeader(Handle<JSObject> boilerplate_object,
2365 HInstruction* object); 2417 HInstruction* object);
2366 2418
2367 void BuildInitElementsInObjectHeader(Handle<JSObject> boilerplate_object, 2419 void BuildInitElementsInObjectHeader(Handle<JSObject> boilerplate_object,
2368 HInstruction* object, 2420 HInstruction* object,
2369 HInstruction* object_elements); 2421 HInstruction* object_elements);
2370 2422
2371 void BuildEmitInObjectProperties(Handle<JSObject> boilerplate_object, 2423 void BuildEmitInObjectProperties(Handle<JSObject> boilerplate_object,
2372 HInstruction* object, 2424 HInstruction* object,
2373 AllocationSiteContext* site_context); 2425 AllocationSiteUsageContext* site_context,
2426 PretenureFlag pretenure_flag);
2374 2427
2375 void BuildEmitElements(Handle<JSObject> boilerplate_object, 2428 void BuildEmitElements(Handle<JSObject> boilerplate_object,
2376 Handle<FixedArrayBase> elements, 2429 Handle<FixedArrayBase> elements,
2377 HValue* object_elements, 2430 HValue* object_elements,
2378 AllocationSiteContext* site_context); 2431 AllocationSiteUsageContext* site_context);
2379 2432
2380 void BuildEmitFixedDoubleArray(Handle<FixedArrayBase> elements, 2433 void BuildEmitFixedDoubleArray(Handle<FixedArrayBase> elements,
2381 ElementsKind kind, 2434 ElementsKind kind,
2382 HValue* object_elements); 2435 HValue* object_elements);
2383 2436
2384 void BuildEmitFixedArray(Handle<FixedArrayBase> elements, 2437 void BuildEmitFixedArray(Handle<FixedArrayBase> elements,
2385 ElementsKind kind, 2438 ElementsKind kind,
2386 HValue* object_elements, 2439 HValue* object_elements,
2387 AllocationSiteContext* site_context); 2440 AllocationSiteUsageContext* site_context);
2388 2441
2389 void AddCheckPrototypeMaps(Handle<JSObject> holder, 2442 void AddCheckPrototypeMaps(Handle<JSObject> holder,
2390 Handle<Map> receiver_map); 2443 Handle<Map> receiver_map);
2391 2444
2392 void AddCheckConstantFunction(Handle<JSObject> holder, 2445 void AddCheckConstantFunction(Handle<JSObject> holder,
2393 HValue* receiver, 2446 HValue* receiver,
2394 Handle<Map> receiver_map); 2447 Handle<Map> receiver_map);
2395 2448
2396 // The translation state of the currently-being-translated function. 2449 // The translation state of the currently-being-translated function.
2397 FunctionState* function_state_; 2450 FunctionState* function_state_;
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
2577 } 2630 }
2578 2631
2579 private: 2632 private:
2580 HGraphBuilder* builder_; 2633 HGraphBuilder* builder_;
2581 }; 2634 };
2582 2635
2583 2636
2584 } } // namespace v8::internal 2637 } } // namespace v8::internal
2585 2638
2586 #endif // V8_HYDROGEN_H_ 2639 #endif // V8_HYDROGEN_H_
OLDNEW
« no previous file with comments | « src/heap-snapshot-generator.cc ('k') | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698