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

Unified Diff: src/bootstrapper.cc

Issue 1165603002: Starting using GlobalDictionary for global objects instead of NameDictionary. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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/factory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
« no previous file with comments | « no previous file | src/factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698