| OLD | NEW |
| 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 Loading... |
| 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_(Min(types->length(), kMaxLoadPolymorphism)), |
| 1164 name_(name), |
| 1165 need_generic_(false) { |
| 1166 set_representation(Representation::Tagged()); |
| 1167 SetFlag(kDependsOnMaps); |
| 1168 for (int i = 0; |
| 1169 i < types->length() && types_.length() < kMaxLoadPolymorphism; |
| 1170 ++i) { |
| 1171 Handle<Map> map = types->at(i); |
| 1172 LookupResult lookup; |
| 1173 map->LookupInDescriptors(NULL, *name, &lookup); |
| 1174 if (lookup.IsProperty() && lookup.type() == FIELD) { |
| 1175 types_.Add(types->at(i)); |
| 1176 int index = lookup.GetLocalFieldIndexFromMap(*map); |
| 1177 if (index < 0) { |
| 1178 SetFlag(kDependsOnInobjectFields); |
| 1179 } else { |
| 1180 SetFlag(kDependsOnBackingStoreFields); |
| 1181 } |
| 1182 } |
| 1183 } |
| 1184 |
| 1185 if (types_.length() == types->length() && FLAG_deoptimize_uncommon_cases) { |
| 1186 SetFlag(kUseGVN); |
| 1187 } else { |
| 1188 SetAllSideEffects(); |
| 1189 need_generic_ = true; |
| 1190 } |
| 1191 } |
| 1192 |
| 1193 |
| 1194 bool HLoadNamedFieldPolymorphic::DataEquals(HValue* value) { |
| 1195 HLoadNamedFieldPolymorphic* other = HLoadNamedFieldPolymorphic::cast(value); |
| 1196 if (types_.length() != other->types()->length()) return false; |
| 1197 if (!name_.is_identical_to(other->name())) return false; |
| 1198 if (need_generic_ != other->need_generic_) return false; |
| 1199 for (int i = 0; i < types_.length(); i++) { |
| 1200 bool found = false; |
| 1201 for (int j = 0; j < types_.length(); j++) { |
| 1202 if (types_.at(j).is_identical_to(other->types()->at(i))) { |
| 1203 found = true; |
| 1204 break; |
| 1205 } |
| 1206 } |
| 1207 if (!found) return false; |
| 1208 } |
| 1209 return true; |
| 1210 } |
| 1211 |
| 1212 |
| 1159 void HLoadKeyedFastElement::PrintDataTo(StringStream* stream) { | 1213 void HLoadKeyedFastElement::PrintDataTo(StringStream* stream) { |
| 1160 object()->PrintNameTo(stream); | 1214 object()->PrintNameTo(stream); |
| 1161 stream->Add("["); | 1215 stream->Add("["); |
| 1162 key()->PrintNameTo(stream); | 1216 key()->PrintNameTo(stream); |
| 1163 stream->Add("]"); | 1217 stream->Add("]"); |
| 1164 } | 1218 } |
| 1165 | 1219 |
| 1166 | 1220 |
| 1167 void HLoadKeyedGeneric::PrintDataTo(StringStream* stream) { | 1221 void HLoadKeyedGeneric::PrintDataTo(StringStream* stream) { |
| 1168 object()->PrintNameTo(stream); | 1222 object()->PrintNameTo(stream); |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1507 | 1561 |
| 1508 | 1562 |
| 1509 void HCheckPrototypeMaps::Verify() { | 1563 void HCheckPrototypeMaps::Verify() { |
| 1510 HInstruction::Verify(); | 1564 HInstruction::Verify(); |
| 1511 ASSERT(HasNoUses()); | 1565 ASSERT(HasNoUses()); |
| 1512 } | 1566 } |
| 1513 | 1567 |
| 1514 #endif | 1568 #endif |
| 1515 | 1569 |
| 1516 } } // namespace v8::internal | 1570 } } // namespace v8::internal |
| OLD | NEW |