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

Unified Diff: src/objects.cc

Issue 961003002: Invalidate the global property cell when converting from data to accessor. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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/ic/handler-compiler.h ('k') | test/mjsunit/regress/convert-global-data-to-accessor.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 bef1881acb1ecd73556dec4796bf350dbe0745bd..f594b41d4f9bd3264f04cc920115c5550091bd94 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -565,7 +565,15 @@ void JSObject::SetNormalizedProperty(Handle<JSObject> object,
if (object->IsGlobalObject()) {
Handle<PropertyCell> cell(
PropertyCell::cast(property_dictionary->ValueAt(entry)));
- PropertyCell::SetValueInferType(cell, value);
+ if (details.type() != property_dictionary->DetailsAt(entry).type()) {
+ Isolate* isolate = object->GetIsolate();
+ Handle<Object> hole = isolate->factory()->the_hole_value();
+ PropertyCell::SetValueInferType(cell, hole);
+ cell = isolate->factory()->NewPropertyCell(value);
+ property_dictionary->SetEntry(entry, name, cell, details);
+ } else {
+ PropertyCell::SetValueInferType(cell, value);
+ }
// Please note we have to update the property details.
property_dictionary->DetailsAtPut(entry, details);
} else {
@@ -7411,12 +7419,7 @@ Handle<Map> Map::TransitionToAccessorProperty(Handle<Map> map,
Isolate* isolate = name->GetIsolate();
// Dictionary maps can always have additional data properties.
- if (map->is_dictionary_map()) {
- // For global objects, property cells are inlined. We need to change the
- // map.
- if (map->IsGlobalObjectMap()) return Copy(map, "GlobalAccessor");
- return map;
- }
+ if (map->is_dictionary_map()) return map;
// Migrate to the newest map before transitioning to the new property.
map = Update(map);
« no previous file with comments | « src/ic/handler-compiler.h ('k') | test/mjsunit/regress/convert-global-data-to-accessor.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698