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

Unified Diff: src/objects.cc

Issue 424093002: Fix Object.freeze with field type tracking. (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 | « src/objects.h ('k') | test/mjsunit/regress/regress-update-field-type-attributes.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 713cad54f93e16680c2ef1d0c7c3d399c32e4768..e612d22c4e13a88c4928fb122e5a377d6c315d72 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -2443,15 +2443,23 @@ Map* Map::FindFieldOwner(int descriptor) {
}
-void Map::UpdateDescriptor(int descriptor_number, Descriptor* desc) {
+void Map::UpdateFieldType(int descriptor, Handle<Name> name,
+ Handle<HeapType> new_type) {
DisallowHeapAllocation no_allocation;
+ PropertyDetails details = instance_descriptors()->GetDetails(descriptor);
+ if (!details.type() == FIELD) return;
if (HasTransitionArray()) {
TransitionArray* transitions = this->transitions();
for (int i = 0; i < transitions->number_of_transitions(); ++i) {
- transitions->GetTarget(i)->UpdateDescriptor(descriptor_number, desc);
+ transitions->GetTarget(i)->UpdateFieldType(descriptor, name, new_type);
}
}
- instance_descriptors()->Replace(descriptor_number, desc);;
+ // Skip if already updated the shared descriptor.
+ if (instance_descriptors()->GetFieldType(descriptor) == *new_type) return;
+ FieldDescriptor d(name, instance_descriptors()->GetFieldIndex(descriptor),
+ new_type, details.attributes(), details.representation());
+ instance_descriptors()->Replace(descriptor, &d);
+ ;
}
@@ -2502,12 +2510,8 @@ void Map::GeneralizeFieldType(Handle<Map> map,
old_field_type, new_field_type, isolate);
PropertyDetails details = descriptors->GetDetails(modify_index);
- FieldDescriptor d(handle(descriptors->GetKey(modify_index), isolate),
- descriptors->GetFieldIndex(modify_index),
- new_field_type,
- details.attributes(),
- details.representation());
- field_owner->UpdateDescriptor(modify_index, &d);
+ Handle<Name> name(descriptors->GetKey(modify_index));
+ field_owner->UpdateFieldType(modify_index, name, new_field_type);
field_owner->dependent_code()->DeoptimizeDependentCodeGroup(
isolate, DependentCode::kFieldTypeGroup);
« no previous file with comments | « src/objects.h ('k') | test/mjsunit/regress/regress-update-field-type-attributes.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698