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

Unified Diff: src/objects.cc

Issue 14843023: Fix bugs in rewriting combined with attributes and accessors (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 7 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/track-fields.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index ba7cdb10f5a3ebd4e06ca10831f8da04d0cedc42..ee0ff5123ab7839fced082347435621321d15f9d 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -2437,6 +2437,7 @@ Map* Map::FindRootMap() {
}
+// Returns NULL if the updated map is incompatible.
Map* Map::FindUpdatedMap(int verbatim,
int length,
DescriptorArray* descriptors) {
@@ -2452,6 +2453,17 @@ Map* Map::FindUpdatedMap(int verbatim,
int transition = transitions->Search(name);
if (transition == TransitionArray::kNotFound) break;
current = transitions->GetTarget(transition);
+ PropertyDetails details = descriptors->GetDetails(i);
+ PropertyDetails target_details =
+ current->instance_descriptors()->GetDetails(i);
+ if (details.attributes() != target_details.attributes()) return NULL;
+ if (details.type() == CALLBACKS) {
+ if (target_details.type() != CALLBACKS) return NULL;
+ if (descriptors->GetValue(i) !=
+ current->instance_descriptors()->GetValue(i)) {
+ return NULL;
+ }
+ }
}
return current;
@@ -2534,6 +2546,8 @@ MaybeObject* Map::GeneralizeRepresentation(int modify_index,
Map* updated = root_map->FindUpdatedMap(
verbatim, descriptors, old_descriptors);
+ if (updated == NULL) return CopyGeneralizeAllRepresentations();
+
// Check the state of the root map.
DescriptorArray* updated_descriptors = updated->instance_descriptors();
@@ -7509,19 +7523,13 @@ bool DescriptorArray::IsMoreGeneralThan(int verbatim,
for (int descriptor = verbatim; descriptor < valid; descriptor++) {
PropertyDetails details = GetDetails(descriptor);
PropertyDetails other_details = other->GetDetails(descriptor);
- if (details.type() != other_details.type()) {
- if (details.type() != FIELD ||
- other_details.type() != CONSTANT_FUNCTION) {
- return false;
- }
- } else if (details.type() == CONSTANT_FUNCTION) {
- if (GetValue(descriptor) != other->GetValue(descriptor)) {
- return false;
- }
- } else if (!other_details.representation().fits_into(
- details.representation())) {
+ if (!other_details.representation().fits_into(details.representation())) {
return false;
}
+ if (details.type() == CONSTANT_FUNCTION) {
+ if (other_details.type() != CONSTANT_FUNCTION) return false;
+ if (GetValue(descriptor) != other->GetValue(descriptor)) return false;
+ }
}
return true;
« no previous file with comments | « no previous file | test/mjsunit/track-fields.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698