Micro-optimize lookupiterator: faster path for fast-mode objects
authorverwaest <verwaest@chromium.org>
Wed, 1 Jul 2015 14:18:50 +0000 (07:18 -0700)
committerCommit bot <commit-bot@chromium.org>
Wed, 1 Jul 2015 14:19:02 +0000 (14:19 +0000)
BUG=chromium:505998
LOG=n

Review URL: https://codereview.chromium.org/1222543003

Cr-Commit-Position: refs/heads/master@{#29419}

src/lookup-inl.h
src/objects-inl.h

index 9b5927b..421cc08 100644 (file)
@@ -78,7 +78,13 @@ LookupIterator::State LookupIterator::LookupInHolder(Map* const map,
           if (number_ == kMaxUInt32) return NOT_FOUND;
           property_details_ = accessor->GetDetails(backing_store, number_);
         }
-      } else if (holder->IsGlobalObject()) {
+      } else if (!map->is_dictionary_map()) {
+        DescriptorArray* descriptors = map->instance_descriptors();
+        int number = descriptors->SearchWithCache(*name_, map);
+        if (number == DescriptorArray::kNotFound) return NOT_FOUND;
+        number_ = static_cast<uint32_t>(number);
+        property_details_ = descriptors->GetDetails(number_);
+      } else if (map->IsGlobalObjectMap()) {
         GlobalDictionary* dict = JSObject::cast(holder)->global_dictionary();
         int number = dict->FindEntry(name_);
         if (number == GlobalDictionary::kNotFound) return NOT_FOUND;
@@ -87,18 +93,12 @@ LookupIterator::State LookupIterator::LookupInHolder(Map* const map,
         PropertyCell* cell = PropertyCell::cast(dict->ValueAt(number_));
         if (cell->value()->IsTheHole()) return NOT_FOUND;
         property_details_ = cell->property_details();
-      } else if (map->is_dictionary_map()) {
+      } else {
         NameDictionary* dict = JSObject::cast(holder)->property_dictionary();
         int number = dict->FindEntry(name_);
         if (number == NameDictionary::kNotFound) return NOT_FOUND;
         number_ = static_cast<uint32_t>(number);
         property_details_ = dict->DetailsAt(number_);
-      } else {
-        DescriptorArray* descriptors = map->instance_descriptors();
-        int number = descriptors->SearchWithCache(*name_, map);
-        if (number == DescriptorArray::kNotFound) return NOT_FOUND;
-        number_ = static_cast<uint32_t>(number);
-        property_details_ = descriptors->GetDetails(number_);
       }
       has_property_ = true;
       switch (property_details_.kind()) {
index 9f535ca..4b143c8 100644 (file)
@@ -1028,10 +1028,7 @@ bool Object::IsJSGlobalProxy() const {
 
 bool Object::IsGlobalObject() const {
   if (!IsHeapObject()) return false;
-
-  InstanceType type = HeapObject::cast(this)->map()->instance_type();
-  return type == JS_GLOBAL_OBJECT_TYPE ||
-         type == JS_BUILTINS_OBJECT_TYPE;
+  return HeapObject::cast(this)->map()->IsGlobalObjectMap();
 }