Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index 374e54c97389e448721421ca80898aeb6d42df1d..f72fd87ce60ab5bd49ed5318c5b39931a6dc009c 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -6030,6 +6030,19 @@ HInstruction* HGraphBuilder::BuildLoadNamedMonomorphic(HValue* object, |
return new(zone()) HConstant(function, Representation::Tagged()); |
} |
+ // Handle a load from a known field somewhere in the protoype chain. |
+ LookupInPrototypes(map, name, &lookup); |
+ if (lookup.IsField()) { |
+ Handle<JSObject> prototype(JSObject::cast(map->prototype())); |
+ Handle<JSObject> holder(lookup.holder()); |
+ Handle<Map> holder_map(holder->map()); |
+ AddInstruction(new(zone()) HCheckNonSmi(object)); |
+ AddInstruction(HCheckMaps::NewWithTransitions(object, map, zone())); |
+ HInstruction* holder_value = |
+ AddInstruction(new(zone()) HCheckPrototypeMaps(prototype, holder)); |
+ return BuildLoadNamedField(holder_value, holder_map, &lookup, false); |
+ } |
+ |
// No luck, do a generic load. |
return BuildLoadNamedGeneric(object, name, expr); |
} |