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

Unified Diff: src/objects.cc

Issue 1086063003: Correctly handle clearing of deprecated field types. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: just do one GC in test Created 5 years, 8 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-4027.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 20d7f9029b29e98bd7f5c21674087287be8f8216..a7ccace5234828eaabe2b49c2f2e68f2c4a5d35a 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -2389,10 +2389,17 @@ void Map::GeneralizeFieldType(Handle<Map> map, int modify_index,
Handle<DescriptorArray> descriptors(
field_owner->instance_descriptors(), isolate);
DCHECK_EQ(*old_field_type, descriptors->GetFieldType(modify_index));
-
- // Determine the generalized new field type.
- new_field_type = Map::GeneralizeFieldType(
- old_field_type, new_field_type, isolate);
+ bool old_field_type_was_cleared =
+ old_field_type->Is(HeapType::None()) && old_representation.IsHeapObject();
+
+ // Determine the generalized new field type. Conservatively assume type Any
+ // for cleared field types because the cleared type could have been a
+ // deprecated map and there still could be live instances with a non-
+ // deprecated version of the map.
+ new_field_type =
+ old_field_type_was_cleared
+ ? HeapType::Any(isolate)
+ : Map::GeneralizeFieldType(old_field_type, new_field_type, isolate);
PropertyDetails details = descriptors->GetDetails(modify_index);
Handle<Name> name(descriptors->GetKey(modify_index));
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-4027.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698