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

Unified Diff: src/factory.cc

Issue 1559323002: [prototype user tracking] Don't skip JSGlobalProxies (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 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 | src/objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/factory.cc
diff --git a/src/factory.cc b/src/factory.cc
index 7a5e78402d879006e29b12d87fa18427b4ddd317..96cfb0f151093cda5926377a91fe1ae5c7ab4da0 100644
--- a/src/factory.cc
+++ b/src/factory.cc
@@ -2034,14 +2034,22 @@ void Factory::ReinitializeJSGlobalProxy(Handle<JSGlobalProxy> object,
Handle<JSFunction> constructor) {
DCHECK(constructor->has_initial_map());
Handle<Map> map(constructor->initial_map(), isolate());
+ Handle<Map> old_map(object->map(), isolate());
// The proxy's hash should be retained across reinitialization.
Handle<Object> hash(object->hash(), isolate());
+ JSObject::InvalidatePrototypeChains(*old_map);
+ if (old_map->is_prototype_map()) {
+ map = Map::Copy(map, "CopyAsPrototypeForJSGlobalProxy");
+ map->set_is_prototype_map(true);
+ }
+ JSObject::UpdatePrototypeUserRegistration(old_map, map, isolate());
+
// Check that the already allocated object has the same size and type as
// objects allocated using the constructor.
- DCHECK(map->instance_size() == object->map()->instance_size());
- DCHECK(map->instance_type() == object->map()->instance_type());
+ DCHECK(map->instance_size() == old_map->instance_size());
+ DCHECK(map->instance_type() == old_map->instance_type());
// Allocate the backing storage for the properties.
Handle<FixedArray> properties = empty_fixed_array();
« no previous file with comments | « no previous file | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698