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

Unified Diff: src/objects.cc

Issue 381113002: Ensure we update attributes in CopyGeneralizeFieldRepresentation (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 5 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 | no next file » | 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 702d8a222dcdd8ee31d06fec4206eaf3d6445c33..ad066af921bf961ac99b57fc3ddf89dd6e653d51 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -2339,17 +2339,22 @@ Handle<Map> Map::CopyGeneralizeAllRepresentations(Handle<Map> map,
// Unless the instance is being migrated, ensure that modify_index is a field.
PropertyDetails details = descriptors->GetDetails(modify_index);
- if (store_mode == FORCE_FIELD && details.type() != FIELD) {
+ if (store_mode == FORCE_FIELD &&
+ (details.type() != FIELD || details.attributes() != attributes)) {
+ int field_index = details.type() == FIELD ? details.field_index()
+ : new_map->NumberOfFields();
FieldDescriptor d(handle(descriptors->GetKey(modify_index), isolate),
- new_map->NumberOfFields(),
- attributes,
- Representation::Tagged());
+ field_index, attributes, Representation::Tagged());
descriptors->Replace(modify_index, &d);
- int unused_property_fields = new_map->unused_property_fields() - 1;
- if (unused_property_fields < 0) {
- unused_property_fields += JSObject::kFieldsAdded;
+ if (details.type() != FIELD) {
+ int unused_property_fields = new_map->unused_property_fields() - 1;
+ if (unused_property_fields < 0) {
+ unused_property_fields += JSObject::kFieldsAdded;
+ }
+ new_map->set_unused_property_fields(unused_property_fields);
}
- new_map->set_unused_property_fields(unused_property_fields);
+ } else {
+ ASSERT(details.attributes() == attributes);
}
if (FLAG_trace_generalization) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698