| Index: src/hydrogen-instructions.cc
|
| ===================================================================
|
| --- src/hydrogen-instructions.cc (revision 7299)
|
| +++ src/hydrogen-instructions.cc (working copy)
|
| @@ -1156,6 +1156,60 @@
|
| }
|
|
|
|
|
| +HLoadNamedFieldPolymorphic::HLoadNamedFieldPolymorphic(HValue* object,
|
| + ZoneMapList* types,
|
| + Handle<String> name)
|
| + : HUnaryOperation(object),
|
| + types_(Min(types->length(), kMaxLoadPolymorphism)),
|
| + name_(name),
|
| + need_generic_(false) {
|
| + set_representation(Representation::Tagged());
|
| + SetFlag(kDependsOnMaps);
|
| + for (int i = 0;
|
| + i < types->length() && types_.length() < kMaxLoadPolymorphism;
|
| + ++i) {
|
| + Handle<Map> map = types->at(i);
|
| + LookupResult lookup;
|
| + map->LookupInDescriptors(NULL, *name, &lookup);
|
| + if (lookup.IsProperty() && lookup.type() == FIELD) {
|
| + types_.Add(types->at(i));
|
| + int index = lookup.GetLocalFieldIndexFromMap(*map);
|
| + if (index < 0) {
|
| + SetFlag(kDependsOnInobjectFields);
|
| + } else {
|
| + SetFlag(kDependsOnBackingStoreFields);
|
| + }
|
| + }
|
| + }
|
| +
|
| + if (types_.length() == types->length() && FLAG_deoptimize_uncommon_cases) {
|
| + SetFlag(kUseGVN);
|
| + } else {
|
| + SetAllSideEffects();
|
| + need_generic_ = true;
|
| + }
|
| +}
|
| +
|
| +
|
| +bool HLoadNamedFieldPolymorphic::DataEquals(HValue* value) {
|
| + HLoadNamedFieldPolymorphic* other = HLoadNamedFieldPolymorphic::cast(value);
|
| + if (types_.length() != other->types()->length()) return false;
|
| + if (!name_.is_identical_to(other->name())) return false;
|
| + if (need_generic_ != other->need_generic_) return false;
|
| + for (int i = 0; i < types_.length(); i++) {
|
| + bool found = false;
|
| + for (int j = 0; j < types_.length(); j++) {
|
| + if (types_.at(j).is_identical_to(other->types()->at(i))) {
|
| + found = true;
|
| + break;
|
| + }
|
| + }
|
| + if (!found) return false;
|
| + }
|
| + return true;
|
| +}
|
| +
|
| +
|
| void HLoadKeyedFastElement::PrintDataTo(StringStream* stream) {
|
| object()->PrintNameTo(stream);
|
| stream->Add("[");
|
|
|