Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index 57ba4655e14b9d262a6b9e0e6b62a93fa70a9aba..e19a12e28ab2ed6259a693970f4967f669aabd90 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -6289,7 +6289,7 @@ HInstruction* HOptimizedGraphBuilder::BuildLoadNamedMonomorphic( |
return new(zone()) HConstant(function, Representation::Tagged()); |
} |
- // Handle a load from a known field somewhere in the protoype chain. |
+ // Handle a load from a known field somewhere in the prototype chain. |
LookupInPrototypes(map, name, &lookup); |
if (lookup.IsField()) { |
Handle<JSObject> prototype(JSObject::cast(map->prototype())); |
@@ -6301,6 +6301,17 @@ HInstruction* HOptimizedGraphBuilder::BuildLoadNamedMonomorphic( |
return BuildLoadNamedField(holder_value, holder_map, &lookup); |
} |
+ // Handle a load of a constant function somewhere in the prototype chain. |
+ if (lookup.IsConstantFunction()) { |
+ Handle<JSObject> prototype(JSObject::cast(map->prototype())); |
+ Handle<JSObject> holder(lookup.holder()); |
+ Handle<Map> holder_map(holder->map()); |
+ AddCheckMapsWithTransitions(object, map); |
+ AddInstruction(new(zone()) HCheckPrototypeMaps(prototype, holder)); |
+ Handle<JSFunction> function(lookup.GetConstantFunctionFromMap(*holder_map)); |
+ return new(zone()) HConstant(function, Representation::Tagged()); |
+ } |
+ |
// No luck, do a generic load. |
return BuildLoadNamedGeneric(object, name, expr); |
} |