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

Unified Diff: src/hydrogen.cc

Issue 9864028: Fix polymorphic load on named fields. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 9 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/regress/regress-2030.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 4da1609842b3d2efb454d36c1576822fffec8ac7..8c55a32af42642a356df79f4685d8ca609f7dc2c 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -4029,7 +4029,8 @@ void HGraphBuilder::HandlePolymorphicLoadNamedField(Property* expr,
SmallMapList* types,
Handle<String> name) {
int count = 0;
- int previous_field_index = 0;
+ int previous_field_offset = 0;
+ bool previous_field_is_in_object = false;
bool is_monomorphic_field = true;
Handle<Map> map;
LookupResult lookup(isolate());
@@ -4037,10 +4038,21 @@ void HGraphBuilder::HandlePolymorphicLoadNamedField(Property* expr,
map = types->at(i);
if (ComputeLoadStoreField(map, name, &lookup, false)) {
int index = ComputeLoadStoreFieldIndex(map, name, &lookup);
+ bool is_in_object = index < 0;
+ int offset = index * kPointerSize;
+ if (index < 0) {
+ // Negative property indices are in-object properties, indexed
+ // from the end of the fixed part of the object.
+ offset += map->instance_size();
+ } else {
+ offset += FixedArray::kHeaderSize;
+ }
if (count == 0) {
- previous_field_index = index;
+ previous_field_offset = offset;
+ previous_field_is_in_object = is_in_object;
} else if (is_monomorphic_field) {
- is_monomorphic_field = (index == previous_field_index);
+ is_monomorphic_field = (offset == previous_field_offset) &&
+ (is_in_object == previous_field_is_in_object);
}
++count;
}
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-2030.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698