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

Side by Side Diff: src/hydrogen-instructions.cc

Issue 6708085: Enable GVN for polymorphic loads by not expanding them at the HIR level. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: x64 and arm code Created 9 years, 9 months 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
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after
1149 stream->Add("%u", index()); 1149 stream->Add("%u", index());
1150 } 1150 }
1151 1151
1152 1152
1153 void HLoadNamedField::PrintDataTo(StringStream* stream) { 1153 void HLoadNamedField::PrintDataTo(StringStream* stream) {
1154 object()->PrintNameTo(stream); 1154 object()->PrintNameTo(stream);
1155 stream->Add(" @%d%s", offset(), is_in_object() ? "[in-object]" : ""); 1155 stream->Add(" @%d%s", offset(), is_in_object() ? "[in-object]" : "");
1156 } 1156 }
1157 1157
1158 1158
1159 HLoadNamedFieldPolymorphic::HLoadNamedFieldPolymorphic(HValue* object,
1160 ZoneMapList* types,
1161 Handle<String> name)
1162 : HUnaryOperation(object),
1163 types_(types->length()),
Kevin Millikin (Chromium) 2011/03/23 15:37:29 You could initialize the list to have capacity Min
fschneider 2011/03/24 08:43:30 Done.
1164 name_(name),
1165 need_generic_(false) {
1166 set_representation(Representation::Tagged());
1167 SetFlag(kDependsOnMaps);
1168 const int kMaxLoadPolymorphism = 4;
1169 for (int i = 0;
1170 i < types->length() && types_.length() < kMaxLoadPolymorphism;
1171 ++i) {
1172 Handle<Map> map = types->at(i);
1173 LookupResult lookup;
1174 map->LookupInDescriptors(NULL, *name, &lookup);
1175 if (lookup.IsProperty() && lookup.type() == FIELD) {
1176 types_.Add(types->at(i));
1177 int index = lookup.GetLocalFieldIndexFromMap(*map);
1178 if (index < 0) {
1179 SetFlag(kDependsOnInobjectFields);
1180 } else {
1181 SetFlag(kDependsOnBackingStoreFields);
1182 }
1183 }
1184 }
1185
1186 if (types_.length() == types->length() && FLAG_deoptimize_uncommon_cases) {
1187 SetFlag(kUseGVN);
1188 } else {
1189 SetAllSideEffects();
1190 need_generic_ = true;
1191 }
1192 }
1193
1194
1195 bool HLoadNamedFieldPolymorphic::DataEquals(HValue* value) {
1196 HLoadNamedFieldPolymorphic* other = HLoadNamedFieldPolymorphic::cast(value);
1197 if (types_.length() != other->types()->length()) return false;
1198 if (!name_.is_identical_to(other->name())) return false;
1199 if (need_generic_ != other->need_generic_) return false;
1200 for (int i = 0; i < types_.length(); i++) {
1201 bool found = false;
1202 for (int j = 0; j < types_.length(); j++) {
1203 if (!types_.at(j).is_identical_to(other->types()->at(i))) {
Kevin Millikin (Chromium) 2011/03/23 15:37:29 Should not be negated.
fschneider 2011/03/24 08:43:30 Of course. Thanks.
1204 found = true;
1205 break;
1206 }
1207 }
1208 if (!found) return false;
1209 }
1210 return true;
1211 }
1212
1213
1159 void HLoadKeyedFastElement::PrintDataTo(StringStream* stream) { 1214 void HLoadKeyedFastElement::PrintDataTo(StringStream* stream) {
1160 object()->PrintNameTo(stream); 1215 object()->PrintNameTo(stream);
1161 stream->Add("["); 1216 stream->Add("[");
1162 key()->PrintNameTo(stream); 1217 key()->PrintNameTo(stream);
1163 stream->Add("]"); 1218 stream->Add("]");
1164 } 1219 }
1165 1220
1166 1221
1167 void HLoadKeyedGeneric::PrintDataTo(StringStream* stream) { 1222 void HLoadKeyedGeneric::PrintDataTo(StringStream* stream) {
1168 object()->PrintNameTo(stream); 1223 object()->PrintNameTo(stream);
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
1507 1562
1508 1563
1509 void HCheckPrototypeMaps::Verify() { 1564 void HCheckPrototypeMaps::Verify() {
1510 HInstruction::Verify(); 1565 HInstruction::Verify();
1511 ASSERT(HasNoUses()); 1566 ASSERT(HasNoUses());
1512 } 1567 }
1513 1568
1514 #endif 1569 #endif
1515 1570
1516 } } // namespace v8::internal 1571 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698