Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index 89d8c75ca0e02dec4e4ede8079ffa150ba079d6a..4b8cb16d40a956dacbc264316804fcd2c441b0ac 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -12778,9 +12778,17 @@ void Map::SetShouldBeFastPrototypeMap(Handle<Map> map, bool value, |
// static |
Handle<Cell> Map::GetOrCreatePrototypeChainValidityCell(Handle<Map> map, |
Isolate* isolate) { |
- Handle<Object> maybe_prototype( |
- map->GetPrototypeChainRootMap(isolate)->prototype(), isolate); |
- if (!maybe_prototype->IsJSObject()) return Handle<Cell>::null(); |
+ Handle<Object> maybe_prototype; |
+ if (map->IsJSGlobalObjectMap()) { |
+ DCHECK(map->is_prototype_map()); |
+ // Global object is prototype of a global proxy and therefore we can |
+ // use its validity cell for guarding global object's prototype change. |
+ maybe_prototype = isolate->global_object(); |
+ } else { |
+ maybe_prototype = |
+ handle(map->GetPrototypeChainRootMap(isolate)->prototype(), isolate); |
+ if (!maybe_prototype->IsJSObject()) return Handle<Cell>::null(); |
+ } |
Handle<JSObject> prototype = Handle<JSObject>::cast(maybe_prototype); |
// Ensure the prototype is registered with its own prototypes so its cell |
// will be invalidated when necessary. |