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

Unified Diff: src/hydrogen.cc

Issue 11338030: Improve handling of property loads on the proto chain. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Added unit test Created 8 years, 2 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 | « src/arm/lithium-codegen-arm.cc ('k') | src/hydrogen-instructions.h » ('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 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);
}
« no previous file with comments | « src/arm/lithium-codegen-arm.cc ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698