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

Unified Diff: src/hydrogen.cc

Issue 12052008: Allow loading constant function from proto chain. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/mjsunit/compiler/proto-chain-constant.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « no previous file | test/mjsunit/compiler/proto-chain-constant.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698