Index: src/bootstrapper.cc |
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc |
index fcca1548443ca809bb8685efcebcf77039497e60..dcb92b25cc1ab27a6d68fd7c8550ad716cd6431e 100644 |
--- a/src/bootstrapper.cc |
+++ b/src/bootstrapper.cc |
@@ -2859,6 +2859,30 @@ void Genesis::TransferNamedProperties(Handle<JSObject> from, |
} |
} |
} |
+ } else if (from->IsGlobalObject()) { |
+ Handle<GlobalDictionary> properties = |
+ Handle<GlobalDictionary>(from->global_dictionary()); |
+ int capacity = properties->Capacity(); |
+ for (int i = 0; i < capacity; i++) { |
+ Object* raw_key(properties->KeyAt(i)); |
+ if (properties->IsKey(raw_key)) { |
+ DCHECK(raw_key->IsName()); |
+ // If the property is already there we skip it. |
+ Handle<Name> key(Name::cast(raw_key)); |
+ LookupIterator it(to, key, LookupIterator::OWN_SKIP_INTERCEPTOR); |
+ CHECK_NE(LookupIterator::ACCESS_CHECK, it.state()); |
+ if (it.IsFound()) continue; |
+ // Set the property. |
+ Handle<Object> value = |
+ Handle<Object>(properties->ValueAt(i), isolate()); |
+ DCHECK(value->IsPropertyCell()); |
+ value = handle(PropertyCell::cast(*value)->value(), isolate()); |
+ if (value->IsTheHole()) continue; |
+ PropertyDetails details = properties->DetailsAt(i); |
+ DCHECK_EQ(kData, details.kind()); |
+ JSObject::AddProperty(to, key, value, details.attributes()); |
+ } |
+ } |
} else { |
Handle<NameDictionary> properties = |
Handle<NameDictionary>(from->property_dictionary()); |
@@ -2876,10 +2900,7 @@ void Genesis::TransferNamedProperties(Handle<JSObject> from, |
Handle<Object> value = Handle<Object>(properties->ValueAt(i), |
isolate()); |
DCHECK(!value->IsCell()); |
- if (value->IsPropertyCell()) { |
- value = handle(PropertyCell::cast(*value)->value(), isolate()); |
- } |
- if (value->IsTheHole()) continue; |
+ DCHECK(!value->IsTheHole()); |
PropertyDetails details = properties->DetailsAt(i); |
DCHECK_EQ(kData, details.kind()); |
JSObject::AddProperty(to, key, value, details.attributes()); |