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

Unified Diff: src/runtime/runtime-object.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 | « src/objects-printer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-object.cc
diff --git a/src/runtime/runtime-object.cc b/src/runtime/runtime-object.cc
index b470c9670516ee02e5d38042c263bbf0c3efebb1..4ab2d4caa6ad99e0c0c34ee3773a517df480129e 100644
--- a/src/runtime/runtime-object.cc
+++ b/src/runtime/runtime-object.cc
@@ -598,19 +598,27 @@ RUNTIME_FUNCTION(Runtime_KeyedGetProperty) {
DisallowHeapAllocation no_allocation;
Handle<JSObject> receiver = Handle<JSObject>::cast(receiver_obj);
Handle<Name> key = Handle<Name>::cast(key_obj);
- if (!receiver->HasFastProperties()) {
+ if (receiver->IsGlobalObject()) {
// Attempt dictionary lookup.
- NameDictionary* dictionary = receiver->property_dictionary();
+ GlobalDictionary* dictionary = receiver->global_dictionary();
int entry = dictionary->FindEntry(key);
- if ((entry != NameDictionary::kNotFound) &&
+ if ((entry != GlobalDictionary::kNotFound) &&
(dictionary->DetailsAt(entry).type() == DATA)) {
Object* value = dictionary->ValueAt(entry);
- if (!receiver->IsGlobalObject()) return value;
DCHECK(value->IsPropertyCell());
value = PropertyCell::cast(value)->value();
if (!value->IsTheHole()) return value;
// If value is the hole (meaning, absent) do the general lookup.
}
+ } else if (!receiver->HasFastProperties()) {
+ // Attempt dictionary lookup.
+ NameDictionary* dictionary = receiver->property_dictionary();
+ int entry = dictionary->FindEntry(key);
+ if ((entry != NameDictionary::kNotFound) &&
+ (dictionary->DetailsAt(entry).type() == DATA)) {
+ Object* value = dictionary->ValueAt(entry);
+ return value;
+ }
}
} else if (key_obj->IsSmi()) {
// JSObject without a name key. If the key is a Smi, check for a
« no previous file with comments | « src/objects-printer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698